src/lemon/iterable_graph_extender.h
changeset 1021 fd1d073b6557
parent 962 1a770e9f80b2
child 1022 567f392d1d2e
equal deleted inserted replaced
1:750aa2250a3a 2:fabaa2dcea51
   129   class IterableUndirGraphExtender : public IterableGraphExtender<_Base> {
   129   class IterableUndirGraphExtender : public IterableGraphExtender<_Base> {
   130   public:
   130   public:
   131 
   131 
   132     typedef IterableGraphExtender<_Base> Parent;
   132     typedef IterableGraphExtender<_Base> Parent;
   133     typedef IterableUndirGraphExtender<_Base> Graph;
   133     typedef IterableUndirGraphExtender<_Base> Graph;
       
   134     typedef typename Parent::Node Node;
   134 
   135 
   135     typedef typename Parent::UndirEdge UndirEdge;
   136     typedef typename Parent::UndirEdge UndirEdge;
   136 
   137 
   137     class UndirEdgeIt : public UndirEdge { 
   138     class UndirEdgeIt : public UndirEdge { 
   138       const Graph* graph;
   139       const Graph* graph;
   154 	return *this; 
   155 	return *this; 
   155       }
   156       }
   156 
   157 
   157     };
   158     };
   158 
   159 
       
   160     class UndirIncEdgeIt : public UndirEdge { 
       
   161       const Graph* graph;
       
   162       bool forward;
       
   163       friend class IterableUndirGraphExtender;
       
   164       template <typename G>
       
   165       friend class UndirGraphExtender;
       
   166     public:
       
   167 
       
   168       UndirIncEdgeIt() { }
       
   169 
       
   170       UndirIncEdgeIt(Invalid i) : UndirEdge(i), forward(false) { }
       
   171 
       
   172       explicit UndirIncEdgeIt(const Graph& _graph, const Node &n)
       
   173 	: graph(&_graph)
       
   174       {
       
   175 	_graph._dirFirstOut(*this, n);
       
   176       }
       
   177 
       
   178       // FIXME: Do we need this type of constructor here?
       
   179       // UndirIncEdgeIt(const Graph& _graph, const UndirEdge& e) : 
       
   180       //   UndirEdge(e), graph(&_graph) { }
       
   181 
       
   182       UndirIncEdgeIt& operator++() {
       
   183 	graph->_dirNextOut(*this);
       
   184 	return *this; 
       
   185       }
       
   186     };
       
   187 
       
   188     Node source(const UndirIncEdgeIt &e) const {
       
   189       return _dirSource(e);
       
   190     }
       
   191 
       
   192     /// \todo Shouldn't the "source" of an undirected edge be called "aNode"
       
   193     /// or something???
       
   194     using Parent::source;
       
   195 
       
   196     /// Target of the given Edge.
       
   197     Node target(const UndirIncEdgeIt &e) const {
       
   198       return _dirTarget(e);
       
   199     }
       
   200 
       
   201     /// \todo Shouldn't the "target" of an undirected edge be called "bNode"
       
   202     /// or something???
       
   203     using Parent::target;
   159 
   204 
   160   };
   205   };
   161 }
   206 }
   162 
   207 
   163 #endif // LEMON_GRAPH_EXTENDER_H
   208 #endif // LEMON_GRAPH_EXTENDER_H