src/work/marci/graph_wrapper.h
changeset 301 7eb324ed5da3
parent 275 2dd19df03593
child 303 1b377a730d02
equal deleted inserted replaced
23:5c5d2070f7d3 24:68e0f4c11b3f
   446 //       EdgeMap(const RevGraphWrapper<GraphWrapper>& _gw, T a) : 
   446 //       EdgeMap(const RevGraphWrapper<GraphWrapper>& _gw, T a) : 
   447 // 	GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::EdgeMap<T>(_gw, a) { }
   447 // 	GraphWrapper/*Skeleton< TrivGraphWrapper<Graph> >*/::EdgeMap<T>(_gw, a) { }
   448 //     };
   448 //     };
   449 //   };
   449 //   };
   450 
   450 
   451 
       
   452   template<typename GraphWrapper>
   451   template<typename GraphWrapper>
   453   class RevGraphWrapper : public GraphWrapperSkeleton<GraphWrapper> {
   452   class RevGraphWrapper : public GraphWrapperSkeleton<GraphWrapper> {
   454   public:
   453   public:
   455     typedef typename GraphWrapperSkeleton<GraphWrapper>::Node Node;
   454     typedef typename GraphWrapperSkeleton<GraphWrapper>::Node Node;
   456     typedef typename GraphWrapperSkeleton<GraphWrapper>::Edge Edge;
   455     typedef typename GraphWrapperSkeleton<GraphWrapper>::Edge Edge;
       
   456     //FIXME 
       
   457     //If GraphWrapper::OutEdgeIt is not defined
       
   458     //and we do not want to use RevGraphWrapper::InEdgeIt,
       
   459     //this won't work, because of typedef
       
   460     //OR
       
   461     //graphs have to define their non-existing iterators to void
       
   462     //Unfortunately all the typedefs are instantiated in templates, 
       
   463     //unlike other stuff
   457     typedef typename GraphWrapperSkeleton<GraphWrapper>::OutEdgeIt InEdgeIt;
   464     typedef typename GraphWrapperSkeleton<GraphWrapper>::OutEdgeIt InEdgeIt;
   458     typedef typename GraphWrapperSkeleton<GraphWrapper>::InEdgeIt OutEdgeIt;
   465     typedef typename GraphWrapperSkeleton<GraphWrapper>::InEdgeIt OutEdgeIt;
   459 
   466 
   460     RevGraphWrapper(GraphWrapper _gw) : 
   467     RevGraphWrapper(GraphWrapper _gw) : 
   461       GraphWrapperSkeleton<GraphWrapper>(_gw) { }  
   468       GraphWrapperSkeleton<GraphWrapper>(_gw) { }  
   700     //void setGraph(Graph& _graph) { graph = &_graph; }
   707     //void setGraph(Graph& _graph) { graph = &_graph; }
   701     //Graph& getGraph() const { return (*graph); }
   708     //Graph& getGraph() const { return (*graph); }
   702   
   709   
   703     class Edge {
   710     class Edge {
   704       friend class UndirGraphWrapper<GraphWrapper>;
   711       friend class UndirGraphWrapper<GraphWrapper>;
       
   712     protected:
   705       bool out_or_in; //true iff out
   713       bool out_or_in; //true iff out
   706       GraphOutEdgeIt out;
   714       GraphOutEdgeIt out;
   707       GraphInEdgeIt in;
   715       GraphInEdgeIt in;
   708     public:
   716     public:
   709       Edge() : out_or_in(), out(), in() { }
   717       Edge() : out_or_in(), out(), in() { }