[Lemon-commits] [lemon_svn] marci: r327 - hugo/trunk/src/work/marci

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:38:47 CET 2006


Author: marci
Date: Mon Mar 22 13:17:44 2004
New Revision: 327

Modified:
   hugo/trunk/src/work/marci/graph_wrapper.h

Log:
.


Modified: hugo/trunk/src/work/marci/graph_wrapper.h
==============================================================================
--- hugo/trunk/src/work/marci/graph_wrapper.h	(original)
+++ hugo/trunk/src/work/marci/graph_wrapper.h	Mon Mar 22 13:17:44 2004
@@ -103,7 +103,7 @@
     typedef typename GraphWrapper::EdgeIt EdgeIt;
 
     //GraphWrapperSkeleton() : gw() { }
-    GraphWrapperSkeleton(GraphWrapper& _gw) : gw(_gw) { }
+    GraphWrapperSkeleton(GraphWrapper _gw) : gw(_gw) { }
 
     void setGraph(BaseGraph& _graph) { gw.setGraph(_graph); }
     BaseGraph& getGraph() const { return gw.getGraph(); }
@@ -160,87 +160,173 @@
     };
   };
 
+//   template<typename Graph>
+//   class RevGraphWrapper
+//   {
+//   protected:
+//     Graph* graph;
+  
+//   public:
+//     typedef Graph BaseGraph;
+
+//     typedef typename Graph::Node Node;    
+//     typedef typename Graph::NodeIt NodeIt;
+  
+//     typedef typename Graph::Edge Edge;
+//     typedef typename Graph::OutEdgeIt InEdgeIt;
+//     typedef typename Graph::InEdgeIt OutEdgeIt;
+//     //typedef typename Graph::SymEdgeIt SymEdgeIt;
+//     typedef typename Graph::EdgeIt EdgeIt;
+
+//     //RevGraphWrapper() : graph(0) { }
+//     RevGraphWrapper(Graph& _graph) : graph(&_graph) { }
+
+//     void setGraph(Graph& _graph) { graph = &_graph; }
+//     Graph& getGraph() const { return (*graph); }
+    
+//     template<typename I> I& first(I& i) const { return graph->first(i); }
+//     template<typename I, typename P> I& first(I& i, const P& p) const { 
+//       return graph->first(i, p); }
+
+//     template<typename I> I getNext(const I& i) const { 
+//       return graph->getNext(i); }
+//     template<typename I> I& next(I &i) const { return graph->next(i); }    
+
+//     template< typename It > It first() const { 
+//       It e; first(e); return e; }
+
+//     template< typename It > It first(const Node& v) const { 
+//       It e; first(e, v); return e; }
+
+//     Node head(const Edge& e) const { return graph->tail(e); }
+//     Node tail(const Edge& e) const { return graph->head(e); }
+  
+//     template<typename I> bool valid(const I& i) const 
+//       { return graph->valid(i); }
+  
+//     //template<typename I> void setInvalid(const I &i);
+//     //{ return graph->setInvalid(i); }
+  
+//     template<typename I> Node aNode(const I& e) const { 
+//       return graph->aNode(e); }
+//     template<typename I> Node bNode(const I& e) const { 
+//       return graph->bNode(e); }
+
+//     Node addNode() const { return graph->addNode(); }
+//     Edge addEdge(const Node& tail, const Node& head) const { 
+//       return graph->addEdge(tail, head); }
+  
+//     int nodeNum() const { return graph->nodeNum(); }
+//     int edgeNum() const { return graph->edgeNum(); }
+  
+//     template<typename I> void erase(const I& i) const { graph->erase(i); }
+  
+//     void clear() const { graph->clear(); }
+
+//     template<typename T> class NodeMap : public Graph::NodeMap<T> { 
+//     public:
+//       NodeMap(const RevGraphWrapper<Graph>& _G) : 
+// 	Graph::NodeMap<T>(_G.getGraph()) { }
+//       NodeMap(const RevGraphWrapper<Graph>& _G, T a) : 
+// 	Graph::NodeMap<T>(_G.getGraph(), a) { }
+//     };
+
+//     template<typename T> class EdgeMap : public Graph::EdgeMap<T> { 
+//     public:
+//       EdgeMap(const RevGraphWrapper<Graph>& _G) : 
+// 	Graph::EdgeMap<T>(_G.getGraph()) { }
+//       EdgeMap(const RevGraphWrapper<Graph>& _G, T a) : 
+// 	Graph::EdgeMap<T>(_G.getGraph(), a) { }
+//     };
+//   };
+
   template<typename Graph>
-  class RevGraphWrapper
-  {
+  class RevGraphWrapper : 
+    public GraphWrapperSkeleton< TrivGraphWrapper<Graph> > {
   protected:
-    Graph* graph;
-  
+    //Graph* graph;
+    
   public:
-    typedef Graph BaseGraph;
+    //typedef Graph BaseGraph;
 
-    typedef typename Graph::Node Node;    
-    typedef typename Graph::NodeIt NodeIt;
+    //typedef typename Graph::Node Node;    
+    //typedef typename Graph::NodeIt NodeIt;
   
-    typedef typename Graph::Edge Edge;
-    typedef typename Graph::OutEdgeIt InEdgeIt;
-    typedef typename Graph::InEdgeIt OutEdgeIt;
+    //typedef typename Graph::Edge Edge;
+    typedef typename GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::OutEdgeIt InEdgeIt;
+    typedef typename GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::InEdgeIt OutEdgeIt;
     //typedef typename Graph::SymEdgeIt SymEdgeIt;
-    typedef typename Graph::EdgeIt EdgeIt;
+    //typedef typename Graph::EdgeIt EdgeIt;
 
     //RevGraphWrapper() : graph(0) { }
-    RevGraphWrapper(Graph& _graph) : graph(&_graph) { }
-
-    void setGraph(Graph& _graph) { graph = &_graph; }
-    Graph& getGraph() const { return (*graph); }
+    RevGraphWrapper(Graph& _graph) : GraphWrapperSkeleton< TrivGraphWrapper<Graph> >(TrivGraphWrapper<Graph>(_graph)) { }
     
-    template<typename I> I& first(I& i) const { return graph->first(i); }
-    template<typename I, typename P> I& first(I& i, const P& p) const { 
-      return graph->first(i, p); }
+    //void setGraph(Graph& _graph) { graph = &_graph; }
+    //Graph& getGraph() const { return (*graph); }
+    
+    //template<typename I> I& first(I& i) const { return graph->first(i); }
+    //template<typename I, typename P> I& first(I& i, const P& p) const { 
+    //  return graph->first(i, p); }
 
-    template<typename I> I getNext(const I& i) const { 
-      return graph->getNext(i); }
-    template<typename I> I& next(I &i) const { return graph->next(i); }    
+    //template<typename I> I getNext(const I& i) const { 
+    //  return graph->getNext(i); }
+    //template<typename I> I& next(I &i) const { return graph->next(i); }    
 
-    template< typename It > It first() const { 
-      It e; first(e); return e; }
+    //template< typename It > It first() const { 
+    //  It e; first(e); return e; }
 
-    template< typename It > It first(const Node& v) const { 
-      It e; first(e, v); return e; }
+    //template< typename It > It first(const Node& v) const { 
+    //  It e; first(e, v); return e; }
 
-    Node head(const Edge& e) const { return graph->tail(e); }
-    Node tail(const Edge& e) const { return graph->head(e); }
+    //Node head(const Edge& e) const { return graph->tail(e); }
+    //Node tail(const Edge& e) const { return graph->head(e); }
   
-    template<typename I> bool valid(const I& i) const 
-      { return graph->valid(i); }
+    //template<typename I> bool valid(const I& i) const 
+    //  { return graph->valid(i); }
   
     //template<typename I> void setInvalid(const I &i);
     //{ return graph->setInvalid(i); }
   
-    template<typename I> Node aNode(const I& e) const { 
-      return graph->aNode(e); }
-    template<typename I> Node bNode(const I& e) const { 
-      return graph->bNode(e); }
+    //template<typename I> Node aNode(const I& e) const { 
+    //  return graph->aNode(e); }
+    //template<typename I> Node bNode(const I& e) const { 
+    //  return graph->bNode(e); }
 
-    Node addNode() const { return graph->addNode(); }
-    Edge addEdge(const Node& tail, const Node& head) const { 
-      return graph->addEdge(tail, head); }
+    //Node addNode() const { return graph->addNode(); }
+    //Edge addEdge(const Node& tail, const Node& head) const { 
+    //  return graph->addEdge(tail, head); }
   
-    int nodeNum() const { return graph->nodeNum(); }
-    int edgeNum() const { return graph->edgeNum(); }
+    //int nodeNum() const { return graph->nodeNum(); }
+    //int edgeNum() const { return graph->edgeNum(); }
   
-    template<typename I> void erase(const I& i) const { graph->erase(i); }
+    //template<typename I> void erase(const I& i) const { graph->erase(i); }
   
-    void clear() const { graph->clear(); }
+    //void clear() const { graph->clear(); }
 
-    template<typename T> class NodeMap : public Graph::NodeMap<T> { 
+    template<typename T> class NodeMap : 
+      public GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::NodeMap<T> 
+    { 
     public:
       NodeMap(const RevGraphWrapper<Graph>& _G) : 
-	Graph::NodeMap<T>(_G.getGraph()) { }
+	GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::NodeMap<T>(_G) { }
       NodeMap(const RevGraphWrapper<Graph>& _G, T a) : 
-	Graph::NodeMap<T>(_G.getGraph(), a) { }
+	GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::NodeMap<T>(_G, a) { }
     };
-
-    template<typename T> class EdgeMap : public Graph::EdgeMap<T> { 
+    
+    template<typename T> class EdgeMap : 
+      public GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::EdgeMap<T> { 
     public:
       EdgeMap(const RevGraphWrapper<Graph>& _G) : 
-	Graph::EdgeMap<T>(_G.getGraph()) { }
+	GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::EdgeMap<T>(_G) { }
       EdgeMap(const RevGraphWrapper<Graph>& _G, T a) : 
-	Graph::EdgeMap<T>(_G.getGraph(), a) { }
+	GraphWrapperSkeleton< TrivGraphWrapper<Graph> >::EdgeMap<T>(_G, a) { }
     };
   };
 
 
+
+
+
   template<typename Graph>
   class UndirGraphWrapper {
   protected:



More information about the Lemon-commits mailing list