DGtal  0.9.3beta
Data Structures | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
DGtal::GraphVisitorRange< TGraphVisitor > Class Template Reference

#include <DGtal/graph/GraphVisitorRange.h>

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

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
 

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
...
}
Todo:
Complete boost::range_iterator<> accordingly.
Examples:
graph/graphTraversal.cpp, and tutorial-examples/AreaSurfaceEstimation-final.cpp.

Definition at line 71 of file GraphVisitorRange.h.

Member Typedef Documentation

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

Definition at line 211 of file GraphVisitorRange.h.

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

Definition at line 210 of file GraphVisitorRange.h.

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

Definition at line 79 of file GraphVisitorRange.h.

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

Definition at line 75 of file GraphVisitorRange.h.

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

Definition at line 74 of file GraphVisitorRange.h.

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

Definition at line 77 of file GraphVisitorRange.h.

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.

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

Definition at line 78 of file GraphVisitorRange.h.

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

Definition at line 76 of file GraphVisitorRange.h.

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

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

Destructor.

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).
template<typename TGraphVisitor >
DGtal::GraphVisitorRange< TGraphVisitor >::GraphVisitorRange ( )
protected

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

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

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.

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

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

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: