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::EdgeListIterator Class Reference

Custom Edge list (non-const) iterator class, which can return non-const Edge 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< Edge * > and a list< Edge const * >. More...

#include <Graph.hh>

Public Member Functions

 EdgeListIterator ()
 default constructor, owner and element set to null More...
 
 EdgeListIterator (EdgeList const *owner)
 owner constructor More...
 
 EdgeListIterator (EdgeList const *owner, EdgeListElement *element)
 owner and element constructor: points at a position in a list More...
 
 EdgeListIterator (EdgeListIterator const &src)=default
 copy constructor More...
 
 ~EdgeListIterator ()=default
 non-virtual destructor, does nothing More...
 
EdgeListIteratoroperator= (EdgeListIterator const &rhs)=default
 assignmnet operator More...
 
EdgeListIterator const & operator++ ()
 increment operator. Point this iterator at the next element in the list. More...
 
EdgeListIterator const & operator-- ()
 decrement operator. Point this iterator at the previous element in the list. More...
 
bool operator== (EdgeListIterator 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!= (EdgeListIterator 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...
 
Edgeoperator* () 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...
 
Edgeoperator-> () 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

EdgeList const * owner_
 
EdgeListElementelement_
 

Friends

class EdgeList
 
class EdgeListConstIterator
 

Detailed Description

Custom Edge list (non-const) iterator class, which can return non-const Edge 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< Edge * > and a list< Edge const * >.

Constructor & Destructor Documentation

utility::graph::EdgeListIterator::EdgeListIterator ( )
inline

default constructor, owner and element set to null

utility::graph::EdgeListIterator::EdgeListIterator ( EdgeList const *  owner)
inline

owner constructor

utility::graph::EdgeListIterator::EdgeListIterator ( EdgeList const *  owner,
EdgeListElement element 
)
inline

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

utility::graph::EdgeListIterator::EdgeListIterator ( EdgeListIterator const &  src)
default

copy constructor

utility::graph::EdgeListIterator::~EdgeListIterator ( )
default

non-virtual destructor, does nothing

Member Function Documentation

bool utility::graph::EdgeListIterator::operator!= ( EdgeListIterator 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==().

Edge* utility::graph::EdgeListIterator::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::EdgeListElement::edge(), element_, and valid().

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

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

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

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

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

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

Edge& utility::graph::EdgeListIterator::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::EdgeListElement::edge(), element_, and valid().

EdgeListIterator& utility::graph::EdgeListIterator::operator= ( EdgeListIterator const &  rhs)
default

assignmnet operator

bool utility::graph::EdgeListIterator::operator== ( EdgeListIterator 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::EdgeListIterator::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::EdgeList::is_end_element(), and owner_.

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

Friends And Related Function Documentation

friend class EdgeList
friend
friend class EdgeListConstIterator
friend

Member Data Documentation

EdgeListElement* utility::graph::EdgeListIterator::element_
private
EdgeList const* utility::graph::EdgeListIterator::owner_
private

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