Changeset 1021:fd1d073b6557 in lemon-0.x for src/lemon/undir_graph_extender.h
- Timestamp:
- 11/25/04 15:48:24 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1411
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/lemon/undir_graph_extender.h
r986 r1021 71 71 } 72 72 73 /// Source of the given Edge. 74 Node source(const Edge &e) const { 73 protected: 74 75 template <typename E> 76 Node _dirSource(const E &e) const { 75 77 return e.forward ? Parent::source(e) : Parent::target(e); 76 78 } 77 79 80 template <typename E> 81 Node _dirTarget(const E &e) const { 82 return e.forward ? Parent::target(e) : Parent::source(e); 83 } 84 85 public: 78 86 /// \todo Shouldn't the "source" of an undirected edge be called "aNode" 79 87 /// or something??? 80 88 using Parent::source; 81 89 82 /// Targetof the given Edge.83 Node target(const Edge &e) const {84 return e.forward ? Parent::target(e) : Parent::source(e);90 /// Source of the given Edge. 91 Node source(const Edge &e) const { 92 return _dirSource(e); 85 93 } 86 94 … … 88 96 /// or something??? 89 97 using Parent::target; 98 99 /// Target of the given Edge. 100 Node target(const Edge &e) const { 101 return _dirTarget(e); 102 } 90 103 91 104 /// Returns whether the given directed edge is same orientation as the … … 123 136 } 124 137 125 void firstOut(Edge &e, const Node &n) const { 138 139 protected: 140 141 template <typename E> 142 void _dirFirstOut(E &e, const Node &n) const { 126 143 Parent::firstOut(e,n); 127 144 if( UndirEdge(e) != INVALID ) { … … 133 150 } 134 151 } 135 void firstIn(Edge &e, const Node &n) const { 152 template <typename E> 153 void _dirFirstIn(E &e, const Node &n) const { 136 154 Parent::firstIn(e,n); 137 155 if( UndirEdge(e) != INVALID ) { … … 144 162 } 145 163 146 void nextOut(Edge &e) const { 164 template <typename E> 165 void _dirNextOut(E &e) const { 147 166 if( e.forward ) { 148 167 Parent::nextOut(e); … … 156 175 } 157 176 } 158 void nextIn(Edge &e) const { 177 template <typename E> 178 void _dirNextIn(E &e) const { 159 179 if( e.forward ) { 160 180 Parent::nextIn(e); … … 169 189 } 170 190 191 public: 192 193 void firstOut(Edge &e, const Node &n) const { 194 _dirFirstOut(e, n); 195 } 196 void firstIn(Edge &e, const Node &n) const { 197 _dirFirstIn(e, n); 198 } 199 200 void nextOut(Edge &e) const { 201 _dirNextOut(e); 202 } 203 void nextIn(Edge &e) const { 204 _dirNextIn(e); 205 } 206 171 207 // Miscellaneous stuff: 172 208 … … 174 210 /// Extender 175 211 176 using Parent::id; 212 // using Parent::id; 213 // Using "using" is not a good idea, cause it could be that there is 214 // no "id" in Parent... 215 216 int id(const Node &n) const { 217 return Parent::id(n); 218 } 219 220 int id(const UndirEdge &e) const { 221 return Parent::id(e); 222 } 177 223 178 224 int id(const Edge &e) const { … … 180 226 } 181 227 182 int maxId(Edge = INVALID) const { 228 229 int maxId(Node n) const { 230 return Parent::maxId(Node()); 231 } 232 233 int maxId(Edge) const { 183 234 return 2 * Parent::maxId(typename Parent::Edge()) + 1; 184 235 } 185 int maxId(UndirEdge = INVALID) const {236 int maxId(UndirEdge) const { 186 237 return Parent::maxId(typename Parent::Edge()); 187 238 }
Note: See TracChangeset
for help on using the changeset viewer.