DGtal  0.9.3beta
Public Types | Public Member Functions | Private Attributes
DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue > Class Template Reference

#include <DGtal/base/OutputIteratorAdapter.h>

Inheritance diagram for DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >:
[legend]
Collaboration diagram for DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >:
[legend]

Public Types

typedef TIterator Iterator
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((boost::ForwardIterator< Iterator >))
 
 BOOST_CONCEPT_ASSERT ((concepts::CUnaryFunctor< TFunctor, typename std::iterator_traits< Iterator >::value_type &, TInputValue & >))
 
 OutputIteratorAdapter (const Iterator &it, ConstAlias< TFunctor > f)
 
 OutputIteratorAdapter (const OutputIteratorAdapter &other)
 
 ~OutputIteratorAdapter ()
 
OutputIteratorAdapteroperator= (const TInputValue &aValue)
 
OutputIteratorAdapteroperator* ()
 
OutputIteratorAdapteroperator++ ()
 
OutputIteratorAdapter operator++ (int)
 

Private Attributes

Iterator myIt
 
const TFunctor * myF
 

Detailed Description

template<typename TIterator, typename TFunctor, typename TInputValue>
class DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >

Aim: Adapts an output iterator i with a unary functor f, both given at construction, so that the element pointed to by i is updated with a given value through f.

Description of template class 'OutputIteratorAdapter'

Template Parameters
TIteratoran output iterator
TInputValueany input value
TFunctora unary functor with reference on the element type as argument type and reference on the the input value type as return type

Definition at line 75 of file OutputIteratorAdapter.h.

Member Typedef Documentation

template<typename TIterator , typename TFunctor , typename TInputValue >
typedef TIterator DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::Iterator

Definition at line 82 of file OutputIteratorAdapter.h.

Constructor & Destructor Documentation

template<typename TIterator , typename TFunctor , typename TInputValue >
DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::OutputIteratorAdapter ( const Iterator it,
ConstAlias< TFunctor >  f 
)
inline

Constructor.

Parameters
itany iterator
fany functor

Definition at line 94 of file OutputIteratorAdapter.h.

template<typename TIterator , typename TFunctor , typename TInputValue >
DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::OutputIteratorAdapter ( const OutputIteratorAdapter< TIterator, TFunctor, TInputValue > &  other)
inline

Copy constructor.

Parameters
otherthe object to clone.

Definition at line 101 of file OutputIteratorAdapter.h.

102  : myIt(other.myIt), myF(other.myF) {}
template<typename TIterator , typename TFunctor , typename TInputValue >
DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::~OutputIteratorAdapter ( )
inline

Destructor.

Definition at line 107 of file OutputIteratorAdapter.h.

107 {}

Member Function Documentation

template<typename TIterator , typename TFunctor , typename TInputValue >
DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::BOOST_CONCEPT_ASSERT ( (boost::ForwardIterator< Iterator >)  )
template<typename TIterator , typename TFunctor , typename TInputValue >
DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::BOOST_CONCEPT_ASSERT ( (concepts::CUnaryFunctor< TFunctor, typename std::iterator_traits< Iterator >::value_type &, TInputValue & >)  )
template<typename TIterator , typename TFunctor , typename TInputValue >
OutputIteratorAdapter& DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::operator* ( )
inline

Dereference operator

Returns
a reference to *this

Definition at line 127 of file OutputIteratorAdapter.h.

127 { return *this; }
template<typename TIterator , typename TFunctor , typename TInputValue >
OutputIteratorAdapter& DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::operator++ ( )
inline

Pre-increment operator

Returns
a reference to *this

Definition at line 133 of file OutputIteratorAdapter.h.

References DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::myIt.

133 { ++myIt; return *this; }
template<typename TIterator , typename TFunctor , typename TInputValue >
OutputIteratorAdapter DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::operator++ ( int  )
inline

Post-increment operator

Returns
*this

Definition at line 139 of file OutputIteratorAdapter.h.

References DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::myIt.

140  {
141  OutputIteratorAdapter tmp = *this;
142  ++myIt;
143  return tmp;
144  }
OutputIteratorAdapter(const Iterator &it, ConstAlias< TFunctor > f)
template<typename TIterator , typename TFunctor , typename TInputValue >
OutputIteratorAdapter& DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::operator= ( const TInputValue &  aValue)
inline

Assignment

Parameters
aValueany value
Returns
a reference to *this

Definition at line 117 of file OutputIteratorAdapter.h.

References DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::myF.

118  {
119  myF->operator()( *myIt ) = aValue;
120  return *this;
121  }

Field Documentation

template<typename TIterator , typename TFunctor , typename TInputValue >
const TFunctor* DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::myF
private

Aliasing pointer on the underlying functor

Definition at line 163 of file OutputIteratorAdapter.h.

Referenced by DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::operator=().

template<typename TIterator , typename TFunctor , typename TInputValue >
Iterator DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::myIt
private

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