COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
11/25/04 15:48:24 (19 years ago)
Author:
Mihaly Barasz
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1411
Message:

Advances in UndirGraph?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/concept/graph_component.h

    r989 r1021  
    506506    /// InEdgeIt you should instantiate it with character 'i' and for
    507507    /// 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 {
    511513    public:
    512514      /// Default constructor.
     
    514516      /// @warning The default constructor sets the iterator
    515517      /// to an undefined value.
    516       GraphIncEdgeIterator() {}
     518      GraphIncIterator() {}
    517519      /// Copy constructor.
    518520     
    519521      /// Copy constructor.
    520522      ///
    521       GraphIncEdgeIterator(GraphIncEdgeIterator const&) {}
     523      GraphIncIterator(GraphIncIterator const&) {}
    522524      /// Sets the iterator to the first edge incoming into or outgoing from the node.
    523525     
    524526      /// Sets the iterator to the first edge incoming into or outgoing from the node.
    525527      ///
    526       explicit GraphIncEdgeIterator(const _Graph&, const typename _Graph::Node&) {}
     528      explicit GraphIncIterator(const Graph&, const typename Graph::Node&) {}
    527529      /// Invalid constructor \& conversion.
    528530
    529531      /// This constructor initializes the item to be invalid.
    530532      /// \sa Invalid for more details.
    531       GraphIncEdgeIterator(Invalid) {}
     533      GraphIncIterator(Invalid) {}
    532534      /// Assign operator for nodes.
    533535
    534536      /// The nodes are assignable.
    535537      ///
    536       GraphIncEdgeIterator& operator=(GraphIncEdgeIterator const&) { return *this; }     
     538      GraphIncIterator& operator=(GraphIncIterator const&) { return *this; }     
    537539      /// Next edge.
    538540
    539541      /// Assign the iterator to the next node.
    540542      ///
    541       GraphIncEdgeIterator& operator++() { return *this; }
     543      GraphIncIterator& operator++() { return *this; }
     544
    542545      //        Node operator*() const { return INVALID; }
     546
    543547      /// Equality operator
    544548
    545549      /// Two iterators are equal if and only if they point to the
    546550      /// same object or both are invalid.
    547       bool operator==(const GraphIncEdgeIterator&) const { return true;}
     551      bool operator==(const GraphIncIterator&) const { return true;}
     552
    548553      /// Inequality operator
    549554       
    550555      /// \sa operator==(Node n)
    551556      ///
    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);
    561565          /// \todo Do we need OutEdgeIt(Edge) kind of constructor?
    562           //    _GraphIncEdgeIterator it2(edge);
    563           _GraphIncEdgeIterator it2;
     566          //    _GraphIncIterator it2(edge);
     567          _GraphIncIterator it2;
    564568
    565569          it2 = ++it1;
     
    572576        Edge& edge;
    573577        Node& node;
    574         _Graph& graph;
    575       };
    576     };
     578        Graph& graph;
     579      };
     580    };
     581
     582
    577583    /// An empty iterable base graph class.
    578584 
     
    603609      /// This iterator goes trough the \e inccoming edges of a certain node
    604610      /// of a graph.
    605       typedef GraphIncEdgeIterator<Graph, 'i'> InEdgeIt;
     611      typedef GraphIncIterator<Graph, Edge, 'i'> InEdgeIt;
    606612      /// This iterator goes trough the outgoing edges of a node.
    607613
    608614      /// This iterator goes trough the \e outgoing edges of a certain node
    609615      /// of a graph.
    610       typedef GraphIncEdgeIterator<Graph, 'o'> OutEdgeIt;
     616      typedef GraphIncIterator<Graph, Edge, 'o'> OutEdgeIt;
    611617    };
    612618   
     
    618624        checkConcept<GraphIterator<_Graph, typename _Graph::Edge>, typename _Graph::EdgeIt >();
    619625        checkConcept<GraphIterator<_Graph, typename _Graph::Node>, typename _Graph::NodeIt >();
    620         checkConcept<GraphIncEdgeIterator<_Graph, 'i'>, typename _Graph::InEdgeIt >();
    621         checkConcept<GraphIncEdgeIterator<_Graph, 'o'>, typename _Graph::OutEdgeIt >();
     626        checkConcept<GraphIncIterator<_Graph>, typename _Graph::InEdgeIt >();
     627        checkConcept<GraphIncIterator<_Graph>, typename _Graph::OutEdgeIt >();
    622628      }
    623629    };
Note: See TracChangeset for help on using the changeset viewer.