DGtal  1.5.beta
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>

Public Types

using iterator_category = std::output_iterator_tag
 
using value_type = void
 
using difference_type = void
 
using pointer = void
 
using reference = void
 
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

◆ difference_type

template<typename TIterator , typename TFunctor , typename TInputValue >
using DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::difference_type = void

Definition at line 83 of file OutputIteratorAdapter.h.

◆ Iterator

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

Definition at line 89 of file OutputIteratorAdapter.h.

◆ iterator_category

template<typename TIterator , typename TFunctor , typename TInputValue >
using DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::iterator_category = std::output_iterator_tag

Definition at line 81 of file OutputIteratorAdapter.h.

◆ pointer

template<typename TIterator , typename TFunctor , typename TInputValue >
using DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::pointer = void

Definition at line 84 of file OutputIteratorAdapter.h.

◆ reference

template<typename TIterator , typename TFunctor , typename TInputValue >
using DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::reference = void

Definition at line 85 of file OutputIteratorAdapter.h.

◆ value_type

template<typename TIterator , typename TFunctor , typename TInputValue >
using DGtal::OutputIteratorAdapter< TIterator, TFunctor, TInputValue >::value_type = void

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 101 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 108 of file OutputIteratorAdapter.h.

109  : 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 114 of file OutputIteratorAdapter.h.

114 {}

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 134 of file OutputIteratorAdapter.h.

134 { 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 140 of file OutputIteratorAdapter.h.

140 { ++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 146 of file OutputIteratorAdapter.h.

147  {
148  OutputIteratorAdapter tmp = *this;
149  ++myIt;
150  return tmp;
151  }
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 124 of file OutputIteratorAdapter.h.

125  {
126  myF->operator()( *myIt ) = aValue;
127  return *this;
128  }

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 170 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: