DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Private Attributes
DGtal::Composer< TFunctor1, TFunctor2, ReturnType > Class Template Reference

#include <BasicFunctors.h>

Public Member Functions

 Composer ()
 Composer (const TFunctor1 &aF1, const TFunctor2 &aF2)
 Composer (const Composer &other)
Composeroperator= (const Composer &other)
template<typename TInput >
ReturnType operator() (const TInput &aInput) const

Private Attributes

const TFunctor1 * myF1
const TFunctor2 * myF2

Detailed Description

template<typename TFunctor1, typename TFunctor2, typename ReturnType>
class DGtal::Composer< TFunctor1, TFunctor2, ReturnType >

Aim: Define a new Functor from the composition of two other functors.

Description of template class 'Composer'

Template Parameters:
TFunctor1first functor
TFunctor2second functor
ReturnType

Definition at line 203 of file BasicFunctors.h.


Constructor & Destructor Documentation

template<typename TFunctor1, typename TFunctor2, typename ReturnType>
DGtal::Composer< TFunctor1, TFunctor2, ReturnType >::Composer ( )
inline

Default constructor

Definition at line 209 of file BasicFunctors.h.

: myF1(NULL), myF2(NULL) {}
template<typename TFunctor1, typename TFunctor2, typename ReturnType>
DGtal::Composer< TFunctor1, TFunctor2, ReturnType >::Composer ( const TFunctor1 &  aF1,
const TFunctor2 &  aF2 
)
inline

Constructor

Parameters:
aF1any Functor
aF2any Functor

Definition at line 215 of file BasicFunctors.h.

: myF1(&aF1), myF2(&aF2) {}
template<typename TFunctor1, typename TFunctor2, typename ReturnType>
DGtal::Composer< TFunctor1, TFunctor2, ReturnType >::Composer ( const Composer< TFunctor1, TFunctor2, ReturnType > &  other)
inline

Copy Operator

Parameters:
otherobject to copy

Definition at line 220 of file BasicFunctors.h.

: myF1(other.myF1), myF2(other.myF2) {}

Member Function Documentation

template<typename TFunctor1, typename TFunctor2, typename ReturnType>
template<typename TInput >
ReturnType DGtal::Composer< TFunctor1, TFunctor2, ReturnType >::operator() ( const TInput &  aInput) const
inline

Operator ()

NB: myF2 return type should be equal to (or implicitly castable into) ReturnType

Returns:
object of type ReturnType coming from the composition myF1 o myF2 on aInput, ie. myF2 ( myF1 ( aInput ) )
Template Parameters:
TInputtype of the input value

Definition at line 251 of file BasicFunctors.h.

References DGtal::Composer< TFunctor1, TFunctor2, ReturnType >::myF1, and DGtal::Composer< TFunctor1, TFunctor2, ReturnType >::myF2.

{
ASSERT( myF1 );
ASSERT( myF2 );
return myF2->operator()( myF1->operator()( aInput ) );
}
template<typename TFunctor1, typename TFunctor2, typename ReturnType>
Composer& DGtal::Composer< TFunctor1, TFunctor2, ReturnType >::operator= ( const Composer< TFunctor1, TFunctor2, ReturnType > &  other)
inline

Assignement Operator

Parameters:
otherobject to copy

Definition at line 226 of file BasicFunctors.h.

References DGtal::Composer< TFunctor1, TFunctor2, ReturnType >::myF1, and DGtal::Composer< TFunctor1, TFunctor2, ReturnType >::myF2.

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

Field Documentation

template<typename TFunctor1, typename TFunctor2, typename ReturnType>
const TFunctor1* DGtal::Composer< TFunctor1, TFunctor2, ReturnType >::myF1
private
template<typename TFunctor1, typename TFunctor2, typename ReturnType>
const TFunctor2* DGtal::Composer< TFunctor1, TFunctor2, ReturnType >::myF2
private

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