Changeset 265:bf7aea53635a in lemon0.x for src/work/marci/graph_wrapper.h
 Timestamp:
 03/30/04 15:37:21 (17 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@371
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/work/marci/graph_wrapper.h
r263 r265 16 16 17 17 typedef typename Graph::Node Node; 18 typedef typename Graph::NodeIt NodeIt; 19 18 class NodeIt : public Graph::NodeIt { 19 public: 20 NodeIt() { } 21 NodeIt(const typename Graph::NodeIt& n) : Graph::NodeIt(n) { } 22 NodeIt(const Invalid& i) : Graph::NodeIt(i) { } 23 NodeIt(const TrivGraphWrapper<Graph>& _G) : 24 Graph::NodeIt(*(_G.graph)) { } 25 }; 20 26 typedef typename Graph::Edge Edge; 21 typedef typename Graph::OutEdgeIt OutEdgeIt; 22 typedef typename Graph::InEdgeIt InEdgeIt; 27 //typedef typename Graph::OutEdgeIt OutEdgeIt; 28 class OutEdgeIt : public Graph::OutEdgeIt { 29 public: 30 OutEdgeIt() { } 31 OutEdgeIt(const typename Graph::OutEdgeIt& e) : Graph::OutEdgeIt(e) { } 32 OutEdgeIt(const Invalid& i) : Graph::OutEdgeIt(i) { } 33 OutEdgeIt(const TrivGraphWrapper<Graph>& _G, const Node& n) : 34 Graph::OutEdgeIt(*(_G.graph), n) { } 35 }; 36 //typedef typename Graph::InEdgeIt InEdgeIt; 37 class InEdgeIt : public Graph::InEdgeIt { 38 public: 39 InEdgeIt() { } 40 InEdgeIt(const typename Graph::InEdgeIt& e) : Graph::InEdgeIt(e) { } 41 InEdgeIt(const Invalid& i) : Graph::InEdgeIt(i) { } 42 InEdgeIt(const TrivGraphWrapper<Graph>& _G, const Node& n) : 43 Graph::InEdgeIt(*(_G.graph), n) { } 44 }; 23 45 //typedef typename Graph::SymEdgeIt SymEdgeIt; 24 typedef typename Graph::EdgeIt EdgeIt; 46 //typedef typename Graph::EdgeIt EdgeIt; 47 class EdgeIt : public Graph::EdgeIt { 48 public: 49 EdgeIt() { } 50 EdgeIt(const typename Graph::EdgeIt& e) : Graph::EdgeIt(e) { } 51 EdgeIt(const Invalid& i) : Graph::EdgeIt(i) { } 52 EdgeIt(const TrivGraphWrapper<Graph>& _G) : 53 Graph::EdgeIt(*(_G.graph)) { } 54 }; 25 55 26 56 //TrivGraphWrapper() : graph(0) { } 27 57 TrivGraphWrapper(Graph& _graph) : graph(&_graph) { } 28 58 29 void setGraph(Graph& _graph) { graph = &_graph; } 30 Graph& getGraph() const { return (*graph); } 31 32 template<typename I> I& first(I& i) const { return graph>first(i); } 33 template<typename I, typename P> I& first(I& i, const P& p) const { 34 return graph>first(i, p); } 35 36 template<typename I> I getNext(const I& i) const { 37 return graph>getNext(i); } 38 template<typename I> I& next(I &i) const { return graph>next(i); } 59 // void setGraph(Graph& _graph) { graph = &_graph; } 60 // Graph& getGraph() const { return (*graph); } 61 62 NodeIt& first(NodeIt& i) const { 63 i=NodeIt(*this); 64 return i; 65 } 66 EdgeIt& first(EdgeIt& i) const { 67 i=EdgeIt(*this); 68 return i; 69 } 70 // template<typename I> I& first(I& i) const { 71 // //return graph>first(i); 72 // i=I(*this); 73 // return i; 74 // } 75 OutEdgeIt& first(OutEdgeIt& i, const Node& p) const { 76 i=OutEdgeIt(*this, p); 77 return i; 78 } 79 InEdgeIt& first(InEdgeIt& i, const Node& p) const { 80 i=InEdgeIt(*this, p); 81 return i; 82 } 83 // template<typename I, typename P> I& first(I& i, const P& p) const { 84 // //return graph>first(i, p); 85 // i=I(*this, p); 86 // return i; 87 // } 88 89 // template<typename I> I getNext(const I& i) const { 90 // return graph>getNext(i); } 91 template<typename I> I& next(I &i) const { graph>next(i); return i; } 39 92 40 93 template< typename It > It first() const { … … 72 125 public: 73 126 NodeMap(const TrivGraphWrapper<Graph>& _G) : 74 Graph::NodeMap<T>( _G.getGraph()) { }127 Graph::NodeMap<T>(*(_G.graph)) { } 75 128 NodeMap(const TrivGraphWrapper<Graph>& _G, T a) : 76 Graph::NodeMap<T>( _G.getGraph(), a) { }129 Graph::NodeMap<T>(*(_G.graph), a) { } 77 130 }; 78 131 … … 80 133 public: 81 134 EdgeMap(const TrivGraphWrapper<Graph>& _G) : 82 Graph::EdgeMap<T>( _G.getGraph()) { }135 Graph::EdgeMap<T>(*(_G.graph)) { } 83 136 EdgeMap(const TrivGraphWrapper<Graph>& _G, T a) : 84 Graph::EdgeMap<T>( _G.getGraph(), a) { }137 Graph::EdgeMap<T>(*(_G.graph), a) { } 85 138 }; 86 139 }; … … 94 147 //typedef typename GraphWrapper::BaseGraph BaseGraph; 95 148 149 // typedef typename GraphWrapper::Node Node; 150 // typedef typename GraphWrapper::NodeIt NodeIt; 151 152 // typedef typename GraphWrapper::Edge Edge; 153 // typedef typename GraphWrapper::OutEdgeIt OutEdgeIt; 154 // typedef typename GraphWrapper::InEdgeIt InEdgeIt; 155 // //typedef typename GraphWrapper::SymEdgeIt SymEdgeIt; 156 // typedef typename GraphWrapper::EdgeIt EdgeIt; 157 96 158 typedef typename GraphWrapper::Node Node; 97 typedef typename GraphWrapper::NodeIt NodeIt; 98 159 class NodeIt : public GraphWrapper::NodeIt { 160 public: 161 NodeIt() { } 162 NodeIt(const typename GraphWrapper::NodeIt& n) : 163 GraphWrapper::NodeIt(n) { } 164 NodeIt(const Invalid& i) : GraphWrapper::NodeIt(i) { } 165 NodeIt(const GraphWrapperSkeleton<GraphWrapper>& _G) : 166 GraphWrapper::NodeIt(_G.gw) { } 167 }; 99 168 typedef typename GraphWrapper::Edge Edge; 100 typedef typename GraphWrapper::OutEdgeIt OutEdgeIt; 101 typedef typename GraphWrapper::InEdgeIt InEdgeIt; 169 //typedef typename GraphWrapper::OutEdgeIt OutEdgeIt; 170 class OutEdgeIt : public GraphWrapper::OutEdgeIt { 171 public: 172 OutEdgeIt() { } 173 OutEdgeIt(const typename GraphWrapper::OutEdgeIt& e) : 174 GraphWrapper::OutEdgeIt(e) { } 175 OutEdgeIt(const Invalid& i) : GraphWrapper::OutEdgeIt(i) { } 176 OutEdgeIt(const GraphWrapperSkeleton<GraphWrapper>& _G, const Node& n) : 177 GraphWrapper::OutEdgeIt(_G.gw, n) { } 178 }; 179 //typedef typename GraphWrapper::InEdgeIt InEdgeIt; 180 class InEdgeIt : public GraphWrapper::InEdgeIt { 181 public: 182 InEdgeIt() { } 183 InEdgeIt(const typename GraphWrapper::InEdgeIt& e) : 184 GraphWrapper::InEdgeIt(e) { } 185 InEdgeIt(const Invalid& i) : GraphWrapper::InEdgeIt(i) { } 186 InEdgeIt(const GraphWrapperSkeleton<GraphWrapper>& _G, const Node& n) : 187 GraphWrapper::InEdgeIt(_G.gw, n) { } 188 }; 102 189 //typedef typename GraphWrapper::SymEdgeIt SymEdgeIt; 103 typedef typename GraphWrapper::EdgeIt EdgeIt; 190 //typedef typename GraphWrapper::EdgeIt EdgeIt; 191 class EdgeIt : public GraphWrapper::EdgeIt { 192 public: 193 EdgeIt() { } 194 EdgeIt(const typename GraphWrapper::EdgeIt& e) : 195 GraphWrapper::EdgeIt(e) { } 196 EdgeIt(const Invalid& i) : GraphWrapper::EdgeIt(i) { } 197 EdgeIt(const GraphWrapperSkeleton<GraphWrapper>& _G) : 198 GraphWrapper::EdgeIt(_G.gw) { } 199 }; 200 104 201 105 202 //GraphWrapperSkeleton() : gw() { } … … 109 206 //BaseGraph& getGraph() const { return gw.getGraph(); } 110 207 111 template<typename I> I& first(I& i) const { return gw.first(i); } 208 template<typename I> I& first(I& i) const { 209 i=I(*this); 210 return i; 211 } 112 212 template<typename I, typename P> I& first(I& i, const P& p) const { 113 return gw.first(i, p); } 114 115 template<typename I> I getNext(const I& i) const { return gw.getNext(i); } 116 template<typename I> I& next(I &i) const { return gw.next(i); } 213 i=I(*this, p); 214 return i; 215 } 216 217 // template<typename I> I getNext(const I& i) const { return gw.getNext(i); } 218 template<typename I> I& next(I &i) const { gw.next(i); return i; } 117 219 118 220 template< typename It > It first() const { … … 656 758 } 657 759 658 template<typename I> I& first(I& i) const { return gw.first(i); }760 template<typename I> I& first(I& i) const { gw.first(i); return i; } 659 761 template<typename I, typename P> I& first(I& i, const P& p) const { 660 return graph>first(i, p); }762 graph>first(i, p); return i; } 661 763 662 764 OutEdgeIt& next(OutEdgeIt& e) const { … … 682 784 683 785 template<typename I> I& next(I &i) const { return gw.next(i); } 684 template<typename I> I getNext(const I& i) const { return gw.getNext(i); }786 // template<typename I> I getNext(const I& i) const { return gw.getNext(i); } 685 787 686 788 template< typename It > It first() const { … … 814 916 public: 815 917 //typedef Graph BaseGraph; 816 typedef typename Graph::Node Node; 817 typedef typename Graph::NodeIt NodeIt; 918 typedef TrivGraphWrapper<const Graph> GraphWrapper; 919 typedef typename GraphWrapper::Node Node; 920 typedef typename GraphWrapper::NodeIt NodeIt; 818 921 private: 819 typedef typename Graph ::OutEdgeIt OldOutEdgeIt;820 typedef typename Graph ::InEdgeIt OldInEdgeIt;922 typedef typename GraphWrapper::OutEdgeIt OldOutEdgeIt; 923 typedef typename GraphWrapper::InEdgeIt OldInEdgeIt; 821 924 protected: 822 925 //const Graph* graph; 823 typedef TrivGraphWrapper<const Graph> GraphWrapper;824 926 GraphWrapper gw; 825 927 FlowMap* flow; … … 872 974 OutEdgeIt(const Edge& e) : Edge(e) { } 873 975 OutEdgeIt(const Invalid& i) : Edge(i) { } 874 pr ivate:976 protected: 875 977 OutEdgeIt(const ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>& resG, Node v) : Edge() { 876 978 resG.gw.first(out, v); … … 906 1008 class EdgeIt : public Edge { 907 1009 friend class ResGraphWrapper<Graph, Number, FlowMap, CapacityMap>; 908 typename Graph::NodeIt v;1010 NodeIt v; 909 1011 public: 910 1012 EdgeIt() { }
Note: See TracChangeset
for help on using the changeset viewer.