DGtal  0.9.3beta
Public Types | Public Member Functions | Private Attributes
DGtal::StandardDSLQ0< TFraction >::ConstIterator Struct Reference

#include <DGtal/arithmetic/StandardDSLQ0.h>

Public Types

typedef ConstIterator Self
 
typedef Point Value
 
typedef std::forward_iterator_tag iterator_category
 
typedef Point value_type
 
typedef std::ptrdiff_t difference_type
 
typedef const Pointpointer
 
typedef const Pointreference
 

Public Member Functions

 ConstIterator ()
 
 ConstIterator (ConstAlias< StandardDSLQ0< TFraction > > myDSL, const Point &p)
 
 ConstIterator (const Self &other)
 
Selfoperator= (const Self &other)
 
reference operator* () const
 
pointer operator-> () const
 
Selfoperator++ ()
 
Self operator++ (int)
 
bool operator== (const Self &other) const
 
bool operator!= (const Self &other) const
 

Private Attributes

const StandardDSLQ0< TFraction > * myPtrDSL
 
Point myP
 

Detailed Description

template<typename TFraction>
struct DGtal::StandardDSLQ0< TFraction >::ConstIterator

The iterator to move in the standard digital straight line, point by point. To move from A to B on the DSL D, visiting [A,B], write:

for ( ConstIterator it = D.begin( A ), it_end = D.end( B );
it != it_end; ++it )
Point P = *it;

Definition at line 110 of file StandardDSLQ0.h.

Member Typedef Documentation

template<typename TFraction>
typedef std::ptrdiff_t DGtal::StandardDSLQ0< TFraction >::ConstIterator::difference_type

Definition at line 117 of file StandardDSLQ0.h.

template<typename TFraction>
typedef std::forward_iterator_tag DGtal::StandardDSLQ0< TFraction >::ConstIterator::iterator_category

Definition at line 115 of file StandardDSLQ0.h.

template<typename TFraction>
typedef const Point* DGtal::StandardDSLQ0< TFraction >::ConstIterator::pointer

Definition at line 118 of file StandardDSLQ0.h.

template<typename TFraction>
typedef const Point& DGtal::StandardDSLQ0< TFraction >::ConstIterator::reference

Definition at line 119 of file StandardDSLQ0.h.

template<typename TFraction>
typedef ConstIterator DGtal::StandardDSLQ0< TFraction >::ConstIterator::Self

Definition at line 111 of file StandardDSLQ0.h.

template<typename TFraction>
typedef Point DGtal::StandardDSLQ0< TFraction >::ConstIterator::Value

Definition at line 112 of file StandardDSLQ0.h.

template<typename TFraction>
typedef Point DGtal::StandardDSLQ0< TFraction >::ConstIterator::value_type

Definition at line 116 of file StandardDSLQ0.h.

Constructor & Destructor Documentation

template<typename TFraction>
DGtal::StandardDSLQ0< TFraction >::ConstIterator::ConstIterator ( )
inline

Definition at line 121 of file StandardDSLQ0.h.

122  : myPtrDSL( 0 )
123  {}
const StandardDSLQ0< TFraction > * myPtrDSL
template<typename TFraction>
DGtal::StandardDSLQ0< TFraction >::ConstIterator::ConstIterator ( ConstAlias< StandardDSLQ0< TFraction > >  myDSL,
const Point p 
)
inline

Definition at line 124 of file StandardDSLQ0.h.

126  : myPtrDSL( & myDSL ), myP( p )
127  {}
const StandardDSLQ0< TFraction > * myPtrDSL
template<typename TFraction>
DGtal::StandardDSLQ0< TFraction >::ConstIterator::ConstIterator ( const Self other)
inline

Definition at line 128 of file StandardDSLQ0.h.

129  : myPtrDSL( other.myPtrDSL ), myP( other.myP )
130  {}
const StandardDSLQ0< TFraction > * myPtrDSL

Member Function Documentation

template<typename TFraction>
bool DGtal::StandardDSLQ0< TFraction >::ConstIterator::operator!= ( const Self other) const
inline

Definition at line 180 of file StandardDSLQ0.h.

References DGtal::StandardDSLQ0< TFraction >::ConstIterator::operator==().

181  {
182  return ! ( this->operator==( other ) );
183  }
bool operator==(const Self &other) const
template<typename TFraction>
reference DGtal::StandardDSLQ0< TFraction >::ConstIterator::operator* ( ) const
inline

Definition at line 141 of file StandardDSLQ0.h.

References DGtal::StandardDSLQ0< TFraction >::ConstIterator::myP, and DGtal::StandardDSLQ0< TFraction >::ConstIterator::myPtrDSL.

142  {
143  ASSERT( myPtrDSL != 0 );
144  return myP;
145  }
const StandardDSLQ0< TFraction > * myPtrDSL
template<typename TFraction>
Self& DGtal::StandardDSLQ0< TFraction >::ConstIterator::operator++ ( )
inline

Definition at line 153 of file StandardDSLQ0.h.

References DGtal::StandardDSLQ0< TFraction >::ConstIterator::myP, and DGtal::StandardDSLQ0< TFraction >::ConstIterator::myPtrDSL.

Referenced by DGtal::StandardDSLQ0< TFraction >::ConstIterator::operator++().

154  {
155  Integer rem = myPtrDSL->r( myP );
156  if ( rem - myPtrDSL->b() >= myPtrDSL->mu() )
157  ++myP[ 1 ]; // +y;
158  else
159  ++myP[ 0 ]; // +x;
160  return *this;
161  }
Fraction::Integer Integer
Definition: StandardDSLQ0.h:85
const StandardDSLQ0< TFraction > * myPtrDSL
template<typename TFraction>
Self DGtal::StandardDSLQ0< TFraction >::ConstIterator::operator++ ( int  )
inline

Definition at line 165 of file StandardDSLQ0.h.

References DGtal::StandardDSLQ0< TFraction >::ConstIterator::operator++().

166  {
167  Self __tmp = *this;
168  this->operator++();
169  return __tmp;
170  }
template<typename TFraction>
pointer DGtal::StandardDSLQ0< TFraction >::ConstIterator::operator-> ( ) const
inline

Definition at line 147 of file StandardDSLQ0.h.

References DGtal::StandardDSLQ0< TFraction >::ConstIterator::myP, and DGtal::StandardDSLQ0< TFraction >::ConstIterator::myPtrDSL.

148  {
149  ASSERT( myPtrDSL != 0 );
150  return &myP;
151  }
const StandardDSLQ0< TFraction > * myPtrDSL
template<typename TFraction>
Self& DGtal::StandardDSLQ0< TFraction >::ConstIterator::operator= ( const Self other)
inline

Definition at line 131 of file StandardDSLQ0.h.

References DGtal::StandardDSLQ0< TFraction >::ConstIterator::myP, and DGtal::StandardDSLQ0< TFraction >::ConstIterator::myPtrDSL.

132  {
133  if ( this != &other )
134  {
135  myPtrDSL = other.myPtrDSL;
136  myP = other.myP;
137  }
138  return *this;
139  }
const StandardDSLQ0< TFraction > * myPtrDSL
template<typename TFraction>
bool DGtal::StandardDSLQ0< TFraction >::ConstIterator::operator== ( const Self other) const
inline

Definition at line 173 of file StandardDSLQ0.h.

References DGtal::StandardDSLQ0< TFraction >::ConstIterator::myP, and DGtal::StandardDSLQ0< TFraction >::ConstIterator::myPtrDSL.

Referenced by DGtal::StandardDSLQ0< TFraction >::ConstIterator::operator!=().

174  {
175  ASSERT( myPtrDSL == other.myPtrDSL );
176  return myP == other.myP;
177  }
const StandardDSLQ0< TFraction > * myPtrDSL

Field Documentation

template<typename TFraction>
Point DGtal::StandardDSLQ0< TFraction >::ConstIterator::myP
private
template<typename TFraction>
const StandardDSLQ0<TFraction>* DGtal::StandardDSLQ0< TFraction >::ConstIterator::myPtrDSL
private

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