DGtal  1.5.beta
DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor > Struct Template Reference

#include <DGtal/graph/GraphVisitorRange.h>

Public Types

typedef GenericConstIterator< TAccessor > Self
 
typedef TAccessor Accessor
 
typedef std::input_iterator_tag iterator_category
 
typedef Accessor::value value_type
 
typedef std::ptrdiff_t difference_type
 
typedef Accessor::pointer pointer
 
typedef Accessor::reference reference
 

Public Member Functions

 GenericConstIterator ()
 
 GenericConstIterator (CountedPtr< GraphVisitor > ptrV)
 
 GenericConstIterator (const Self &other)
 
Selfoperator= (const Self &other)
 
reference operator* () const
 
pointer operator-> () const
 
Selfoperator++ ()
 
Self operator++ (int)
 
bool operator== (const Self &other) const
 
bool operator!= (const Self &other) const
 

Data Fields

CountedPtr< GraphVisitormyVisitor
 Smart pointer to a Visitor. More...
 

Detailed Description

template<typename TGraphVisitor>
template<typename TAccessor>
struct DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >

A single-pass input iterator that adapts a visitor to explore vertices. The default iterator is equivalent to an end().

Template Parameters
TAccessortype of accessor for the iterator, either NodeAccessor or VertexAccessor.
Todo:
Complete boost::iterator_traversal<> accordingly.

Definition at line 117 of file GraphVisitorRange.h.

Member Typedef Documentation

◆ Accessor

template<typename TGraphVisitor >
template<typename TAccessor >
typedef TAccessor DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::Accessor

Definition at line 120 of file GraphVisitorRange.h.

◆ difference_type

template<typename TGraphVisitor >
template<typename TAccessor >
typedef std::ptrdiff_t DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::difference_type

Definition at line 125 of file GraphVisitorRange.h.

◆ iterator_category

template<typename TGraphVisitor >
template<typename TAccessor >
typedef std::input_iterator_tag DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::iterator_category

Definition at line 123 of file GraphVisitorRange.h.

◆ pointer

template<typename TGraphVisitor >
template<typename TAccessor >
typedef Accessor::pointer DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::pointer

Definition at line 126 of file GraphVisitorRange.h.

◆ reference

template<typename TGraphVisitor >
template<typename TAccessor >
typedef Accessor::reference DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::reference

Definition at line 127 of file GraphVisitorRange.h.

◆ Self

template<typename TGraphVisitor >
template<typename TAccessor >
typedef GenericConstIterator<TAccessor> DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::Self

Definition at line 119 of file GraphVisitorRange.h.

◆ value_type

template<typename TGraphVisitor >
template<typename TAccessor >
typedef Accessor::value DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::value_type

Definition at line 124 of file GraphVisitorRange.h.

Constructor & Destructor Documentation

◆ GenericConstIterator() [1/3]

template<typename TGraphVisitor >
template<typename TAccessor >
DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::GenericConstIterator ( )
inline

Definition at line 133 of file GraphVisitorRange.h.

134  : myVisitor( 0 ) {}
CountedPtr< GraphVisitor > myVisitor
Smart pointer to a Visitor.

◆ GenericConstIterator() [2/3]

template<typename TGraphVisitor >
template<typename TAccessor >
DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::GenericConstIterator ( CountedPtr< GraphVisitor ptrV)
inline

Definition at line 136 of file GraphVisitorRange.h.

137  : myVisitor( ptrV ) {}

◆ GenericConstIterator() [3/3]

template<typename TGraphVisitor >
template<typename TAccessor >
DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::GenericConstIterator ( const Self other)
inline

Definition at line 139 of file GraphVisitorRange.h.

140  : myVisitor( other.myVisitor ) {}

Member Function Documentation

◆ operator!=()

template<typename TGraphVisitor >
template<typename TAccessor >
bool DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::operator!= ( const Self other) const
inline

Definition at line 197 of file GraphVisitorRange.h.

198  {
199  return ! ( this->operator==( other ) );
200  }

References DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::operator==().

◆ operator*()

template<typename TGraphVisitor >
template<typename TAccessor >
reference DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::operator* ( ) const
inline

Definition at line 152 of file GraphVisitorRange.h.

153  {
154  ASSERT( ( myVisitor.get() != 0 )
155  && "DGtal::GraphVisitorRange<>::GenericConstIterator<>::operator*(): you cannot dereferenced a null visitor (i.e. end()).");
156  return Accessor::get( myVisitor->current() );
157  }
T * get() const noexcept
Definition: CountedPtr.h:195

References DGtal::CountedPtr< T >::get(), and DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::myVisitor.

◆ operator++() [1/2]

template<typename TGraphVisitor >
template<typename TAccessor >
Self& DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::operator++ ( )
inline

Definition at line 170 of file GraphVisitorRange.h.

171  {
172  myVisitor->expand();
173  return *this;
174  }

References DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::myVisitor.

◆ operator++() [2/2]

template<typename TGraphVisitor >
template<typename TAccessor >
Self DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::operator++ ( int  )
inline

Definition at line 178 of file GraphVisitorRange.h.

179  {
180  Self __tmp = *this;
181  myVisitor->expand();
182  return __tmp;
183  }
GenericConstIterator< TAccessor > Self

References DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::myVisitor.

◆ operator->()

template<typename TGraphVisitor >
template<typename TAccessor >
pointer DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::operator-> ( ) const
inline

Definition at line 161 of file GraphVisitorRange.h.

162  {
163  ASSERT( ( myVisitor.get() != 0 )
164  && "DGtal::GraphVisitorRange<>::GenericConstIterator<>::operator->(): you cannot dereferenced a null visitor (i.e. end()).");
165  return & Accessor::get( operator*() );
166  }

References DGtal::CountedPtr< T >::get(), and DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::myVisitor.

◆ operator=()

template<typename TGraphVisitor >
template<typename TAccessor >
Self& DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::operator= ( const Self other)
inline

Definition at line 143 of file GraphVisitorRange.h.

144  {
145  if ( this != &other )
146  myVisitor = other.myVisitor;
147  return *this;
148  }

References DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::myVisitor.

◆ operator==()

template<typename TGraphVisitor >
template<typename TAccessor >
bool DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::operator== ( const Self other) const
inline

Definition at line 186 of file GraphVisitorRange.h.

187  {
188  if ( ( myVisitor.get() == 0 ) || myVisitor->finished() )
189  return ( other.myVisitor.get() == 0 ) || other.myVisitor->finished();
190  else if ( other.myVisitor.get() == 0 )
191  return false;
192  else
193  return &(myVisitor->current()) == &(other.myVisitor->current());
194  }

References DGtal::CountedPtr< T >::get(), and DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::myVisitor.

Referenced by DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::operator!=().

Field Documentation

◆ myVisitor


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