DGtal  0.9.4beta
Public Member Functions | Private Attributes
DGtal::FreemanChain< TInteger >::ConstIterator Class Reference

#include <DGtal/geometry/curves/FreemanChain.h>

Inheritance diagram for DGtal::FreemanChain< TInteger >::ConstIterator:
[legend]
Collaboration diagram for DGtal::FreemanChain< TInteger >::ConstIterator:
[legend]

Public Member Functions

 ConstIterator ()
 
 ConstIterator (ConstAlias< FreemanChain > aChain, Index n=0)
 
 ConstIterator (ConstAlias< FreemanChain > aChain, Index n, const Point &XY)
 
 ConstIterator (const ConstIterator &aOther)
 
ConstIteratoroperator= (const ConstIterator &other)
 
 ~ConstIterator ()
 
const Pointoperator* () const
 
const Pointget () const
 
ConstIteratoroperator++ ()
 
ConstIterator operator++ (int)
 
void next ()
 
void nextInLoop ()
 
Index position () const
 
const FreemanChaingetChain () const
 
char getCode () const
 
ConstIteratoroperator-- ()
 
ConstIterator operator-- (int)
 
void previous ()
 
void previousInLoop ()
 
bool operator== (const ConstIterator &aOther) const
 
bool operator!= (const ConstIterator &aOther) const
 
bool operator< (const ConstIterator &aOther) const
 

Private Attributes

const FreemanChainmyFc
 
Index myPos
 
Point myXY
 

Detailed Description

template<typename TInteger>
class DGtal::FreemanChain< TInteger >::ConstIterator

This class represents an iterator on points defined by freeman chain, storing the current coordinate.

Examples:
geometry/curves/exampleAlphaThickSegment.cpp.

Definition at line 141 of file FreemanChain.h.

Constructor & Destructor Documentation

template<typename TInteger>
DGtal::FreemanChain< TInteger >::ConstIterator::ConstIterator ( )
inline

Default Constructor. The object is not valid.

Definition at line 165 of file FreemanChain.h.

166  : myFc( NULL ), myPos( 0 )
167  { }
const FreemanChain * myFc
The Freeman chain visited by the iterator.
Definition: FreemanChain.h:150
Index myPos
The current position in the word.
Definition: FreemanChain.h:153
template<typename TInteger>
DGtal::FreemanChain< TInteger >::ConstIterator::ConstIterator ( ConstAlias< FreemanChain aChain,
Index  n = 0 
)

Constructor. Nb: complexity in O(n).

Parameters
aChaina Freeman chain,
nthe position in chain).
template<typename TInteger>
DGtal::FreemanChain< TInteger >::ConstIterator::ConstIterator ( ConstAlias< FreemanChain aChain,
Index  n,
const Point XY 
)
inline

Constructor. It is the user's responsability to make sure that the data's are consistent. No verification is performed.

Nb: complexity in O(1).

Parameters
aChaina Freeman chain,
nthe position in chain).
XYthe point corresponding to the 'n'-th position of 'chain'.

Definition at line 190 of file FreemanChain.h.

191  : myFc( &aChain ), myPos( n ), myXY ( XY )
192  { }
const FreemanChain * myFc
The Freeman chain visited by the iterator.
Definition: FreemanChain.h:150
Point myXY
The current coordinates of the iterator.
Definition: FreemanChain.h:156
Index myPos
The current position in the word.
Definition: FreemanChain.h:153
template<typename TInteger>
DGtal::FreemanChain< TInteger >::ConstIterator::ConstIterator ( const ConstIterator aOther)
inline

Copy constructor.

Parameters
aOtherthe iterator to clone.

Definition at line 198 of file FreemanChain.h.

199  : myFc( aOther.myFc ), myPos( aOther.myPos ), myXY( aOther.myXY )
200  { }
const FreemanChain * myFc
The Freeman chain visited by the iterator.
Definition: FreemanChain.h:150
Point myXY
The current coordinates of the iterator.
Definition: FreemanChain.h:156
Index myPos
The current position in the word.
Definition: FreemanChain.h:153
template<typename TInteger>
DGtal::FreemanChain< TInteger >::ConstIterator::~ConstIterator ( )
inline

Destructor. Does nothing.

Definition at line 212 of file FreemanChain.h.

213  { }

Member Function Documentation

template<typename TInteger>
const Point& DGtal::FreemanChain< TInteger >::ConstIterator::get ( ) const
inline
Returns
the current coordinates.

Definition at line 230 of file FreemanChain.h.

References DGtal::FreemanChain< TInteger >::ConstIterator::myXY.

231  {
232  return myXY;
233  }
Point myXY
The current coordinates of the iterator.
Definition: FreemanChain.h:156
template<typename TInteger>
const FreemanChain* DGtal::FreemanChain< TInteger >::ConstIterator::getChain ( ) const
inline
Returns
the associated Freeman chain.

Definition at line 279 of file FreemanChain.h.

References DGtal::FreemanChain< TInteger >::ConstIterator::myFc.

280  {
281  return myFc;
282  }
const FreemanChain * myFc
The Freeman chain visited by the iterator.
Definition: FreemanChain.h:150
template<typename TInteger>
char DGtal::FreemanChain< TInteger >::ConstIterator::getCode ( ) const
inline
Returns
the current Freeman code (specifies the movement to the next point).

Definition at line 289 of file FreemanChain.h.

References DGtal::FreemanChain< TInteger >::code().

290  {
291  ASSERT( myFc != 0 );
292  return myFc->code( myPos );
293  }
char code(Index pos) const
const FreemanChain * myFc
The Freeman chain visited by the iterator.
Definition: FreemanChain.h:150
Index myPos
The current position in the word.
Definition: FreemanChain.h:153
template<typename TInteger>
void DGtal::FreemanChain< TInteger >::ConstIterator::next ( )

Goes to the next point on the chain.

Referenced by DGtal::FreemanChain< TInteger >::ConstIterator::operator++().

template<typename TInteger>
void DGtal::FreemanChain< TInteger >::ConstIterator::nextInLoop ( )

Goes to the next point on the chain as if on a loop.

template<typename TInteger>
bool DGtal::FreemanChain< TInteger >::ConstIterator::operator!= ( const ConstIterator aOther) const
inline

Inequality operator.

Parameters
aOtherthe iterator to compare with (must be defined on the same chain).
Returns
'true' if their current positions differs.

Definition at line 353 of file FreemanChain.h.

References DGtal::FreemanChain< TInteger >::ConstIterator::myFc, and DGtal::FreemanChain< TInteger >::ConstIterator::myPos.

354  {
355  ASSERT( myFc == aOther.myFc );
356  return myPos != aOther.myPos;
357  }
const FreemanChain * myFc
The Freeman chain visited by the iterator.
Definition: FreemanChain.h:150
Index myPos
The current position in the word.
Definition: FreemanChain.h:153
template<typename TInteger>
const Point& DGtal::FreemanChain< TInteger >::ConstIterator::operator* ( ) const
inline
Returns
the current coordinates.

Definition at line 222 of file FreemanChain.h.

References DGtal::FreemanChain< TInteger >::ConstIterator::myXY.

223  {
224  return myXY;
225  }
Point myXY
The current coordinates of the iterator.
Definition: FreemanChain.h:156
template<typename TInteger>
ConstIterator& DGtal::FreemanChain< TInteger >::ConstIterator::operator++ ( )
inline

Pre-increment. Goes to the next point on the chain.

Definition at line 239 of file FreemanChain.h.

References DGtal::FreemanChain< TInteger >::ConstIterator::next().

240  {
241  this->next();
242  return *this;
243  }
template<typename TInteger>
ConstIterator DGtal::FreemanChain< TInteger >::ConstIterator::operator++ ( int  )
inline

Post-increment. Goes to the next point on the chain.

Definition at line 249 of file FreemanChain.h.

References DGtal::FreemanChain< TInteger >::ConstIterator::next().

250  {
251  ConstIterator tmp(*this);
252  this->next();
253  return tmp;
254  }
template<typename TInteger>
ConstIterator& DGtal::FreemanChain< TInteger >::ConstIterator::operator-- ( )
inline

Pre-decrement. Goes to the previous point on the chain.

Definition at line 300 of file FreemanChain.h.

References DGtal::FreemanChain< TInteger >::ConstIterator::previous().

301  {
302  this->previous();
303  return *this;
304  }
template<typename TInteger>
ConstIterator DGtal::FreemanChain< TInteger >::ConstIterator::operator-- ( int  )
inline

Post-decrement. Goes to the previous point on the chain.

Definition at line 310 of file FreemanChain.h.

References DGtal::FreemanChain< TInteger >::ConstIterator::previous().

311  {
312  ConstIterator tmp(*this);
313  this->previous();
314  return tmp;
315  }
template<typename TInteger>
bool DGtal::FreemanChain< TInteger >::ConstIterator::operator< ( const ConstIterator aOther) const
inline

Inferior operator.

Parameters
aOtherthe iterator to compare with (must be defined on the same chain).
Returns
'true' if the current position of 'this' is before the current position of [aOther].

Definition at line 368 of file FreemanChain.h.

References DGtal::FreemanChain< TInteger >::ConstIterator::myFc, and DGtal::FreemanChain< TInteger >::ConstIterator::myPos.

369  {
370  ASSERT( myFc == aOther.myFc );
371  return myPos < aOther.myPos;
372  }
const FreemanChain * myFc
The Freeman chain visited by the iterator.
Definition: FreemanChain.h:150
Index myPos
The current position in the word.
Definition: FreemanChain.h:153
template<typename TInteger>
ConstIterator& DGtal::FreemanChain< TInteger >::ConstIterator::operator= ( const ConstIterator other)

Assignment.

Parameters
otherthe iterator to copy.
Returns
a reference on 'this'.
template<typename TInteger>
bool DGtal::FreemanChain< TInteger >::ConstIterator::operator== ( const ConstIterator aOther) const
inline

Equality operator.

Parameters
aOtherthe iterator to compare with (must be defined on the same chain).
Returns
'true' if their current positions coincide.

Definition at line 338 of file FreemanChain.h.

References DGtal::FreemanChain< TInteger >::ConstIterator::myFc, and DGtal::FreemanChain< TInteger >::ConstIterator::myPos.

339  {
340  ASSERT( myFc == aOther.myFc );
341  return myPos == aOther.myPos;
342  }
const FreemanChain * myFc
The Freeman chain visited by the iterator.
Definition: FreemanChain.h:150
Index myPos
The current position in the word.
Definition: FreemanChain.h:153
template<typename TInteger>
Index DGtal::FreemanChain< TInteger >::ConstIterator::position ( ) const
inline
Returns
the current position (as an index in the Freeman chain).

Definition at line 270 of file FreemanChain.h.

References DGtal::FreemanChain< TInteger >::ConstIterator::myPos.

271  {
272  return myPos;
273  }
Index myPos
The current position in the word.
Definition: FreemanChain.h:153
template<typename TInteger>
void DGtal::FreemanChain< TInteger >::ConstIterator::previous ( )

Goes to the previous point on the chain if possible.

Referenced by DGtal::FreemanChain< TInteger >::ConstIterator::operator--().

template<typename TInteger>
void DGtal::FreemanChain< TInteger >::ConstIterator::previousInLoop ( )

Goes to the previous point on the chain as if on a loop.

Field Documentation

template<typename TInteger>
const FreemanChain* DGtal::FreemanChain< TInteger >::ConstIterator::myFc
private
template<typename TInteger>
Index DGtal::FreemanChain< TInteger >::ConstIterator::myPos
private
template<typename TInteger>
Point DGtal::FreemanChain< TInteger >::ConstIterator::myXY
private

The current coordinates of the iterator.

Definition at line 156 of file FreemanChain.h.

Referenced by DGtal::FreemanChain< TInteger >::ConstIterator::get(), and DGtal::FreemanChain< TInteger >::ConstIterator::operator*().


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