DGtal  0.9.4beta
Public Types | Public Member Functions | Data Fields
DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor > Struct Template Reference

#include <DGtal/graph/GraphVisitorRange.h>

Collaboration diagram for DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >:
[legend]

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
 

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.
Examples:
tutorial-examples/AreaSurfaceEstimation-final.cpp.

Definition at line 117 of file GraphVisitorRange.h.

Member Typedef Documentation

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

Definition at line 120 of file GraphVisitorRange.h.

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.

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.

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

Definition at line 126 of file GraphVisitorRange.h.

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

Definition at line 127 of file GraphVisitorRange.h.

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

Definition at line 119 of file GraphVisitorRange.h.

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

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.
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 ) {}
CountedPtr< GraphVisitor > myVisitor
Smart pointer to a Visitor.
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 ) {}
CountedPtr< GraphVisitor > myVisitor
Smart pointer to a Visitor.

Member Function Documentation

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.

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

198  {
199  return ! ( this->operator==( other ) );
200  }
template<typename TGraphVisitor >
template<typename TAccessor >
reference DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::operator* ( ) const
inline

Definition at line 152 of file GraphVisitorRange.h.

References DGtal::CountedPtr< T >::get().

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  }
CountedPtr< GraphVisitor > myVisitor
Smart pointer to a Visitor.
T * get() const noexcept
Definition: CountedPtr.h:195
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  }
CountedPtr< GraphVisitor > myVisitor
Smart pointer to a Visitor.
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
CountedPtr< GraphVisitor > myVisitor
Smart pointer to a Visitor.
template<typename TGraphVisitor >
template<typename TAccessor >
pointer DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::operator-> ( ) const
inline

Definition at line 161 of file GraphVisitorRange.h.

References DGtal::CountedPtr< T >::get().

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  }
CountedPtr< GraphVisitor > myVisitor
Smart pointer to a Visitor.
T * get() const noexcept
Definition: CountedPtr.h:195
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.

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

144  {
145  if ( this != &other )
146  myVisitor = other.myVisitor;
147  return *this;
148  }
CountedPtr< GraphVisitor > myVisitor
Smart pointer to a Visitor.
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.

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

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

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  }
CountedPtr< GraphVisitor > myVisitor
Smart pointer to a Visitor.
T * get() const noexcept
Definition: CountedPtr.h:195

Field Documentation

template<typename TGraphVisitor >
template<typename TAccessor >
CountedPtr< GraphVisitor > DGtal::GraphVisitorRange< TGraphVisitor >::GenericConstIterator< TAccessor >::myVisitor

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