Changeset 70:851ca9a60e90 in lemon0.x for src/work/alpar
 Timestamp:
 02/10/04 14:29:15 (21 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@86
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/work/alpar/gwrapper.h
r65 r70 84 84 NodeIt tail(const EdgeIt &e); 85 85 { return graph>head(e); } 86 87 template<typename I> NodeIt aNode(const I e); 88 { return graph>aNode(e); } 89 template<typename I> NodeIt bNode(const I e); 90 { return graph>bNode(e); } 91 92 template<typename I> bool valid(const I i); 93 { return graph>valid(i); } 94 95 template<typename I> void setInvalid(const I &i); 96 { return graph>setInvalid(i); } 97 98 NodeIt addNode(); { return graph>addNode(); } 99 EdgeIt addEdge(const NodeIt from,const NodeIt to); 100 { return graph>addEdge(to,from); } 101 102 template<I> void delete(I i); { graph>delete(i); } 103 104 void clean(); { graph>clean(); } 105 106 template<class T> class NodeMap : public typename G::NodeMap<T>; 107 template<class T> class EdgeMap : public typename G::EdgeMap<T>; 108 109 void SetG(G &g) {graph = &g;} 110 111 RevGraphWrapper() {graph = NULL;} 112 RevGraphWrapper(G &g) {graph = &g;} 113 }; 114 115 template<typename G> 116 class SymGraphWrapper 117 { 118 G *graph; 119 120 public: 121 typedef G BaseGraph; 122 123 typedef typename G::EdgeIt EdgeIt; 124 125 typedef typename G::InEdgeIt SymEdgeIt; 126 typedef typename G::OutEdgeIt SymEdgeIt; 127 typedef typename G::SymEdgeIt SymEdgeIt; 128 typedef typename G::EachEdgeIt EachEdgeIt; 129 130 typedef typename G::NodeIt NodeIt; 131 132 template<typename I> I &getFirst(I &i); { return graph>getFirst(i); } 133 template<typename I,typename P> I &getFirst(I &i,const P &p); 134 { return graph>getFirst(i,p); } 135 template<typename I> I next(const I i); { return graph>goNext(i); } 136 template<typename I> I &goNext(I &i); { return graph>goNext(i); } 137 138 NodeIt head(const EdgeIt &e); 139 { return graph>head(e); } 140 NodeIt tail(const EdgeIt &e); 141 { return graph>tail(e); } 142 143 template<typename I> NodeIt aNode(const I e); 144 { return graph>aNode(e); } 145 template<typename I> NodeIt bNode(const I e); 146 { return graph>bNode(e); } 147 148 template<typename I> bool valid(const I i); 149 { return graph>valid(i); } 150 151 template<typename I> void setInvalid(const I &i); 152 { return graph>setInvalid(i); } 153 154 NodeIt addNode(); { return graph>addNode(); } 155 EdgeIt addEdge(const NodeIt from,const NodeIt to); 156 { return graph>addEdge(to,from); } 157 158 template<I> void delete(I i); { graph>delete(i); } 159 160 void clean(); { graph>clean(); } 161 162 template<class T> class NodeMap : public typename G::NodeMap<T>; 163 template<class T> class EdgeMap : public typename G::EdgeMap<T>; 164 165 void SetG(G &g) {graph = &g;} 166 167 RevGraphWrapper() {graph = NULL;} 168 RevGraphWrapper(G &g) {graph = &g;} 169 }; 170 171 172 // FIXME: comparison should be made better!!! 173 template<typename G, typename lomap, typename fmap, typename himap> 174 class ResGraphWrapper 175 { 176 G *graph; 177 178 public: 179 typedef G BaseGraph; 180 181 typedef typename G::EdgeIt EdgeIt; 182 183 class InEdgeIt 184 { 185 public: 186 G::NodeIt n; 187 G::InEdgeIt i; 188 G::OutEdgeIt o; 189 } 190 class OutEdgeIt 191 { 192 public: 193 G::NodeIt n; 194 G::InEdgeIt i; 195 G::OutEdgeIt o; 196 } 197 typedef typename G::SymEdgeIt SymEdgeIt; 198 typedef typename G::EachEdgeIt EachEdgeIt; 199 200 typedef typename G::NodeIt NodeIt; 201 202 NodeIt &getFirst(NodeIt &n); { return graph>getFirst(n); } 203 204 // EachEdge and SymEdge is missing!!!! 205 // EdgeIt <> In/OutEdgeIt conversion is missing!!!! 206 207 InEdgeIt &getFirst(InEdgeIt &e,const NodeIt &n) 208 { 209 e.n=n; 210 graph>getFirst(e.i,n); 211 while(graph>valid(e.i) && fmap.get(e.i)>=himap.get(e.i)) 212 graph>goNext(e.i); 213 if(!graph>valid(e.i)) { 214 graph>getFirst(e.o,n); 215 while(graph>valid(e.o) && fmap.get(e.o)<=lomap.get(e.o)) 216 graph>goNext(e.o); 217 } 218 return e; 219 } 220 InEdgeIt &goNext(InEdgeIt &e) 221 { 222 if(graph>valid(e.i)) { 223 while(graph>valid(e.i) && fmap.get(e.i)>=himap.get(e.i)) 224 graph>goNext(e.i); 225 if(graph>valid(e.i)) return e; 226 else graph>getFirst(e.o,e.n); 227 } 228 else { 229 while(graph>valid(e.o) && fmap.get(e.o)<=lomap.get(e.o)) 230 graph>goNext(e.o); 231 return e; 232 } 233 } 234 InEdgeIt Next(const InEdgeIt &e) {InEdgeIt t(e); return goNext(t);} 235 bool valid(const InEdgeIt e) { return graph>valid(e.i)graph>valid(e.o);} 236 237 OutEdgeIt &getFirst(OutEdgeIt &e,const NodeIt &n) 238 { 239 e.n=n; 240 graph>getFirst(e.o,n); 241 while(graph>valid(e.o) && fmap.get(e.o)>=himap.get(e.o)) 242 graph>goNext(e.o); 243 if(!graph>valid(e.o)) { 244 graph>getFirst(e.i,n); 245 while(graph>valid(e.i) && fmap.get(e.i)<=lomap.get(e.i)) 246 graph>goNext(e.i); 247 } 248 return e; 249 } 250 OutEdgeIt &goNext(OutEdgeIt &e) 251 { 252 if(graph>valid(e.o)) { 253 while(graph>valid(e.o) && fmap.get(e.o)>=himap.get(e.o)) 254 graph>goNext(e.o); 255 if(graph>valid(e.o)) return e; 256 else graph>getFirst(e.i,e.n); 257 } 258 else { 259 while(graph>valid(e.i) && fmap.get(e.i)<=lomap.get(e.i)) 260 graph>goNext(e.i); 261 return e; 262 } 263 } 264 OutEdgeIt Next(const OutEdgeIt &e) {OutEdgeIt t(e); return goNext(t);} 265 bool valid(const OutEdgeIt e) { return graph>valid(e.o)graph>valid(e.i);} 266 267 template<typename I> I &goNext(I &i); { return graph>goNext(i); } 268 template<typename I> I next(const I i); { return graph>goNext(i); } 269 270 NodeIt head(const EdgeIt &e); 271 { return graph>head(e); } 272 NodeIt tail(const EdgeIt &e); 273 { return graph>tail(e); } 86 274 87 275 template<typename I> NodeIt aNode(const I e);
Note: See TracChangeset
for help on using the changeset viewer.