Changeset 1021:fd1d073b6557 in lemon0.x for src/lemon/concept/graph_component.h
 Timestamp:
 11/25/04 15:48:24 (20 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1411
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/lemon/concept/graph_component.h
r989 r1021 506 506 /// InEdgeIt you should instantiate it with character 'i' and for 507 507 /// OutEdgeIt with 'o'. 508 /// \todo check the name of the concept GraphIncEdgeIterator 509 template <typename _Graph, char _selector> 510 class GraphIncEdgeIterator : public _Graph::Edge { 508 /// \todo Is this a good name for this concept? 509 template <typename Graph, 510 typename Edge = typename Graph::Edge, 511 char _selector = '0'> 512 class GraphIncIterator : public Edge { 511 513 public: 512 514 /// Default constructor. … … 514 516 /// @warning The default constructor sets the iterator 515 517 /// to an undefined value. 516 GraphInc EdgeIterator() {}518 GraphIncIterator() {} 517 519 /// Copy constructor. 518 520 519 521 /// Copy constructor. 520 522 /// 521 GraphInc EdgeIterator(GraphIncEdgeIterator const&) {}523 GraphIncIterator(GraphIncIterator const&) {} 522 524 /// Sets the iterator to the first edge incoming into or outgoing from the node. 523 525 524 526 /// Sets the iterator to the first edge incoming into or outgoing from the node. 525 527 /// 526 explicit GraphInc EdgeIterator(const _Graph&, const typename _Graph::Node&) {}528 explicit GraphIncIterator(const Graph&, const typename Graph::Node&) {} 527 529 /// Invalid constructor \& conversion. 528 530 529 531 /// This constructor initializes the item to be invalid. 530 532 /// \sa Invalid for more details. 531 GraphInc EdgeIterator(Invalid) {}533 GraphIncIterator(Invalid) {} 532 534 /// Assign operator for nodes. 533 535 534 536 /// The nodes are assignable. 535 537 /// 536 GraphInc EdgeIterator& operator=(GraphIncEdgeIterator const&) { return *this; }538 GraphIncIterator& operator=(GraphIncIterator const&) { return *this; } 537 539 /// Next edge. 538 540 539 541 /// Assign the iterator to the next node. 540 542 /// 541 GraphIncEdgeIterator& operator++() { return *this; } 543 GraphIncIterator& operator++() { return *this; } 544 542 545 // Node operator*() const { return INVALID; } 546 543 547 /// Equality operator 544 548 545 549 /// Two iterators are equal if and only if they point to the 546 550 /// same object or both are invalid. 547 bool operator==(const GraphIncEdgeIterator&) const { return true;} 551 bool operator==(const GraphIncIterator&) const { return true;} 552 548 553 /// Inequality operator 549 554 550 555 /// \sa operator==(Node n) 551 556 /// 552 bool operator!=(const GraphIncEdgeIterator&) const { return true;} 553 554 template <typename _GraphIncEdgeIterator> 555 struct Constraints { 556 typedef typename _Graph::Node Node; 557 typedef typename _Graph::Edge Edge; 558 void constraints() { 559 checkConcept<GraphItem<'e'>, _GraphIncEdgeIterator>(); 560 _GraphIncEdgeIterator it1(graph, node); 557 bool operator!=(const GraphIncIterator&) const { return true;} 558 559 template <typename _GraphIncIterator> 560 struct Constraints { 561 typedef typename Graph::Node Node; 562 void constraints() { 563 checkConcept<GraphItem<'e'>, _GraphIncIterator>(); 564 _GraphIncIterator it1(graph, node); 561 565 /// \todo Do we need OutEdgeIt(Edge) kind of constructor? 562 // _GraphInc EdgeIterator it2(edge);563 _GraphInc EdgeIterator it2;566 // _GraphIncIterator it2(edge); 567 _GraphIncIterator it2; 564 568 565 569 it2 = ++it1; … … 572 576 Edge& edge; 573 577 Node& node; 574 _Graph& graph; 575 }; 576 }; 578 Graph& graph; 579 }; 580 }; 581 582 577 583 /// An empty iterable base graph class. 578 584 … … 603 609 /// This iterator goes trough the \e inccoming edges of a certain node 604 610 /// of a graph. 605 typedef GraphInc EdgeIterator<Graph, 'i'> InEdgeIt;611 typedef GraphIncIterator<Graph, Edge, 'i'> InEdgeIt; 606 612 /// This iterator goes trough the outgoing edges of a node. 607 613 608 614 /// This iterator goes trough the \e outgoing edges of a certain node 609 615 /// of a graph. 610 typedef GraphInc EdgeIterator<Graph, 'o'> OutEdgeIt;616 typedef GraphIncIterator<Graph, Edge, 'o'> OutEdgeIt; 611 617 }; 612 618 … … 618 624 checkConcept<GraphIterator<_Graph, typename _Graph::Edge>, typename _Graph::EdgeIt >(); 619 625 checkConcept<GraphIterator<_Graph, typename _Graph::Node>, typename _Graph::NodeIt >(); 620 checkConcept<GraphInc EdgeIterator<_Graph, 'i'>, typename _Graph::InEdgeIt >();621 checkConcept<GraphInc EdgeIterator<_Graph, 'o'>, typename _Graph::OutEdgeIt >();626 checkConcept<GraphIncIterator<_Graph>, typename _Graph::InEdgeIt >(); 627 checkConcept<GraphIncIterator<_Graph>, typename _Graph::OutEdgeIt >(); 622 628 } 623 629 };
Note: See TracChangeset
for help on using the changeset viewer.