DGtal  1.2.0
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
 Current Point in the domain. More...
 
ImageContainerBySTLVector< Domain, Value > * myMap
 Copy of the underlying images. More...
 
Dimension myDimension
 Dimension on which the iterator must iterate. More...
 
Size myShift
 Padding variable. More...
 

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 307 of file ImageContainerBySTLVector.h.

Member Typedef Documentation

◆ difference_type

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

Definition at line 317 of file ImageContainerBySTLVector.h.

◆ iterator_category

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 315 of file ImageContainerBySTLVector.h.

◆ pointer

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

Definition at line 318 of file ImageContainerBySTLVector.h.

◆ reference

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

Definition at line 319 of file ImageContainerBySTLVector.h.

◆ value_type

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

Definition at line 316 of file ImageContainerBySTLVector.h.

Constructor & Destructor Documentation

◆ SpanIterator()

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 328 of file ImageContainerBySTLVector.h.

330  : myMap ( aMap ), myDimension ( aDim )
331  {
332  myPos = aMap->linearized ( p );
333 
334  //We compute the myShift quantity
335  myShift = 1;
336 
337  for ( Dimension k = 0; k < myDimension ; k++ )
338  myShift *= aMap->myExtent[k];
339  }
ImageContainerBySTLVector< Domain, Value > * myMap
Copy of the underlying images.
Dimension myDimension
Dimension on which the iterator must iterate.
Vector myExtent
Domain extent (stored for linearization efficiency)
Size linearized(const Point &aPoint) const

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.

Member Function Documentation

◆ next()

template<typename TDomain , typename TValue >
void DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::next ( )
inline

◆ operator!=()

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 381 of file ImageContainerBySTLVector.h.

382  {
383  return ( myPos != it.myPos );
384  }

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

◆ operator*()

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 359 of file ImageContainerBySTLVector.h.

360  {
361  return ( *myMap ) [ myPos ];
362  }

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

◆ operator++() [1/2]

template<typename TDomain , typename TValue >
SpanIterator& DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::operator++ ( )
inline

Operator ++ (++it)

Definition at line 412 of file ImageContainerBySTLVector.h.

413  {
414  this->next();
415  return *this;
416  }

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

◆ operator++() [2/2]

template<typename TDomain , typename TValue >
SpanIterator& DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::operator++ ( int  )
inline

Operator ++ (it++)

Definition at line 423 of file ImageContainerBySTLVector.h.

424  {
425  SpanIterator tmp = *this;
426  ++*this;
427  return tmp;
428  }
SpanIterator(const Point &p, const Dimension aDim, ImageContainerBySTLVector< Domain, Value > *aMap)

◆ operator--() [1/2]

template<typename TDomain , typename TValue >
SpanIterator& DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::operator-- ( )
inline

Operator – (–it)

Definition at line 435 of file ImageContainerBySTLVector.h.

436  {
437  this->prev();
438  return *this;
439  }

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

◆ operator--() [2/2]

template<typename TDomain , typename TValue >
SpanIterator& DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::operator-- ( int  )
inline

Operator – (it–)

Definition at line 446 of file ImageContainerBySTLVector.h.

447  {
448  SpanIterator tmp = *this;
449  --*this;
450  return tmp;
451  }

◆ operator==()

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 370 of file ImageContainerBySTLVector.h.

371  {
372  return ( myPos == it.myPos );
373  }

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

◆ prev()

template<typename TDomain , typename TValue >
void DGtal::ImageContainerBySTLVector< TDomain, TValue >::SpanIterator::prev ( )
inline

◆ setValue()

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 348 of file ImageContainerBySTLVector.h.

349  {
350  ( *myMap ) [ myPos ] = aVal;
351  }

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

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

Friends And Related Function Documentation

◆ ImageContainerBySTLVector< Domain, Value >

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

Definition at line 530 of file ImageContainerBySTLVector.h.

Field Documentation

◆ myDimension

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

Dimension on which the iterator must iterate.

Definition at line 461 of file ImageContainerBySTLVector.h.

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

◆ myMap

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

Copy of the underlying images.

Definition at line 458 of file ImageContainerBySTLVector.h.

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

◆ myPos

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

◆ myShift

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

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