Public Member Functions | Private Attributes | Friends

DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator Class Reference

#include <GreedyDecomposition.h>

Public Member Functions

 ConstIterator ()
 ConstIterator (const Contour &aContour, unsigned int n)
 ConstIterator (const ConstIterator &aOther)
ConstIteratoroperator= (const ConstIterator &aOther)
 ~ConstIterator ()
Primitive operator* () const
Primitive get () const
ConstIteratoroperator++ ()
void next ()
ConstIteratoroperator-- ()
void previous ()
unsigned int getPosition () const
const Contour * getContour () const
const Contour::ConstIterator getFront () const
const Contour::ConstIterator getBack () const
bool operator== (const ConstIterator &aOther) const
bool operator!= (const ConstIterator &aOther) const
bool operator< (const ConstIterator &aOther) const

Private Attributes

const Contour * myC
Contour::ConstIterator myFront
Contour::ConstIterator myBack
unsigned int myPosition
Primitive myP

Friends

class GreedyDecomposition< Contour, Primitive >

Detailed Description

template<typename Contour, typename Primitive>
class DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator

This class is an iterator on the contour, storing the current primitive.

Examples:

DSS.cpp.


Constructor & Destructor Documentation

template<typename Contour, typename Primitive>
DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::ConstIterator (  ) 

Default Constructor. The object is not valid.

template<typename Contour, typename Primitive>
DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::ConstIterator ( const Contour &  aContour,
unsigned int  n 
)

Constructor. Nb: complexity in O(n).

Parameters:
aContour a contour
n,the position in the sequence of primitives (Set at aContour.size() for the end iterator).
template<typename Contour, typename Primitive>
DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::ConstIterator ( const ConstIterator aOther  ) 

Copy constructor.

Parameters:
other the iterator to clone.
template<typename Contour, typename Primitive>
DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::~ConstIterator (  ) 

Destructor. Does nothing.


Member Function Documentation

template<typename Contour, typename Primitive>
Primitive DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::get (  )  const
Returns:
the current primitive.
template<typename Contour, typename Primitive>
const Contour::ConstIterator DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::getBack (  )  const
Returns:
an iterator of the contour at the back of the primitive.
template<typename Contour, typename Primitive>
const Contour* DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::getContour (  )  const
Returns:
the associated Contour.
template<typename Contour, typename Primitive>
const Contour::ConstIterator DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::getFront (  )  const
Returns:
an iterator of the contour at the front of the primitive.
template<typename Contour, typename Primitive>
unsigned int DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::getPosition (  )  const
Returns:
the current position (as an index in the sequence of primitives).

Referenced by main().

template<typename Contour, typename Primitive>
void DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::next (  ) 

Goes to the next primitive on the contour (if possible). Nb: complexity in O(n).

template<typename Contour, typename Primitive>
bool DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::operator!= ( const ConstIterator aOther  )  const

Inequality operator.

Parameters:
aOther the iterator to compare with (must be defined on the same contour).
Returns:
'true' if their current positions differs.
template<typename Contour, typename Primitive>
Primitive DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::operator* (  )  const
Returns:
the current primitive
template<typename Contour, typename Primitive>
ConstIterator& DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::operator++ (  ) 

Pre-increment. Goes to the next primitive on the contour (if possible). Nb: complexity in O(n).

template<typename Contour, typename Primitive>
ConstIterator& DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::operator-- (  ) 

Pre-decrement. Goes to the previous primitive on the chain (if possible). Nb: complexity in O(n).

template<typename Contour, typename Primitive>
bool DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::operator< ( const ConstIterator aOther  )  const

Inferior operator.

Parameters:
aOther the iterator to compare with (must be defined on the same contour).
Returns:
'true' if the current position of 'this' is before the current position of [other].
template<typename Contour, typename Primitive>
ConstIterator& DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::operator= ( const ConstIterator aOther  ) 

Assignment.

Parameters:
aOther the iterator to copy.
Returns:
a reference on 'this'.
template<typename Contour, typename Primitive>
bool DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::operator== ( const ConstIterator aOther  )  const

Equality operator.

Parameters:
aOther the iterator to compare with (must be defined on the same contour).
Returns:
'true' if their current positions coincide.
template<typename Contour, typename Primitive>
void DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::previous (  ) 

Goes to the previous primitive on the chain (if possible). Nb: complexity in O(n).


Friends And Related Function Documentation

template<typename Contour, typename Primitive>
friend class GreedyDecomposition< Contour, Primitive > [friend]

Field Documentation

template<typename Contour, typename Primitive>
Contour::ConstIterator DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::myBack [private]

An iterator of the contour at the back of the current primitive

template<typename Contour, typename Primitive>
const Contour* DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::myC [private]

The contour visited by the iterator.

template<typename Contour, typename Primitive>
Contour::ConstIterator DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::myFront [private]

An iterator of the contour at the front of the current primitive

template<typename Contour, typename Primitive>
Primitive DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::myP [private]

The current primitive of the iterator.

template<typename Contour, typename Primitive>
unsigned int DGtal::GreedyDecomposition< Contour, Primitive >::ConstIterator::myPosition [private]

The current position in the contour.


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