DGtal  0.9.4beta
Public Types | Public Member Functions | Private Attributes
DGtal::DefaultConstImageRange< TImage > Class Template Reference

#include <DGtal/images/DefaultConstImageRange.h>

Public Types

typedef TImage::Domain Domain
 
typedef TImage::Point Point
 
typedef TImage::Value Value
 
typedef ConstIteratorAdapter< typename Domain::ConstIterator, TImage, ValueConstIterator
 
typedef std::reverse_iterator< ConstIteratorConstReverseIterator
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CTrivialConstImage< TImage >))
 
 BOOST_CONCEPT_ASSERT ((concepts::CDomain< Domain >))
 
 DefaultConstImageRange (ConstAlias< TImage > aImage)
 
 DefaultConstImageRange (const DefaultConstImageRange &other)
 
DefaultConstImageRangeoperator= (const DefaultConstImageRange &other)
 
 ~DefaultConstImageRange ()
 
bool isValid () const
 
ConstIterator begin () const
 
ConstIterator begin (const Point &aPoint) const
 
ConstIterator end () const
 
ConstReverseIterator rbegin () const
 
ConstReverseIterator rbegin (const Point &aPoint) const
 
ConstReverseIterator rend () const
 

Private Attributes

const TImage * myImagePtr
 

Detailed Description

template<typename TImage>
class DGtal::DefaultConstImageRange< TImage >

Aim: model of CConstBidirectionalRangeFromPoint that adapts the domain of an image in order to iterate over the values associated to its domain points (in a read-only as well as a write-only manner).

Template Parameters
TImagea model of CConstImage mapping points to values

NB: the underlying image is stored as an aliasing pointer in order to avoid copies. As a consequence the pointed object must exist and must not be deleted during the use of any instance of this class.

Definition at line 76 of file DefaultConstImageRange.h.

Member Typedef Documentation

template<typename TImage>
typedef ConstIteratorAdapter<typename Domain::ConstIterator,TImage,Value> DGtal::DefaultConstImageRange< TImage >::ConstIterator

Definition at line 90 of file DefaultConstImageRange.h.

template<typename TImage>
typedef std::reverse_iterator<ConstIterator> DGtal::DefaultConstImageRange< TImage >::ConstReverseIterator

Definition at line 91 of file DefaultConstImageRange.h.

template<typename TImage>
typedef TImage::Domain DGtal::DefaultConstImageRange< TImage >::Domain

Definition at line 84 of file DefaultConstImageRange.h.

template<typename TImage>
typedef TImage::Point DGtal::DefaultConstImageRange< TImage >::Point

Definition at line 85 of file DefaultConstImageRange.h.

template<typename TImage>
typedef TImage::Value DGtal::DefaultConstImageRange< TImage >::Value

Definition at line 86 of file DefaultConstImageRange.h.

Constructor & Destructor Documentation

template<typename TImage>
DGtal::DefaultConstImageRange< TImage >::DefaultConstImageRange ( ConstAlias< TImage >  aImage)
inline

Standard constructor from an image.

Parameters
aImageany image.

Definition at line 100 of file DefaultConstImageRange.h.

101  : myImagePtr(&aImage) {}
template<typename TImage>
DGtal::DefaultConstImageRange< TImage >::DefaultConstImageRange ( const DefaultConstImageRange< TImage > &  other)
inline

Copy constructor.

Parameters
otherthe iterator to clone.

Definition at line 107 of file DefaultConstImageRange.h.

108  : myImagePtr(other.myImagePtr) {}
template<typename TImage>
DGtal::DefaultConstImageRange< TImage >::~DefaultConstImageRange ( )
inline

Destructor. Does nothing.

Definition at line 127 of file DefaultConstImageRange.h.

127 {}

Member Function Documentation

template<typename TImage>
ConstIterator DGtal::DefaultConstImageRange< TImage >::begin ( ) const
inline

Iterator service.

Returns
begin iterator

Definition at line 151 of file DefaultConstImageRange.h.

References DGtal::DefaultConstImageRange< TImage >::myImagePtr.

Referenced by DGtal::DefaultConstImageRange< TImage >::rend().

151  {
152  Domain d = myImagePtr->domain();
153  return ConstIterator( d.begin(), *myImagePtr );
154  }
ConstIteratorAdapter< typename Domain::ConstIterator, TImage, Value > ConstIterator
template<typename TImage>
ConstIterator DGtal::DefaultConstImageRange< TImage >::begin ( const Point aPoint) const
inline

Iterator service.

Parameters
aPointany point
Returns
begin iterator

Definition at line 161 of file DefaultConstImageRange.h.

References DGtal::DefaultConstImageRange< TImage >::myImagePtr.

161  {
162  Domain d = myImagePtr->domain();
163  return ConstIterator( d.begin(aPoint), *myImagePtr );
164  }
ConstIteratorAdapter< typename Domain::ConstIterator, TImage, Value > ConstIterator
template<typename TImage>
DGtal::DefaultConstImageRange< TImage >::BOOST_CONCEPT_ASSERT ( (concepts::CTrivialConstImage< TImage >)  )
template<typename TImage>
DGtal::DefaultConstImageRange< TImage >::BOOST_CONCEPT_ASSERT ( (concepts::CDomain< Domain >)  )

constant iterator types

template<typename TImage>
ConstIterator DGtal::DefaultConstImageRange< TImage >::end ( ) const
inline

Iterator service.

Returns
end iterator

Definition at line 170 of file DefaultConstImageRange.h.

References DGtal::DefaultConstImageRange< TImage >::myImagePtr.

Referenced by DGtal::DefaultConstImageRange< TImage >::rbegin().

170  {
171  Domain d = myImagePtr->domain();
172  return ConstIterator( d.end(), *myImagePtr );
173  }
ConstIteratorAdapter< typename Domain::ConstIterator, TImage, Value > ConstIterator
template<typename TImage>
bool DGtal::DefaultConstImageRange< TImage >::isValid ( ) const
inline

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.

Definition at line 133 of file DefaultConstImageRange.h.

133 { return true; }
template<typename TImage>
DefaultConstImageRange& DGtal::DefaultConstImageRange< TImage >::operator= ( const DefaultConstImageRange< TImage > &  other)
inline

Assignment.

Parameters
otherthe iterator to copy.
Returns
a reference on 'this'.

Definition at line 115 of file DefaultConstImageRange.h.

References DGtal::DefaultConstImageRange< TImage >::myImagePtr.

116  {
117  if ( this != &other )
118  {
119  myImagePtr = other.myImagePtr;
120  }
121  return *this;
122  }
template<typename TImage>
ConstReverseIterator DGtal::DefaultConstImageRange< TImage >::rbegin ( ) const
inline

Iterator service.

Returns
rbegin iterator

Definition at line 179 of file DefaultConstImageRange.h.

References DGtal::DefaultConstImageRange< TImage >::end().

179  {
180  return ConstReverseIterator(this->end());
181  }
std::reverse_iterator< ConstIterator > ConstReverseIterator
template<typename TImage>
ConstReverseIterator DGtal::DefaultConstImageRange< TImage >::rbegin ( const Point aPoint) const
inline

Iterator service.

Parameters
aPointany point
Returns
rbegin iterator

Definition at line 188 of file DefaultConstImageRange.h.

188  {
189  Domain d = myImagePtr->domain();
190  typename Domain::ConstIterator itOnPts = d.begin(aPoint);
191  if ( itOnPts != d.end() ) ++itOnPts;
192  ConstIterator itOnVals( itOnPts, *myImagePtr );
193  return ConstReverseIterator( itOnVals );
194  }
std::reverse_iterator< ConstIterator > ConstReverseIterator
template<typename TImage>
ConstReverseIterator DGtal::DefaultConstImageRange< TImage >::rend ( ) const
inline

Iterator service.

Returns
rend iterator

Definition at line 200 of file DefaultConstImageRange.h.

References DGtal::DefaultConstImageRange< TImage >::begin().

200  {
201  return ConstReverseIterator(this->begin());
202  }
std::reverse_iterator< ConstIterator > ConstReverseIterator

Field Documentation

template<typename TImage>
const TImage* DGtal::DefaultConstImageRange< TImage >::myImagePtr
private

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