next up previous contents
Next: Node Array Data Accessor Up: Graphs and Iterators Previous: Observer Node Iterator (ObserverNodeIt)

   
STL Iterator Wrapper (STLNodeIt)

Definition

An instance it of class STLNodeIt<DataAccessor,Iter> is a STL iterator wrapper for node iterators (e.g. NodeIt, SafeNodeIt, FilterNodeIt<pred,NodeIt>). It adds all type tags and methods that are necessary for STL conformance; see the standard draft working paper for details. The type tag value_type is equal to typename DataAccessor::value_type and the return value of operator*. Class STLEdgeIt and STLAdjIt are defined analogously, i.e. can be used for edge iterators or adjacency iterators, respectively. Precondition: The template parameter Iter must be a node iterator. DataAccessor must be a data accessor.

Creation

STLNodeIt<DataAccessor,Iter> it(DataAccessor da, Iter base_it);
    introduces a variable it of this class bound to da and base_it.

   

Operations

STLNodeIt<DataAccessor,Iter>& it = typename DataAccessor::value_type i
    assigns the value i, i.e. set(DA,it,i) will be invoked where DA is the associated data accessor and it the associated iterator.

bool it == it2 returns true if the associated values of it and it2 are equal, i.e. get(DA,cit)==get(DA,cit2) is true where cit is the associated iterator of it and cit2 is the associated iterator of it2 and DA is the associated data accessor.

bool it != it2 returns false if the associated value equals the one of the given iterator.

STLNodeIt<DataAccessor,Iter>& it.begin() resets the iterator to the beginning of the sequence.

STLNodeIt<DataAccessor,Iter>& it.last() resets the iterator to the ending of the sequence.

STLNodeIt<DataAccessor,Iter>& it.end() makes the iterators invalid, i.e. past-the-end-value.

typename DataAccessor::value_type& *it returns a reference to the associated value, which originally comes from data accessor da. If the associated iterator it is not valid, a dummy value reference is returned and should not be used. Precondition: access(DA,it) returns a non constant reference to the data associated to it in DA. This functions is defined for all implemented data accessors (e.g. node_array_da, edge_array_da).


next up previous contents
Next: Node Array Data Accessor Up: Graphs and Iterators Previous: Observer Node Iterator (ObserverNodeIt)
LEDA research project
1998-10-02