DGtal  0.9.3beta
Public Types | Public Member Functions | Private Attributes | Friends
DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator Class Reference

#include <DGtal/images/ImageContainerBySTLVector.h>

Public Types

typedef std::bidirectional_iterator_tag iterator_category
 
typedef Value value_type
 
typedef ptrdiff_t difference_type
 
typedef Valuepointer
 
typedef Valuereference
 

Public Member Functions

 SpanIterator (const Point &p, const Dimension aDim, ImageContainerBySTLVector< Domain, Value > *aMap)
 
void setValue (const Value aVal)
 
const Valueoperator* ()
 
bool operator== (const SpanIterator &it) const
 
bool operator!= (const SpanIterator &it) const
 
void next ()
 
void prev ()
 
SpanIteratoroperator++ ()
 
SpanIteratoroperator++ (int)
 
SpanIteratoroperator-- ()
 
SpanIteratoroperator-- (int)
 

Private Attributes

Size myPos
 
ImageContainerBySTLVector< Domain, Value > * myMap
 
Dimension myDimension
 
Size myShift
 

Friends

class ImageContainerBySTLVector< Domain, Value >
 

Detailed Description

template<typename TDomain, typename TValue>
class DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator

Specific SpanIterator on ImageContainerBySTLVector.

Definition at line 294 of file ImageContainerBySTLVector.h.

Member Typedef Documentation

template<typename TDomain, typename TValue>
typedef ptrdiff_t DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::difference_type

Definition at line 304 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef std::bidirectional_iterator_tag DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::iterator_category
Todo:
construct a RANDOM-ACCESS iterator

Definition at line 302 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef Value* DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::pointer

Definition at line 305 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef Value& DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::reference

Definition at line 306 of file ImageContainerBySTLVector.h.

template<typename TDomain, typename TValue>
typedef Value DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::value_type

Definition at line 303 of file ImageContainerBySTLVector.h.

Constructor & Destructor Documentation

template<typename TDomain, typename TValue>
DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::SpanIterator ( const Point p,
const Dimension  aDim,
ImageContainerBySTLVector< Domain, Value > *  aMap 
)
inline

Constructor.

Parameters
pstarting point of the SpanIterator
aDimspecifies the dimension along which the iterator will iterate
aMappointer to the imageContainer

Definition at line 315 of file ImageContainerBySTLVector.h.

References DGtal::ImageContainerBySTLVector< TDomain, TValue >::linearized(), DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::myDimension, DGtal::ImageContainerBySTLVector< TDomain, TValue >::myExtent, DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::myPos, and DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::myShift.

317  : myMap ( aMap ), myDimension ( aDim )
318  {
319  myPos = aMap->linearized ( p );
320 
321  //We compute the myShift quantity
322  myShift = 1;
323 
324  for ( Dimension k = 0; k < myDimension ; k++ )
325  myShift *= aMap->myExtent[k];
326  }
Size linearized(const Point &aPoint) const
Dimension myDimension
Dimension on which the iterator must iterate.
ImageContainerBySTLVector< Domain, Value > * myMap
Copy of the underlying images.
Vector myExtent
Domain extent (stored for linearization efficiency)

Member Function Documentation

template<typename TDomain, typename TValue>
void DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::next ( )
inline
template<typename TDomain, typename TValue>
bool DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::operator!= ( const SpanIterator it) const
inline

Operator !=

Returns
true if this and it are different.

Definition at line 368 of file ImageContainerBySTLVector.h.

References DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::myPos.

369  {
370  return ( myPos != it.myPos );
371  }
template<typename TDomain, typename TValue>
const Value& DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::operator* ( )
inline

operator* on SpanIterators.

Returns
the value associated to the current position.

Definition at line 346 of file ImageContainerBySTLVector.h.

References DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::myMap, and DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::myPos.

347  {
348  return ( *myMap ) [ myPos ];
349  }
ImageContainerBySTLVector< Domain, Value > * myMap
Copy of the underlying images.
template<typename TDomain, typename TValue>
SpanIterator& DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::operator++ ( )
inline

Operator ++ (++it)

Definition at line 399 of file ImageContainerBySTLVector.h.

References DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::next().

400  {
401  this->next();
402  return *this;
403  }
template<typename TDomain, typename TValue>
SpanIterator& DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::operator++ ( int  )
inline

Operator ++ (it++)

Definition at line 410 of file ImageContainerBySTLVector.h.

411  {
412  SpanIterator tmp = *this;
413  ++*this;
414  return tmp;
415  }
SpanIterator(const Point &p, const Dimension aDim, ImageContainerBySTLVector< Domain, Value > *aMap)
template<typename TDomain, typename TValue>
SpanIterator& DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::operator-- ( )
inline

Operator – (–it)

Definition at line 422 of file ImageContainerBySTLVector.h.

References DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::prev().

423  {
424  this->prev();
425  return *this;
426  }
template<typename TDomain, typename TValue>
SpanIterator& DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::operator-- ( int  )
inline

Operator – (it–)

Definition at line 433 of file ImageContainerBySTLVector.h.

434  {
435  SpanIterator tmp = *this;
436  --*this;
437  return tmp;
438  }
SpanIterator(const Point &p, const Dimension aDim, ImageContainerBySTLVector< Domain, Value > *aMap)
template<typename TDomain, typename TValue>
bool DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::operator== ( const SpanIterator it) const
inline

Operator ==.

Returns
true if this and it are equals.

Definition at line 357 of file ImageContainerBySTLVector.h.

References DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::myPos.

358  {
359  return ( myPos == it.myPos );
360  }
template<typename TDomain, typename TValue>
void DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::prev ( )
inline
template<typename TDomain, typename TValue>
void DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::setValue ( const Value  aVal)
inline

Set a value at a SpanIterator position.

Parameters
aValthe value to set.

Definition at line 335 of file ImageContainerBySTLVector.h.

References DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::myPos.

336  {
337  ( *myMap ) [ myPos ] = aVal;
338  }

Friends And Related Function Documentation

template<typename TDomain, typename TValue>
friend class ImageContainerBySTLVector< Domain, Value >
friend

Definition at line 297 of file ImageContainerBySTLVector.h.

Field Documentation

template<typename TDomain, typename TValue>
Dimension DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::myDimension
private

Dimension on which the iterator must iterate.

Definition at line 448 of file ImageContainerBySTLVector.h.

Referenced by DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::SpanIterator().

template<typename TDomain, typename TValue>
ImageContainerBySTLVector<Domain, Value>* DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::myMap
private

Copy of the underlying images.

Definition at line 445 of file ImageContainerBySTLVector.h.

Referenced by DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::operator*().

template<typename TDomain, typename TValue>
Size DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::myPos
private
template<typename TDomain, typename TValue>
Size DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::myShift
private

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