DGtal  0.9.3beta
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 140 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 164 of file FreemanChain.h.

165  : myFc( NULL ), myPos( 0 )
166  { }
const FreemanChain * myFc
The Freeman chain visited by the iterator.
Definition: FreemanChain.h:149
Index myPos
The current position in the word.
Definition: FreemanChain.h:152
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 189 of file FreemanChain.h.

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

Copy constructor.

Parameters
aOtherthe iterator to clone.

Definition at line 197 of file FreemanChain.h.

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

Destructor. Does nothing.

Definition at line 211 of file FreemanChain.h.

212  { }

Member Function Documentation

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

Definition at line 229 of file FreemanChain.h.

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

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

Definition at line 278 of file FreemanChain.h.

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

279  {
280  return myFc;
281  }
const FreemanChain * myFc
The Freeman chain visited by the iterator.
Definition: FreemanChain.h:149
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 288 of file FreemanChain.h.

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

289  {
290  ASSERT( myFc != 0 );
291  return myFc->code( myPos );
292  }
char code(Index pos) const
const FreemanChain * myFc
The Freeman chain visited by the iterator.
Definition: FreemanChain.h:149
Index myPos
The current position in the word.
Definition: FreemanChain.h:152
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 352 of file FreemanChain.h.

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

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

Definition at line 221 of file FreemanChain.h.

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

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

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

Definition at line 238 of file FreemanChain.h.

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

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

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

Definition at line 248 of file FreemanChain.h.

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

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

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

Definition at line 299 of file FreemanChain.h.

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

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

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

Definition at line 309 of file FreemanChain.h.

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

310  {
311  ConstIterator tmp(*this);
312  this->previous();
313  return tmp;
314  }
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 367 of file FreemanChain.h.

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

368  {
369  ASSERT( myFc == aOther.myFc );
370  return myPos < aOther.myPos;
371  }
const FreemanChain * myFc
The Freeman chain visited by the iterator.
Definition: FreemanChain.h:149
Index myPos
The current position in the word.
Definition: FreemanChain.h:152
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 337 of file FreemanChain.h.

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

338  {
339  ASSERT( myFc == aOther.myFc );
340  return myPos == aOther.myPos;
341  }
const FreemanChain * myFc
The Freeman chain visited by the iterator.
Definition: FreemanChain.h:149
Index myPos
The current position in the word.
Definition: FreemanChain.h:152
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 269 of file FreemanChain.h.

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

270  {
271  return myPos;
272  }
Index myPos
The current position in the word.
Definition: FreemanChain.h:152
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 155 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: