DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes
DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue > Class Template Reference

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. More...

#include <DGtal/base/OutputIteratorAdapter.h>

Inheritance diagram for DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >:

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

◆ Iterator

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

◆ OutputIteratorAdapter() [1/2]

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.

◆ OutputIteratorAdapter() [2/2]

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) {}

◆ ~OutputIteratorAdapter()

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

◆ BOOST_CONCEPT_ASSERT() [1/2]

template<typename TIterator , typename TFunctor , typename TInputValue >
DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::BOOST_CONCEPT_ASSERT ( (boost::ForwardIterator< Iterator >)  )

◆ BOOST_CONCEPT_ASSERT() [2/2]

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 & >)  )

◆ operator*()

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; }

◆ operator++() [1/2]

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.

133{ ++myIt; return *this; }

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

◆ operator++() [2/2]

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.

140 {
141 OutputIteratorAdapter tmp = *this;
142 ++myIt;
143 return tmp;
144 }
OutputIteratorAdapter(const Iterator &it, ConstAlias< TFunctor > f)

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

◆ operator=()

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.

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

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

Field Documentation

◆ myF

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=().

◆ myIt

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: