DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Private Member Functions
DGtal::IteratorAdapter< TIterator, TFunctor, TReturnType > Class Template Reference

#include <IteratorAdapter.h>

Public Types

typedef IteratorAdapter
< TIterator, TFunctor,
TReturnType > 
Self
typedef
boost::transform_iterator
< TFunctor, TIterator,
TReturnType &, TReturnType > 
Parent

Public Member Functions

 IteratorAdapter ()
 IteratorAdapter (const TIterator &iter, TFunctor func)
 IteratorAdapter (const Self &other)
 IteratorAdapter (const Parent &other)
Selfoperator= (const Self &other)
Selfoperator= (const Parent &other)
 ~IteratorAdapter ()

Private Member Functions

 BOOST_CONCEPT_ASSERT ((boost_concepts::LvalueIteratorConcept< TIterator >))

Detailed Description

template<typename TIterator, typename TFunctor, typename TReturnType = typename TFunctor::Value>
class DGtal::IteratorAdapter< TIterator, TFunctor, TReturnType >

This class adapts any lvalue iterator so that operator* returns a member on the element pointed to by the iterator, instead the element itself.

Description of template class 'IteratorAdapter'

Template Parameters:
TIteratorthe type of the iterator to adapt

To achieve this goal, the adapter is based on a functor f given at construction so that operator* calls f(<em>it), instead of calling directly operator of the underlying iterator it. This operation returns a reference (or constant reference) on a member of the element pointed to by the iterator, which can be read as well as assigned (if the member is not constant).

Template Parameters:
TFunctorthe type of functor that transforms the pointed element into another one
TReturnTypethe type of the element returned by the underlying functor

Definition at line 76 of file IteratorAdapter.h.


Member Typedef Documentation

template<typename TIterator , typename TFunctor , typename TReturnType = typename TFunctor::Value>
typedef boost::transform_iterator< TFunctor, TIterator, TReturnType&, TReturnType > DGtal::IteratorAdapter< TIterator, TFunctor, TReturnType >::Parent

parent class

Definition at line 87 of file IteratorAdapter.h.

template<typename TIterator , typename TFunctor , typename TReturnType = typename TFunctor::Value>
typedef IteratorAdapter< TIterator, TFunctor, TReturnType > DGtal::IteratorAdapter< TIterator, TFunctor, TReturnType >::Self

this class

Definition at line 85 of file IteratorAdapter.h.


Constructor & Destructor Documentation

template<typename TIterator , typename TFunctor , typename TReturnType = typename TFunctor::Value>
DGtal::IteratorAdapter< TIterator, TFunctor, TReturnType >::IteratorAdapter ( )
inline

Default constructor

Definition at line 92 of file IteratorAdapter.h.

: Parent() {}
template<typename TIterator , typename TFunctor , typename TReturnType = typename TFunctor::Value>
DGtal::IteratorAdapter< TIterator, TFunctor, TReturnType >::IteratorAdapter ( const TIterator &  iter,
TFunctor  func 
)
inline

Constructor from an iterator and a functor

Parameters:
iterany iterator
functorany functor

Definition at line 99 of file IteratorAdapter.h.

: Parent(iter,func) {}
template<typename TIterator , typename TFunctor , typename TReturnType = typename TFunctor::Value>
DGtal::IteratorAdapter< TIterator, TFunctor, TReturnType >::IteratorAdapter ( const Self other)
inline

Copy operator

Parameters:
otherthe object of type Self to copy.

Definition at line 105 of file IteratorAdapter.h.

: Parent( static_cast<const Parent&>(other) ) {}
template<typename TIterator , typename TFunctor , typename TReturnType = typename TFunctor::Value>
DGtal::IteratorAdapter< TIterator, TFunctor, TReturnType >::IteratorAdapter ( const Parent other)
inline

Copy operator

Parameters:
otherthe object of type Parent to copy.

Definition at line 111 of file IteratorAdapter.h.

: Parent(other) {}
template<typename TIterator , typename TFunctor , typename TReturnType = typename TFunctor::Value>
DGtal::IteratorAdapter< TIterator, TFunctor, TReturnType >::~IteratorAdapter ( )
inline

Destructor.

Definition at line 140 of file IteratorAdapter.h.

{}

Member Function Documentation

template<typename TIterator , typename TFunctor , typename TReturnType = typename TFunctor::Value>
DGtal::IteratorAdapter< TIterator, TFunctor, TReturnType >::BOOST_CONCEPT_ASSERT ( (boost_concepts::LvalueIteratorConcept< TIterator >)  )
private
template<typename TIterator , typename TFunctor , typename TReturnType = typename TFunctor::Value>
Self& DGtal::IteratorAdapter< TIterator, TFunctor, TReturnType >::operator= ( const Self other)
inline

Assignement operator

Parameters:
otherthe object of type Self to copy.
Returns:
this

Definition at line 118 of file IteratorAdapter.h.

Referenced by DGtal::IteratorAdapter< TIterator, TFunctor, TReturnType >::operator=().

{
if (this != &other)
Parent::operator=( static_cast<const Parent&>(other) );
return *this;
}
template<typename TIterator , typename TFunctor , typename TReturnType = typename TFunctor::Value>
Self& DGtal::IteratorAdapter< TIterator, TFunctor, TReturnType >::operator= ( const Parent other)
inline

Assignement operator

Parameters:
otherthe object of type Parent to copy.
Returns:
this

Definition at line 130 of file IteratorAdapter.h.

References DGtal::IteratorAdapter< TIterator, TFunctor, TReturnType >::operator=().

{
if (this != &other)
return *this;
}

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