Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | Friends | List of all members
utility::graph::DirectedEdgeListIterator Class Reference

Custom DirectedEdge list (non-const) iterator class, which can return non-const DirectedEdge pointers. This iterator cannot be used to change the structure of its list without access to that list directly. Customized since STL's const-iterator cannot be prevented from giving non-const access to its data. The former workaround to this problem was to define two sets of edge lists on each vertex: a list< DirectedEdge * > and a list< DirectedEdge const * >. More...

#include <Digraph.hh>

Public Member Functions

 DirectedEdgeListIterator ()
 default constructor, owner and element set to null More...
 
 DirectedEdgeListIterator (DirectedEdgeList const *owner)
 owner constructor More...
 
 DirectedEdgeListIterator (DirectedEdgeList const *owner, DirectedEdgeListElement *element)
 owner and element constructor: points at a position in a list More...
 
 DirectedEdgeListIterator (DirectedEdgeListIterator const &src)
 copy constructor More...
 
 ~DirectedEdgeListIterator ()
 non-virtual destructor, does nothing More...
 
DirectedEdgeListIteratoroperator= (DirectedEdgeListIterator const &rhs)
 assignmnet operator More...
 
DirectedEdgeListIterator const & operator++ ()
 increment operator. Point this iterator at the next element in the list. More...
 
DirectedEdgeListIterator const & operator-- ()
 decrement operator. Point this iterator at the previous element in the list. More...
 
bool operator== (DirectedEdgeListIterator const &rhs) const
 equality operator. Do these elements point at the same list element? Asserts that they belong to the same list. Never compare elements from separate lists. More...
 
bool operator!= (DirectedEdgeListIterator const &rhs) const
 inequality operator. Do these elements point to different elements from the same list? Asserts that they belong to the same list. Never compare elements from separate lists. More...
 
DirectedEdgeoperator* () const
 dereference operator: return the edge pointer pointed to by the list element this iterator is hovering over. This method returns a non-const edge pointer, which defines this class as a non-const iterator. There are no methods, though, to access the list element itself. More...
 
DirectedEdgeoperator-> () const
 dereference operator: return the edge pointer pointed to by the list element this iterator is hovering over. This method returns a non-const edge pointer, which defines this class as a non-const iterator. There are no methods, though, to access the list element itself. More...
 
bool valid () const
 check that this iterator is valid. Will not guarantee that the iterator points at an element that has not been destroyed. More...
 

Private Attributes

DirectedEdgeList const * owner_
 
DirectedEdgeListElementelement_
 

Friends

class DirectedEdgeList
 
class DirectedEdgeListConstIterator
 

Detailed Description

Custom DirectedEdge list (non-const) iterator class, which can return non-const DirectedEdge pointers. This iterator cannot be used to change the structure of its list without access to that list directly. Customized since STL's const-iterator cannot be prevented from giving non-const access to its data. The former workaround to this problem was to define two sets of edge lists on each vertex: a list< DirectedEdge * > and a list< DirectedEdge const * >.

Constructor & Destructor Documentation

utility::graph::DirectedEdgeListIterator::DirectedEdgeListIterator ( )
inline

default constructor, owner and element set to null

utility::graph::DirectedEdgeListIterator::DirectedEdgeListIterator ( DirectedEdgeList const *  owner)
inline

owner constructor

utility::graph::DirectedEdgeListIterator::DirectedEdgeListIterator ( DirectedEdgeList const *  owner,
DirectedEdgeListElement element 
)
inline

owner and element constructor: points at a position in a list

utility::graph::DirectedEdgeListIterator::DirectedEdgeListIterator ( DirectedEdgeListIterator const &  src)
inline

copy constructor

utility::graph::DirectedEdgeListIterator::~DirectedEdgeListIterator ( )
inline

non-virtual destructor, does nothing

Member Function Documentation

bool utility::graph::DirectedEdgeListIterator::operator!= ( DirectedEdgeListIterator const &  rhs) const
inline

inequality operator. Do these elements point to different elements from the same list? Asserts that they belong to the same list. Never compare elements from separate lists.

References operator==().

DirectedEdge* utility::graph::DirectedEdgeListIterator::operator* ( ) const
inline

dereference operator: return the edge pointer pointed to by the list element this iterator is hovering over. This method returns a non-const edge pointer, which defines this class as a non-const iterator. There are no methods, though, to access the list element itself.

References debug_assert, utility::graph::DirectedEdgeListElement::edge(), element_, and valid().

DirectedEdgeListIterator const& utility::graph::DirectedEdgeListIterator::operator++ ( )
inline

increment operator. Point this iterator at the next element in the list.

References debug_assert, element_, utility::graph::DirectedEdgeListElement::next(), and valid().

DirectedEdgeListIterator const& utility::graph::DirectedEdgeListIterator::operator-- ( )
inline

decrement operator. Point this iterator at the previous element in the list.

References debug_assert, element_, utility::graph::DirectedEdgeListElement::previous(), and valid().

DirectedEdge& utility::graph::DirectedEdgeListIterator::operator-> ( ) const
inline

dereference operator: return the edge pointer pointed to by the list element this iterator is hovering over. This method returns a non-const edge pointer, which defines this class as a non-const iterator. There are no methods, though, to access the list element itself.

References debug_assert, utility::graph::DirectedEdgeListElement::edge(), element_, and valid().

DirectedEdgeListIterator& utility::graph::DirectedEdgeListIterator::operator= ( DirectedEdgeListIterator const &  rhs)
inline

assignmnet operator

References element_, and owner_.

bool utility::graph::DirectedEdgeListIterator::operator== ( DirectedEdgeListIterator const &  rhs) const
inline

equality operator. Do these elements point at the same list element? Asserts that they belong to the same list. Never compare elements from separate lists.

References debug_assert, element_, and owner_.

Referenced by operator!=().

bool utility::graph::DirectedEdgeListIterator::valid ( ) const
inline

check that this iterator is valid. Will not guarantee that the iterator points at an element that has not been destroyed.

References element_, utility::graph::DirectedEdgeList::is_end_element(), and owner_.

Referenced by operator*(), operator++(), operator--(), and operator->().

Friends And Related Function Documentation

friend class DirectedEdgeList
friend
friend class DirectedEdgeListConstIterator
friend

Member Data Documentation

DirectedEdgeListElement* utility::graph::DirectedEdgeListIterator::element_
private
DirectedEdgeList const* utility::graph::DirectedEdgeListIterator::owner_
private

The documentation for this class was generated from the following file: