Changeset 664:4137ef9aacc6 in lemon for lemon/bits/edge_set_extender.h
 Timestamp:
 04/24/09 11:54:48 (12 years ago)
 Branch:
 default
 Phase:
 public
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/bits/edge_set_extender.h
r606 r664 35 35 template <typename Base> 36 36 class ArcSetExtender : public Base { 37 typedef Base Parent; 38 37 39 public: 38 40 39 typedef Base Parent;40 41 typedef ArcSetExtender Digraph; 41 42 … … 219 220 class ArcMap 220 221 : public MapExtender<DefaultMap<Digraph, Arc, _Value> > { 221 public:222 typedef ArcSetExtender Digraph;223 222 typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent; 224 223 224 public: 225 225 explicit ArcMap(const Digraph& _g) 226 226 : Parent(_g) {} … … 275 275 template <typename Base> 276 276 class EdgeSetExtender : public Base { 277 typedef Base Parent; 277 278 278 279 public: 279 280 280 typedef Base Parent; 281 typedef EdgeSetExtender Digraph; 281 typedef EdgeSetExtender Graph; 282 282 283 283 typedef typename Parent::Node Node; 284 284 typedef typename Parent::Arc Arc; 285 285 typedef typename Parent::Edge Edge; 286 287 286 288 287 int maxId(Node) const { … … 351 350 352 351 class NodeIt : public Node { 353 const Digraph* digraph;352 const Graph* graph; 354 353 public: 355 354 … … 358 357 NodeIt(Invalid i) : Node(i) { } 359 358 360 explicit NodeIt(const Digraph& _graph) : digraph(&_graph) {359 explicit NodeIt(const Graph& _graph) : graph(&_graph) { 361 360 _graph.first(static_cast<Node&>(*this)); 362 361 } 363 362 364 NodeIt(const Digraph& _graph, const Node& node)365 : Node(node), digraph(&_graph) {}363 NodeIt(const Graph& _graph, const Node& node) 364 : Node(node), graph(&_graph) {} 366 365 367 366 NodeIt& operator++() { 368 digraph>next(*this);367 graph>next(*this); 369 368 return *this; 370 369 } … … 374 373 375 374 class ArcIt : public Arc { 376 const Digraph* digraph;375 const Graph* graph; 377 376 public: 378 377 … … 381 380 ArcIt(Invalid i) : Arc(i) { } 382 381 383 explicit ArcIt(const Digraph& _graph) : digraph(&_graph) {382 explicit ArcIt(const Graph& _graph) : graph(&_graph) { 384 383 _graph.first(static_cast<Arc&>(*this)); 385 384 } 386 385 387 ArcIt(const Digraph& _graph, const Arc& e) :388 Arc(e), digraph(&_graph) { }386 ArcIt(const Graph& _graph, const Arc& e) : 387 Arc(e), graph(&_graph) { } 389 388 390 389 ArcIt& operator++() { 391 digraph>next(*this);390 graph>next(*this); 392 391 return *this; 393 392 } … … 397 396 398 397 class OutArcIt : public Arc { 399 const Digraph* digraph;398 const Graph* graph; 400 399 public: 401 400 … … 404 403 OutArcIt(Invalid i) : Arc(i) { } 405 404 406 OutArcIt(const Digraph& _graph, const Node& node)407 : digraph(&_graph) {405 OutArcIt(const Graph& _graph, const Node& node) 406 : graph(&_graph) { 408 407 _graph.firstOut(*this, node); 409 408 } 410 409 411 OutArcIt(const Digraph& _graph, const Arc& arc)412 : Arc(arc), digraph(&_graph) {}410 OutArcIt(const Graph& _graph, const Arc& arc) 411 : Arc(arc), graph(&_graph) {} 413 412 414 413 OutArcIt& operator++() { 415 digraph>nextOut(*this);414 graph>nextOut(*this); 416 415 return *this; 417 416 } … … 421 420 422 421 class InArcIt : public Arc { 423 const Digraph* digraph;422 const Graph* graph; 424 423 public: 425 424 … … 428 427 InArcIt(Invalid i) : Arc(i) { } 429 428 430 InArcIt(const Digraph& _graph, const Node& node)431 : digraph(&_graph) {429 InArcIt(const Graph& _graph, const Node& node) 430 : graph(&_graph) { 432 431 _graph.firstIn(*this, node); 433 432 } 434 433 435 InArcIt(const Digraph& _graph, const Arc& arc) :436 Arc(arc), digraph(&_graph) {}434 InArcIt(const Graph& _graph, const Arc& arc) : 435 Arc(arc), graph(&_graph) {} 437 436 438 437 InArcIt& operator++() { 439 digraph>nextIn(*this);438 graph>nextIn(*this); 440 439 return *this; 441 440 } … … 445 444 446 445 class EdgeIt : public Parent::Edge { 447 const Digraph* digraph;446 const Graph* graph; 448 447 public: 449 448 … … 452 451 EdgeIt(Invalid i) : Edge(i) { } 453 452 454 explicit EdgeIt(const Digraph& _graph) : digraph(&_graph) {453 explicit EdgeIt(const Graph& _graph) : graph(&_graph) { 455 454 _graph.first(static_cast<Edge&>(*this)); 456 455 } 457 456 458 EdgeIt(const Digraph& _graph, const Edge& e) :459 Edge(e), digraph(&_graph) { }457 EdgeIt(const Graph& _graph, const Edge& e) : 458 Edge(e), graph(&_graph) { } 460 459 461 460 EdgeIt& operator++() { 462 digraph>next(*this);461 graph>next(*this); 463 462 return *this; 464 463 } … … 468 467 class IncEdgeIt : public Parent::Edge { 469 468 friend class EdgeSetExtender; 470 const Digraph* digraph;469 const Graph* graph; 471 470 bool direction; 472 471 public: … … 476 475 IncEdgeIt(Invalid i) : Edge(i), direction(false) { } 477 476 478 IncEdgeIt(const Digraph& _graph, const Node &n) : digraph(&_graph) {477 IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) { 479 478 _graph.firstInc(*this, direction, n); 480 479 } 481 480 482 IncEdgeIt(const Digraph& _graph, const Edge &ue, const Node &n)483 : digraph(&_graph), Edge(ue) {481 IncEdgeIt(const Graph& _graph, const Edge &ue, const Node &n) 482 : graph(&_graph), Edge(ue) { 484 483 direction = (_graph.source(ue) == n); 485 484 } 486 485 487 486 IncEdgeIt& operator++() { 488 digraph>nextInc(*this, direction);487 graph>nextInc(*this, direction); 489 488 return *this; 490 489 } … … 535 534 template <typename _Value> 536 535 class ArcMap 537 : public MapExtender<DefaultMap<Digraph, Arc, _Value> > { 538 public: 539 typedef EdgeSetExtender Digraph; 540 typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent; 541 542 ArcMap(const Digraph& _g) 536 : public MapExtender<DefaultMap<Graph, Arc, _Value> > { 537 typedef MapExtender<DefaultMap<Graph, Arc, _Value> > Parent; 538 539 public: 540 ArcMap(const Graph& _g) 543 541 : Parent(_g) {} 544 ArcMap(const Digraph& _g, const _Value& _v)542 ArcMap(const Graph& _g, const _Value& _v) 545 543 : Parent(_g, _v) {} 546 544 … … 560 558 template <typename _Value> 561 559 class EdgeMap 562 : public MapExtender<DefaultMap<Digraph, Edge, _Value> > { 563 public: 564 typedef EdgeSetExtender Digraph; 565 typedef MapExtender<DefaultMap<Digraph, Edge, _Value> > Parent; 566 567 EdgeMap(const Digraph& _g) 560 : public MapExtender<DefaultMap<Graph, Edge, _Value> > { 561 typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent; 562 563 public: 564 EdgeMap(const Graph& _g) 568 565 : Parent(_g) {} 569 566 570 EdgeMap(const Digraph& _g, const _Value& _v)567 EdgeMap(const Graph& _g, const _Value& _v) 571 568 : Parent(_g, _v) {} 572 569
Note: See TracChangeset
for help on using the changeset viewer.