DGtal  1.5.beta
DGtal::GraphVisitorRange< TGraphVisitor > Class Template Reference

Aim: Transforms a graph visitor into a single pass input range. More...

#include <DGtal/graph/GraphVisitorRange.h>

Data Structures

struct  GenericConstIterator
 
struct  NodeAccessor
 
struct  VertexAccessor
 

Public Types

typedef TGraphVisitor GraphVisitor
 
typedef GraphVisitor::Graph Graph
 
typedef GraphVisitor::Vertex Vertex
 
typedef GraphVisitor::Node Node
 
typedef GraphVisitor::Size Size
 
typedef GraphVisitor::Data Data
 
typedef GenericConstIterator< VertexAccessorVertexConstIterator
 
typedef GenericConstIterator< NodeAccessorNodeConstIterator
 
typedef VertexConstIterator ConstIterator
 
typedef ConstIterator const_iterator
 

Public Member Functions

 ~GraphVisitorRange ()
 
 GraphVisitorRange (GraphVisitor *visitorPtr)
 
ConstIterator begin () const
 
ConstIterator end () const
 
NodeConstIterator beginNode () const
 
NodeConstIterator endNode () const
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 

Protected Member Functions

 GraphVisitorRange ()
 

Private Member Functions

 GraphVisitorRange (const GraphVisitorRange &other)
 
GraphVisitorRangeoperator= (const GraphVisitorRange &other)
 

Private Attributes

CountedPtr< GraphVisitormyVisitor
 A smart pointer on a graph visitor. More...
 

Detailed Description

template<typename TGraphVisitor>
class DGtal::GraphVisitorRange< TGraphVisitor >

Aim: Transforms a graph visitor into a single pass input range.

Description of template class 'GraphVisitorRange'

typedef DepthFirstVisitor<Graph, std::set<Vertex> > DFSVisitor;
typedef GraphVisitorRange<DFSVisitor> VisitorRange;
VisitorRange range( new DFSVisitor( g, Point( -2, -1 ) ) );
for ( VisitorRange::ConstIterator it = range.begin(), itEnd = range.end();
it != itEnd; ++it )
{ // Vertex is *it
...
}
MyDigitalSurface::ConstIterator ConstIterator
MyPointD Point
Definition: testClone2.cpp:383
Todo:
Complete boost::range_iterator<> accordingly.

Definition at line 71 of file GraphVisitorRange.h.

Member Typedef Documentation

◆ const_iterator

template<typename TGraphVisitor >
typedef ConstIterator DGtal::GraphVisitorRange< TGraphVisitor >::const_iterator

Definition at line 211 of file GraphVisitorRange.h.

◆ ConstIterator

template<typename TGraphVisitor >
typedef VertexConstIterator DGtal::GraphVisitorRange< TGraphVisitor >::ConstIterator

◆ Data

template<typename TGraphVisitor >
typedef GraphVisitor::Data DGtal::GraphVisitorRange< TGraphVisitor >::Data

Definition at line 79 of file GraphVisitorRange.h.

◆ Graph

template<typename TGraphVisitor >
typedef GraphVisitor::Graph DGtal::GraphVisitorRange< TGraphVisitor >::Graph

Definition at line 75 of file GraphVisitorRange.h.

◆ GraphVisitor

template<typename TGraphVisitor >
typedef TGraphVisitor DGtal::GraphVisitorRange< TGraphVisitor >::GraphVisitor

Definition at line 74 of file GraphVisitorRange.h.

◆ Node

template<typename TGraphVisitor >
typedef GraphVisitor::Node DGtal::GraphVisitorRange< TGraphVisitor >::Node

Definition at line 77 of file GraphVisitorRange.h.

◆ NodeConstIterator

template<typename TGraphVisitor >
typedef GenericConstIterator<NodeAccessor> DGtal::GraphVisitorRange< TGraphVisitor >::NodeConstIterator

const iterator on pair (Vertex,distance) for visiting a graph by following a breadth first traversal.

Definition at line 208 of file GraphVisitorRange.h.

◆ Size

template<typename TGraphVisitor >
typedef GraphVisitor::Size DGtal::GraphVisitorRange< TGraphVisitor >::Size

Definition at line 78 of file GraphVisitorRange.h.

◆ Vertex

template<typename TGraphVisitor >
typedef GraphVisitor::Vertex DGtal::GraphVisitorRange< TGraphVisitor >::Vertex

Definition at line 76 of file GraphVisitorRange.h.

◆ VertexConstIterator

template<typename TGraphVisitor >
typedef GenericConstIterator<VertexAccessor> DGtal::GraphVisitorRange< TGraphVisitor >::VertexConstIterator

const iterator on Vertex for visiting a graph by following a breadth first traversal.

Definition at line 205 of file GraphVisitorRange.h.

Constructor & Destructor Documentation

◆ ~GraphVisitorRange()

template<typename TGraphVisitor >
DGtal::GraphVisitorRange< TGraphVisitor >::~GraphVisitorRange ( )

Destructor.

◆ GraphVisitorRange() [1/3]

template<typename TGraphVisitor >
DGtal::GraphVisitorRange< TGraphVisitor >::GraphVisitorRange ( GraphVisitor visitorPtr)

Constructor from dynamically allocated visitor. The visitor is acquired by this object.

Parameters
visitorPtra pointer to a dynamically allocated visitor, which is acquired by this object. This visitor defines the starting point for the traversal. It must be valid (!= 0).

◆ GraphVisitorRange() [2/3]

template<typename TGraphVisitor >
DGtal::GraphVisitorRange< TGraphVisitor >::GraphVisitorRange ( )
protected

Constructor. Forbidden by default (protected to avoid g++ warnings).

◆ GraphVisitorRange() [3/3]

template<typename TGraphVisitor >
DGtal::GraphVisitorRange< TGraphVisitor >::GraphVisitorRange ( const GraphVisitorRange< TGraphVisitor > &  other)
private

Copy constructor.

Parameters
otherthe object to clone. Forbidden by default.

Member Function Documentation

◆ begin()

template<typename TGraphVisitor >
ConstIterator DGtal::GraphVisitorRange< TGraphVisitor >::begin ( ) const

The value of the iterator has type Vertex.

Returns
a single pass input iterator pointing on the first element of the graph traversal induced by the given visitor.

NB: if you have already called begin() or beginNode(), it will raise an assertion.

◆ beginNode()

template<typename TGraphVisitor >
NodeConstIterator DGtal::GraphVisitorRange< TGraphVisitor >::beginNode ( ) const

The value of the iterator has type Node, i.e. std::pair<Vertex,Data>.

Returns
a single pass input iterator pointing on the first element of the graph traversal induced by the given visitor.

NB: if you have already called begin() or beginNode(), it will raise an assertion.

◆ end()

template<typename TGraphVisitor >
ConstIterator DGtal::GraphVisitorRange< TGraphVisitor >::end ( ) const

The value of the iterator has type Vertex.

Returns
a single pass input iterator pointing after the last element of the graph traversal induced by the given visitor.

◆ endNode()

template<typename TGraphVisitor >
NodeConstIterator DGtal::GraphVisitorRange< TGraphVisitor >::endNode ( ) const

The value of the iterator has type Node, i.e. std::pair<Vertex,Data>.

Returns
a single pass input iterator pointing after the last element of the graph traversal induced by the given visitor.

◆ isValid()

template<typename TGraphVisitor >
bool DGtal::GraphVisitorRange< TGraphVisitor >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.

◆ operator=()

template<typename TGraphVisitor >
GraphVisitorRange& DGtal::GraphVisitorRange< TGraphVisitor >::operator= ( const GraphVisitorRange< TGraphVisitor > &  other)
private

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'. Forbidden by default.

◆ selfDisplay()

template<typename TGraphVisitor >
void DGtal::GraphVisitorRange< TGraphVisitor >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

Field Documentation

◆ myVisitor

template<typename TGraphVisitor >
CountedPtr<GraphVisitor> DGtal::GraphVisitorRange< TGraphVisitor >::myVisitor
private

A smart pointer on a graph visitor.

Definition at line 280 of file GraphVisitorRange.h.


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