vigra - FunctorTraits< T > Class Template Reference

[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

| FunctorTraits< T > Class Template Reference Functors |

Export associated information for a functor. More...

`#include <vigra/functortraits.hxx>`

Inherits FunctorTraitsBase< T >.

## Detailed Description

### template<class T>
class vigra::FunctorTraits< T >

Export associated information for a functor.

The FunctorTraits class contains the following fields:

template <class T>
struct FunctorTraits
{
typedef T type;
typedef ... isInitializer;
typedef ... isUnaryFunctor;
typedef ... isBinaryFunctor;
typedef ... isTernaryFunctor;
typedef ... isUnaryAnalyser;
typedef ... isBinaryAnalyser;
typedef ... isTernaryAnalyser;
};

where the dots are either `VigraTrueType` or `VigraFalseType` depending on whether the functor supports the respective functionality or not. Note that these traits are automatically defined correctly when your functor is derived from the appropriate functor tag classes:

struct InitializerTag {};
struct UnaryFunctorTag {};
struct BinaryFunctorTag {};
struct TernaryFunctorTag {};
struct UnaryAnalyserTag {};
struct BinaryAnalyserTag {};
struct TernaryAnalyserTag {};
struct UnaryReduceFunctorTag : public InitializerTag, public UnaryAnalyserTag {};
struct BinaryReduceFunctorTag : public InitializerTag, public BinaryAnalyserTag {};

If a functor `f` is a model of these categories, it supports the following calls (`v` is a variable such that the result type of the functor calls can be converted into `v`'s type, and `a1, a2, a3` are variables convertible into the functor's argument types):

Initializer
  `v = f()` (used with initImageWithFunctor())
UnaryFunctor
  `v = f(a1)` (used with transformImage())
BinaryFunctor
  `v = f(a1, a2)` (used with combineTwoImages())
TernaryFunctor
  `v = f(a1, a2, a3)` (used with combineThreeImages())
UnaryAnalyser
  `f(a1)` (return type `void`, used with inspectImage())
BinaryAnalyser
  `f(a1, a2)` (return type `void`, used with inspectTwoImages())
TernaryAnalyser
  `f(a1, a2, a3)` (return type `void`)

It should be noted that the functor's argument and result types are not contained in the traits class: Since the function calls are often member template functions in VIGRA, many functors do not have fixed argument types. Neither are the result types fixed in this case because they are computed (via a template meta-program) from the argument types.

#include <vigra/functortraits.hxx>
Namespace: vigra

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

- vigra/functortraits.hxx

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python vigra 1.11.1 (Fri May 19 2017)