Orxonox: src/core/Functor.h File Reference

# Functor.h File Reference

`#include "CorePrereqs.h"`
`#include "util/Debug.h"`
`#include "util/MultiType.h"`
`#include "util/StringUtils.h"`

## Namespaces

namespace | orxonox
namespace | orxonox::FunctionType

## Classes

class | orxonox::Functor
class | orxonox::FunctorMember< T >
class | orxonox::FunctorStatic

## Defines

#define | CREATE_ALL_MEMBER_FUNCTORS()
#define | CREATE_ALL_STATIC_FUNCTORS()
#define | CREATE_MEMBER_FUNCTOR(returnvalue, numparams)
#define | CREATE_STATIC_FUNCTOR(returnvalue, numparams)
#define | CreateTypeToStringTemplate(type)
#define | FUNCTOR_EVALUATE_PARAM(numparams) FUNCTOR_EVALUATE_PARAM##numparams
#define | FUNCTOR_EVALUATE_PARAM0
#define | FUNCTOR_EVALUATE_PARAM1 if (index == 0) { param.convert<P1>(); }
#define | FUNCTOR_EVALUATE_PARAM2
#define | FUNCTOR_EVALUATE_PARAM3
#define | FUNCTOR_EVALUATE_PARAM4
#define | FUNCTOR_EVALUATE_PARAM5
#define | FUNCTOR_FUNCTION_CALL(numparams) FUNCTOR_FUNCTION_CALL##numparams
#define | FUNCTOR_FUNCTION_CALL0
#define | FUNCTOR_FUNCTION_CALL1 param1
#define | FUNCTOR_FUNCTION_CALL2 param1, param2
#define | FUNCTOR_FUNCTION_CALL3 param1, param2, param3
#define | FUNCTOR_FUNCTION_CALL4 param1, param2, param3, param4
#define | FUNCTOR_FUNCTION_CALL5 param1, param2, param3, param4, param5
#define | FUNCTOR_FUNCTION_PARAMS(numparams) FUNCTOR_FUNCTION_PARAMS##numparams
#define | FUNCTOR_FUNCTION_PARAMS0
#define | FUNCTOR_FUNCTION_PARAMS1 P1 param1
#define | FUNCTOR_FUNCTION_PARAMS2 P1 param1, P2 param2
#define | FUNCTOR_FUNCTION_PARAMS3 P1 param1, P2 param2, P3 param3
#define | FUNCTOR_FUNCTION_PARAMS4 P1 param1, P2 param2, P3 param3, P4 param4
#define | FUNCTOR_FUNCTION_PARAMS5 P1 param1, P2 param2, P3 param3, P4 param4, P5 param5
#define | FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) FUNCTOR_FUNCTION_RETURNVALUE##returnvalue
#define | FUNCTOR_FUNCTION_RETURNVALUE0 void
#define | FUNCTOR_FUNCTION_RETURNVALUE1 R
#define | FUNCTOR_STORE_RETURNVALUE(returnvalue, functioncall) FUNCTOR_STORE_RETURNVALUE##returnvalue(functioncall)
#define | FUNCTOR_STORE_RETURNVALUE0(functioncall) functioncall
#define | FUNCTOR_STORE_RETURNVALUE1(functioncall) this->returnedValue_ = functioncall
#define | FUNCTOR_TEMPLATE(ismember, returnvalue, numparams) FUNCTOR_TEMPLATE##ismember##returnvalue##numparams
#define | FUNCTOR_TEMPLATE000
#define | FUNCTOR_TEMPLATE001 template <class P1>
#define | FUNCTOR_TEMPLATE002 template <class P1, class P2>
#define | FUNCTOR_TEMPLATE003 template <class P1, class P2, class P3>
#define | FUNCTOR_TEMPLATE004 template <class P1, class P2, class P3, class P4>
#define | FUNCTOR_TEMPLATE005 template <class P1, class P2, class P3, class P4, class P5>
#define | FUNCTOR_TEMPLATE010 template <class R>
#define | FUNCTOR_TEMPLATE011 template <class R, class P1>
#define | FUNCTOR_TEMPLATE012 template <class R, class P1, class P2>
#define | FUNCTOR_TEMPLATE013 template <class R, class P1, class P2, class P3>
#define | FUNCTOR_TEMPLATE014 template <class R, class P1, class P2, class P3, class P4>
#define | FUNCTOR_TEMPLATE015 template <class R, class P1, class P2, class P3, class P4, class P5>
#define | FUNCTOR_TEMPLATE100 template <class T>
#define | FUNCTOR_TEMPLATE101 template <class T, class P1>
#define | FUNCTOR_TEMPLATE102 template <class T, class P1, class P2>
#define | FUNCTOR_TEMPLATE103 template <class T, class P1, class P2, class P3>
#define | FUNCTOR_TEMPLATE104 template <class T, class P1, class P2, class P3, class P4>
#define | FUNCTOR_TEMPLATE105 template <class T, class P1, class P2, class P3, class P4, class P5>
#define | FUNCTOR_TEMPLATE110 template <class T, class R>
#define | FUNCTOR_TEMPLATE111 template <class T, class R, class P1>
#define | FUNCTOR_TEMPLATE112 template <class T, class R, class P1, class P2>
#define | FUNCTOR_TEMPLATE113 template <class T, class R, class P1, class P2, class P3>
#define | FUNCTOR_TEMPLATE114 template <class T, class R, class P1, class P2, class P3, class P4>
#define | FUNCTOR_TEMPLATE115 template <class T, class R, class P1, class P2, class P3, class P4, class P5>
#define | FUNCTOR_TEMPLATE_CLASSES(ismember, returnvalue, numparams) FUNCTOR_TEMPLATE_CLASSES##ismember##returnvalue##numparams
#define | FUNCTOR_TEMPLATE_CLASSES000
#define | FUNCTOR_TEMPLATE_CLASSES001 <P1>
#define | FUNCTOR_TEMPLATE_CLASSES002 <P1, P2>
#define | FUNCTOR_TEMPLATE_CLASSES003 <P1, P2, P3>
#define | FUNCTOR_TEMPLATE_CLASSES004 <P1, P2, P3, P4>
#define | FUNCTOR_TEMPLATE_CLASSES005 <P1, P2, P3, P4, P5>
#define | FUNCTOR_TEMPLATE_CLASSES010 <R>
#define | FUNCTOR_TEMPLATE_CLASSES011 <R, P1>
#define | FUNCTOR_TEMPLATE_CLASSES012 <R, P1, P2>
#define | FUNCTOR_TEMPLATE_CLASSES013 <R, P1, P2, P3>
#define | FUNCTOR_TEMPLATE_CLASSES014 <R, P1, P2, P3, P4>
#define | FUNCTOR_TEMPLATE_CLASSES015 <R, P1, P2, P3, P4, P5>
#define | FUNCTOR_TEMPLATE_CLASSES100 <T>
#define | FUNCTOR_TEMPLATE_CLASSES101 <T, P1>
#define | FUNCTOR_TEMPLATE_CLASSES102 <T, P1, P2>
#define | FUNCTOR_TEMPLATE_CLASSES103 <T, P1, P2, P3>
#define | FUNCTOR_TEMPLATE_CLASSES104 <T, P1, P2, P3, P4>
#define | FUNCTOR_TEMPLATE_CLASSES105 <T, P1, P2, P3, P4, P5>
#define | FUNCTOR_TEMPLATE_CLASSES110 <T, R>
#define | FUNCTOR_TEMPLATE_CLASSES111 <T, R, P1>
#define | FUNCTOR_TEMPLATE_CLASSES112 <T, R, P1, P2>
#define | FUNCTOR_TEMPLATE_CLASSES113 <T, R, P1, P2, P3>
#define | FUNCTOR_TEMPLATE_CLASSES114 <T, R, P1, P2, P3, P4>
#define | FUNCTOR_TEMPLATE_CLASSES115 <T, R, P1, P2, P3, P4, P5>
#define | FUNCTOR_TYPENAME_PARAMS(numparams) FUNCTOR_TYPENAME_PARAMS##numparams
#define | FUNCTOR_TYPENAME_PARAMS0
#define | FUNCTOR_TYPENAME_PARAMS1 this->typeParam_[0] = typeToString<P1>();
#define | FUNCTOR_TYPENAME_PARAMS2 this->typeParam_[0] = typeToString<P1>(); this->typeParam_[1] = typeToString<P2>();
#define | FUNCTOR_TYPENAME_PARAMS3 this->typeParam_[0] = typeToString<P1>(); this->typeParam_[1] = typeToString<P2>(); this->typeParam_[2] = typeToString<P3>();
#define | FUNCTOR_TYPENAME_PARAMS4 this->typeParam_[0] = typeToString<P1>(); this->typeParam_[1] = typeToString<P2>(); this->typeParam_[2] = typeToString<P3>(); this->typeParam_[3] = typeToString<P4>();
#define | FUNCTOR_TYPENAME_PARAMS5 this->typeParam_[0] = typeToString<P1>(); this->typeParam_[1] = typeToString<P2>(); this->typeParam_[2] = typeToString<P3>(); this->typeParam_[3] = typeToString<P4>(); this->typeParam_[4] = typeToString<P5>();
#define | FUNCTOR_TYPENAME_RETURN(returnvalue) FUNCTOR_TYPENAME_RETURN##returnvalue
#define | FUNCTOR_TYPENAME_RETURN0
#define | FUNCTOR_TYPENAME_RETURN1 this->typeReturnvalue_ = typeToString<R>();

## Enumerations

enum | orxonox::FunctionType::Value { orxonox::FunctionType::Member, orxonox::FunctionType::ConstMember, orxonox::FunctionType::Static }

## Functions

| orxonox::CREATE_ALL_MEMBER_FUNCTORS ()
| orxonox::CREATE_ALL_STATIC_FUNCTORS ()
| orxonox::CreateTypeToStringTemplate (Degree)
| orxonox::CreateTypeToStringTemplate (Radian)
| orxonox::CreateTypeToStringTemplate (ColourValue)
| orxonox::CreateTypeToStringTemplate (Quaternion)
| orxonox::CreateTypeToStringTemplate (Vector3)
| orxonox::CreateTypeToStringTemplate (Vector2)
| orxonox::CreateTypeToStringTemplate (bool)
| orxonox::CreateTypeToStringTemplate (long double)
| orxonox::CreateTypeToStringTemplate (double)
| orxonox::CreateTypeToStringTemplate (float)
| orxonox::CreateTypeToStringTemplate (unsigned long long)
| orxonox::CreateTypeToStringTemplate (long)
| orxonox::CreateTypeToStringTemplate (short)
| orxonox::CreateTypeToStringTemplate (char)
| orxonox::CreateTypeToStringTemplate (unsigned int)
| orxonox::CreateTypeToStringTemplate (int)
template<class T>
std::string | orxonox::typeToString ()
template<>
std::string | orxonox::typeToString< const std::string & > ()
template<>
std::string | orxonox::typeToString< const std::string > ()
template<>
std::string | orxonox::typeToString< std::string & > ()
template<>
std::string | orxonox::typeToString< std::string > ()

## Variables

const unsigned int | orxonox::MAX_FUNCTOR_ARGUMENTS = 5

## Define Documentation

#define CREATE_ALL_MEMBER_FUNCTORS | ( |  | ) |

Value:

    CREATE_MEMBER_FUNCTOR(0, 0); \
        CREATE_MEMBER_FUNCTOR(0, 1); \
        CREATE_MEMBER_FUNCTOR(0, 2); \
        CREATE_MEMBER_FUNCTOR(0, 3); \
        CREATE_MEMBER_FUNCTOR(0, 4); \
        CREATE_MEMBER_FUNCTOR(0, 5); \
        CREATE_MEMBER_FUNCTOR(1, 0); \
        CREATE_MEMBER_FUNCTOR(1, 1); \
        CREATE_MEMBER_FUNCTOR(1, 2); \
        CREATE_MEMBER_FUNCTOR(1, 3); \
        CREATE_MEMBER_FUNCTOR(1, 4); \
        CREATE_MEMBER_FUNCTOR(1, 5)

#define CREATE_ALL_STATIC_FUNCTORS | ( |  | ) |

Value:

    CREATE_STATIC_FUNCTOR(0, 0); \
        CREATE_STATIC_FUNCTOR(0, 1); \
        CREATE_STATIC_FUNCTOR(0, 2); \
        CREATE_STATIC_FUNCTOR(0, 3); \
        CREATE_STATIC_FUNCTOR(0, 4); \
        CREATE_STATIC_FUNCTOR(0, 5); \
        CREATE_STATIC_FUNCTOR(1, 0); \
        CREATE_STATIC_FUNCTOR(1, 1); \
        CREATE_STATIC_FUNCTOR(1, 2); \
        CREATE_STATIC_FUNCTOR(1, 3); \
        CREATE_STATIC_FUNCTOR(1, 4); \
        CREATE_STATIC_FUNCTOR(1, 5)

#define CREATE_MEMBER_FUNCTOR | ( | returnvalue,
|  | numparams |  | ) |

#define CREATE_STATIC_FUNCTOR | ( | returnvalue,
|  | numparams |  | ) |

#define CreateTypeToStringTemplate | ( | type |  | ) |

Value:

    template <> \
        inline std::string typeToString<type>() { return #type; } \
        template <> \
        inline std::string typeToString<type&>() { return #type; } \
        template <> \
        inline std::string typeToString<const type>() { return #type; } \
        template <> \
        inline std::string typeToString<const type&>() { return #type; }

#define FUNCTOR_EVALUATE_PARAM | ( | numparams |  | ) | FUNCTOR_EVALUATE_PARAM##numparams

#define FUNCTOR_EVALUATE_PARAM0

#define FUNCTOR_EVALUATE_PARAM1 if (index == 0) { param.convert<P1>(); }

#define FUNCTOR_EVALUATE_PARAM2

Value:

    if (index == 0) { param.convert<P1>(); } \
        else if (index == 1) { param.convert<P2>(); }

#define FUNCTOR_EVALUATE_PARAM3

Value:

    if (index == 0) { param.convert<P1>(); } \
        else if (index == 1) { param.convert<P2>(); } \
        else if (index == 2) { param.convert<P3>(); }

#define FUNCTOR_EVALUATE_PARAM4

Value:

    if (index == 0) { param.convert<P1>(); } \
        else if (index == 1) { param.convert<P2>(); } \
        else if (index == 2) { param.convert<P3>(); } \
        else if (index == 3) { param.convert<P4>(); }

#define FUNCTOR_EVALUATE_PARAM5

Value:

    if (index == 0) { param.convert<P1>(); } \
        else if (index == 1) { param.convert<P2>(); } \
        else if (index == 2) { param.convert<P3>(); } \
        else if (index == 3) { param.convert<P4>(); } \
        else if (index == 4) { param.convert<P5>(); }

#define FUNCTOR_FUNCTION_CALL | ( | numparams |  | ) | FUNCTOR_FUNCTION_CALL##numparams

#define FUNCTOR_FUNCTION_CALL0

#define FUNCTOR_FUNCTION_CALL1 param1

#define FUNCTOR_FUNCTION_CALL2 param1, param2

#define FUNCTOR_FUNCTION_CALL3 param1, param2, param3

#define FUNCTOR_FUNCTION_CALL4 param1, param2, param3, param4

#define FUNCTOR_FUNCTION_CALL5 param1, param2, param3, param4, param5

#define FUNCTOR_FUNCTION_PARAMS | ( | numparams |  | ) | FUNCTOR_FUNCTION_PARAMS##numparams

#define FUNCTOR_FUNCTION_PARAMS0

#define FUNCTOR_FUNCTION_PARAMS1 P1 param1

#define FUNCTOR_FUNCTION_PARAMS2 P1 param1, P2 param2

#define FUNCTOR_FUNCTION_PARAMS3 P1 param1, P2 param2, P3 param3

#define FUNCTOR_FUNCTION_PARAMS4 P1 param1, P2 param2, P3 param3, P4 param4

#define FUNCTOR_FUNCTION_PARAMS5 P1 param1, P2 param2, P3 param3, P4 param4, P5 param5

#define FUNCTOR_FUNCTION_RETURNVALUE | ( | returnvalue |  | ) | FUNCTOR_FUNCTION_RETURNVALUE##returnvalue

#define FUNCTOR_FUNCTION_RETURNVALUE0 void

#define FUNCTOR_FUNCTION_RETURNVALUE1 R

#define FUNCTOR_STORE_RETURNVALUE | ( | returnvalue,
|  | functioncall |  | ) | FUNCTOR_STORE_RETURNVALUE##returnvalue(functioncall)

#define FUNCTOR_STORE_RETURNVALUE0 | ( | functioncall |  | ) | functioncall

#define FUNCTOR_STORE_RETURNVALUE1 | ( | functioncall |  | ) | this->returnedValue_ = functioncall

#define FUNCTOR_TEMPLATE | ( | ismember,
|  | returnvalue,
|  | numparams |  | ) | FUNCTOR_TEMPLATE##ismember##returnvalue##numparams

#define FUNCTOR_TEMPLATE000

#define FUNCTOR_TEMPLATE001 template <class P1>

#define FUNCTOR_TEMPLATE002 template <class P1, class P2>

#define FUNCTOR_TEMPLATE003 template <class P1, class P2, class P3>

#define FUNCTOR_TEMPLATE004 template <class P1, class P2, class P3, class P4>

#define FUNCTOR_TEMPLATE005 template <class P1, class P2, class P3, class P4, class P5>

#define FUNCTOR_TEMPLATE010 template <class R>

#define FUNCTOR_TEMPLATE011 template <class R, class P1>

#define FUNCTOR_TEMPLATE012 template <class R, class P1, class P2>

#define FUNCTOR_TEMPLATE013 template <class R, class P1, class P2, class P3>

#define FUNCTOR_TEMPLATE014 template <class R, class P1, class P2, class P3, class P4>

#define FUNCTOR_TEMPLATE015 template <class R, class P1, class P2, class P3, class P4, class P5>

#define FUNCTOR_TEMPLATE100 template <class T>

#define FUNCTOR_TEMPLATE101 template <class T, class P1>

#define FUNCTOR_TEMPLATE102 template <class T, class P1, class P2>

#define FUNCTOR_TEMPLATE103 template <class T, class P1, class P2, class P3>

#define FUNCTOR_TEMPLATE104 template <class T, class P1, class P2, class P3, class P4>

#define FUNCTOR_TEMPLATE105 template <class T, class P1, class P2, class P3, class P4, class P5>

#define FUNCTOR_TEMPLATE110 template <class T, class R>

#define FUNCTOR_TEMPLATE111 template <class T, class R, class P1>

#define FUNCTOR_TEMPLATE112 template <class T, class R, class P1, class P2>

#define FUNCTOR_TEMPLATE113 template <class T, class R, class P1, class P2, class P3>

#define FUNCTOR_TEMPLATE114 template <class T, class R, class P1, class P2, class P3, class P4>

#define FUNCTOR_TEMPLATE115 template <class T, class R, class P1, class P2, class P3, class P4, class P5>

#define FUNCTOR_TEMPLATE_CLASSES | ( | ismember,
|  | returnvalue,
|  | numparams |  | ) | FUNCTOR_TEMPLATE_CLASSES##ismember##returnvalue##numparams

#define FUNCTOR_TEMPLATE_CLASSES000

#define FUNCTOR_TEMPLATE_CLASSES001 <P1>

#define FUNCTOR_TEMPLATE_CLASSES002 <P1, P2>

#define FUNCTOR_TEMPLATE_CLASSES003 <P1, P2, P3>

#define FUNCTOR_TEMPLATE_CLASSES004 <P1, P2, P3, P4>

#define FUNCTOR_TEMPLATE_CLASSES005 <P1, P2, P3, P4, P5>

#define FUNCTOR_TEMPLATE_CLASSES010 <R>

#define FUNCTOR_TEMPLATE_CLASSES011 <R, P1>

#define FUNCTOR_TEMPLATE_CLASSES012 <R, P1, P2>

#define FUNCTOR_TEMPLATE_CLASSES013 <R, P1, P2, P3>

#define FUNCTOR_TEMPLATE_CLASSES014 <R, P1, P2, P3, P4>

#define FUNCTOR_TEMPLATE_CLASSES015 <R, P1, P2, P3, P4, P5>

#define FUNCTOR_TEMPLATE_CLASSES100 <T>

#define FUNCTOR_TEMPLATE_CLASSES101 <T, P1>

#define FUNCTOR_TEMPLATE_CLASSES102 <T, P1, P2>

#define FUNCTOR_TEMPLATE_CLASSES103 <T, P1, P2, P3>

#define FUNCTOR_TEMPLATE_CLASSES104 <T, P1, P2, P3, P4>

#define FUNCTOR_TEMPLATE_CLASSES105 <T, P1, P2, P3, P4, P5>

#define FUNCTOR_TEMPLATE_CLASSES110 <T, R>

#define FUNCTOR_TEMPLATE_CLASSES111 <T, R, P1>

#define FUNCTOR_TEMPLATE_CLASSES112 <T, R, P1, P2>

#define FUNCTOR_TEMPLATE_CLASSES113 <T, R, P1, P2, P3>

#define FUNCTOR_TEMPLATE_CLASSES114 <T, R, P1, P2, P3, P4>

#define FUNCTOR_TEMPLATE_CLASSES115 <T, R, P1, P2, P3, P4, P5>

#define FUNCTOR_TYPENAME_PARAMS | ( | numparams |  | ) | FUNCTOR_TYPENAME_PARAMS##numparams

#define FUNCTOR_TYPENAME_PARAMS0

#define FUNCTOR_TYPENAME_PARAMS1 this->typeParam_[0] = typeToString<P1>();

#define FUNCTOR_TYPENAME_PARAMS2 this->typeParam_[0] = typeToString<P1>(); this->typeParam_[1] = typeToString<P2>();

#define FUNCTOR_TYPENAME_PARAMS3 this->typeParam_[0] = typeToString<P1>(); this->typeParam_[1] = typeToString<P2>(); this->typeParam_[2] = typeToString<P3>();

#define FUNCTOR_TYPENAME_PARAMS4 this->typeParam_[0] = typeToString<P1>(); this->typeParam_[1] = typeToString<P2>(); this->typeParam_[2] = typeToString<P3>(); this->typeParam_[3] = typeToString<P4>();

#define FUNCTOR_TYPENAME_PARAMS5 this->typeParam_[0] = typeToString<P1>(); this->typeParam_[1] = typeToString<P2>(); this->typeParam_[2] = typeToString<P3>(); this->typeParam_[3] = typeToString<P4>(); this->typeParam_[4] = typeToString<P5>();

#define FUNCTOR_TYPENAME_RETURN | ( | returnvalue |  | ) | FUNCTOR_TYPENAME_RETURN##returnvalue

#define FUNCTOR_TYPENAME_RETURN0

#define FUNCTOR_TYPENAME_RETURN1 this->typeReturnvalue_ = typeToString<R>();