DGtal  1.0.beta
Public Member Functions | Private Member Functions | Private Attributes | Friends
DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator Class Reference

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

Inheritance diagram for DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator:
[legend]
Collaboration diagram for DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator:
[legend]

Public Member Functions

 ConstIterator ()
 
 ConstIterator (const ArithmeticalDSL *aDSL, const Point &aPoint)
 
 ConstIterator (const ConstIterator &aOther)
 
ConstIteratoroperator= (const ConstIterator &aOther)
 
 ~ConstIterator ()
 
Integer remainder () const
 

Private Member Functions

Point const dereference () const
 
void increment ()
 
void decrement ()
 
bool equal (const ConstIterator &aOther) const
 
void advance (const Position &aShift)
 
Position distance_to (const ConstIterator &aOther) const
 

Private Attributes

const ArithmeticalDSLmyDSLPtr
 
Point myCurrentPoint
 
Integer myQuantityToAdd
 
Integer myQuantityToRemove
 
Integer myCurrentRemainder
 

Friends

class boost::iterator_core_access
 

Detailed Description

template<typename TCoordinate, typename TInteger = TCoordinate, unsigned short adjacency = 8>
class DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator

Aim: This class aims at representing an iterator that provides a way to scan the points of a DSL. It is both a model of readable iterator and of bidirectional iterator.

Instances of this class are returned by begin and end methods of DSL classes as follows:

// Draw the DSL points between firstPoint and lastPoint
for ( NaiveDSL<Integer>::ConstIterator
it = line.begin(firstPoint),
ite = line.end(lastPoint);
it != ite; ++it )
{
board << SetMode( it->className(), "Paving" )
<< *it; //Draw the point
}

See Digital straight lines and segments for further details.

See also
ArithmeticalDSL NaiveDSL StandardDSL
exampleArithmeticalDSL.cpp

Definition at line 177 of file ArithmeticalDSL.h.

Constructor & Destructor Documentation

template<typename TCoordinate, typename TInteger = TCoordinate, unsigned short adjacency = 8>
DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::ConstIterator ( )

Default constructor (not valid).

template<typename TCoordinate, typename TInteger = TCoordinate, unsigned short adjacency = 8>
DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::ConstIterator ( const ArithmeticalDSL aDSL,
const Point aPoint 
)

Constructor.

Parameters
aDSLan arithmetical DSL
aPointa point of the DSL containing aDSL
template<typename TCoordinate, typename TInteger = TCoordinate, unsigned short adjacency = 8>
DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::ConstIterator ( const ConstIterator aOther)

Copy constructor.

Parameters
aOtherthe iterator to clone.
template<typename TCoordinate, typename TInteger = TCoordinate, unsigned short adjacency = 8>
DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::~ConstIterator ( )

Destructor. Does nothing.

Member Function Documentation

template<typename TCoordinate, typename TInteger = TCoordinate, unsigned short adjacency = 8>
void DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::advance ( const Position aShift)
private

Moves myCurrentPoint lying at position i to the point of the DSL lying at position i + aShift

Parameters
aShiftposition difference NB: in O(1)
template<typename TCoordinate, typename TInteger = TCoordinate, unsigned short adjacency = 8>
void DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::decrement ( )
private

Moves myCurrentPoint to the previous point of the DSL

template<typename TCoordinate, typename TInteger = TCoordinate, unsigned short adjacency = 8>
Point const DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::dereference ( ) const
private

Dereference operator

Returns
the current point
template<typename TCoordinate, typename TInteger = TCoordinate, unsigned short adjacency = 8>
Position DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::distance_to ( const ConstIterator aOther) const
private

Computes the distance between *this and aOther, ie. the difference between their positions

Parameters
aOtherany other iterator
Returns
distance between the two iterators
template<typename TCoordinate, typename TInteger = TCoordinate, unsigned short adjacency = 8>
bool DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::equal ( const ConstIterator aOther) const
private

Equality operator.

Parameters
aOtherthe iterator to compare with (must be defined on the same DSL).
Returns
'true' if their current points coincide.
template<typename TCoordinate, typename TInteger = TCoordinate, unsigned short adjacency = 8>
void DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::increment ( )
private

Moves myCurrentPoint to the next point of the DSL

template<typename TCoordinate, typename TInteger = TCoordinate, unsigned short adjacency = 8>
ConstIterator& DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::operator= ( const ConstIterator aOther)

Assignment.

Parameters
aOtherthe iterator to copy.
Returns
a reference on 'this'.
template<typename TCoordinate, typename TInteger = TCoordinate, unsigned short adjacency = 8>
Integer DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::remainder ( ) const
Returns
the remainder of the current point (without any computation)

Friends And Related Function Documentation

template<typename TCoordinate, typename TInteger = TCoordinate, unsigned short adjacency = 8>
friend class boost::iterator_core_access
friend

Definition at line 248 of file ArithmeticalDSL.h.

Field Documentation

template<typename TCoordinate, typename TInteger = TCoordinate, unsigned short adjacency = 8>
Point DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::myCurrentPoint
private

The current point.

Definition at line 195 of file ArithmeticalDSL.h.

template<typename TCoordinate, typename TInteger = TCoordinate, unsigned short adjacency = 8>
Integer DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::myCurrentRemainder
private

Remainder of the current point.

Definition at line 204 of file ArithmeticalDSL.h.

template<typename TCoordinate, typename TInteger = TCoordinate, unsigned short adjacency = 8>
const ArithmeticalDSL* DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::myDSLPtr
private

Constant aliasing pointer to the DSL visited by the iterator.

Definition at line 192 of file ArithmeticalDSL.h.

template<typename TCoordinate, typename TInteger = TCoordinate, unsigned short adjacency = 8>
Integer DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::myQuantityToAdd
private

Quantity to add to the current remainder.

Definition at line 198 of file ArithmeticalDSL.h.

template<typename TCoordinate, typename TInteger = TCoordinate, unsigned short adjacency = 8>
Integer DGtal::ArithmeticalDSL< TCoordinate, TInteger, adjacency >::ConstIterator::myQuantityToRemove
private

Quantity to remove to the current remainder.

Definition at line 201 of file ArithmeticalDSL.h.


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