Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7212


Ignore:
Timestamp:
Aug 24, 2010, 4:56:37 PM (14 years ago)
Author:
landauf
Message:

re-implemented Functor - without macros!

Location:
code/branches/consolecommands3/src/libraries
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/consolecommands3/src/libraries/core/CorePrereqs.h

    r7204 r7212  
    200200    class ExecutorStatic;
    201201    class Functor;
    202     template <class T>
     202    template <class O>
    203203    class FunctorMember;
    204     class FunctorStatic;
     204    typedef FunctorMember<void> FunctorStatic;
     205    template <class F, class O>
     206    class FunctorPointer;
    205207    class IOConsole;
    206208    class IRC;
  • code/branches/consolecommands3/src/libraries/core/XMLPort.h

    r7204 r7212  
    110110*/
    111111#define XMLPortParamTemplate(classname, paramname, loadfunction, savefunction, xmlelement, mode, ...) \
    112     static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \
     112    static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<void, classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \
    113113    static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \
    114114    XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, classname, this, paramname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode)
     
    135135*/
    136136#define XMLPortParamLoadOnlyTemplate(classname, paramname, loadfunction, xmlelement, mode, ...) \
    137     static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##0##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \
     137    static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##0##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<void, classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \
    138138    XMLPortParamGeneric(xmlcontainer##loadfunction##0, classname, classname, this, paramname, xmlcontainer##loadfunction##0##loadexecutor, 0, xmlelement, mode)
    139139
     
    168168*/
    169169#define XMLPortParamExternTemplate(classname, externclass, object, paramname, loadfunction, savefunction, xmlelement, mode, ...) \
    170     static ExecutorMemberPtr<externclass> xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<externclass, __VA_ARGS__ >(&externclass::loadfunction), std::string( #externclass ) + "::" + #loadfunction); \
     170    static ExecutorMemberPtr<externclass> xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<void, externclass, __VA_ARGS__ >(&externclass::loadfunction), std::string( #externclass ) + "::" + #loadfunction); \
    171171    static ExecutorMemberPtr<externclass> xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&externclass::savefunction), std::string( #externclass ) + "::" + #savefunction); \
    172172    XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, externclass, object, paramname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode);
     
    256256*/
    257257#define XMLPortObjectExtendedTemplate(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, bApplyLoaderMask, bLoadBefore, ...) \
    258     static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \
     258    static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<void, classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \
    259259    static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \
    260260    XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode, bApplyLoaderMask, bLoadBefore)
     
    274274*/
    275275#define XMLPortObjectTemplate(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, ...) \
    276     static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \
     276    static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<void, classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \
    277277    static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \
    278278    XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode, false, true)
  • code/branches/consolecommands3/src/libraries/core/command/Executor.cc

    r7202 r7212  
    6767            {
    6868                COUT(5) << "Calling Executor " << this->name_ << " through parser with one parameter, using whole string: " << params << std::endl;
    69                 return (*this->functor_)(MultiType(params));
     69                return (*this->functor_)(params);
    7070            }
    7171            else if (!this->defaultValue_[0].null())
  • code/branches/consolecommands3/src/libraries/core/command/Executor.h

    r7203 r7212  
    163163            MultiType parse(T* object, const std::string& params, bool* success = 0, const std::string& delimiter = " ") const
    164164            {
    165                 const typename FunctorMember<T>::Objects& objects = this->functorMember_->getObjects();
     165                T* oldobject = this->functorMember_->getObject();
    166166
    167167                this->functorMember_->setObject(object);
    168168                const MultiType& result = this->Executor::parse(params, success, delimiter);
    169                 this->functorMember_->setObjects(objects);
     169                this->functorMember_->setObject(oldobject);
    170170
    171171                return result;
     
    174174            MultiType parse(const T* object, const std::string& params, bool* success = 0, const std::string& delimiter = " ") const
    175175            {
    176                 const typename FunctorMember<T>::Objects& objects = this->functorMember_->getObjects();
     176                T* oldobject = this->functorMember_->getObject();
    177177
    178178                this->functorMember_->setObject(object);
    179179                const MultiType& result = this->Executor::parse(params, success, delimiter);
    180                 this->functorMember_->setObjects(objects);
     180                this->functorMember_->setObjects(oldobject);
    181181
    182182                return result;
  • code/branches/consolecommands3/src/libraries/core/command/Functor.h

    r7203 r7212  
    2525 *      ...
    2626 *
    27  *   Inspiration: Functor by Benjamin Grauer
    2827 */
    2928
     
    4544
    4645    template <class T>
    47     inline std::string typeToString() { return "unknown"; }
    48 
    49 #define CreateTypeToStringTemplate(type) \
    50     template <> \
    51     inline std::string typeToString<type>() { return #type; } \
    52     template <> \
    53     inline std::string typeToString<type&>() { return #type; } \
    54     template <> \
    55     inline std::string typeToString<const type>() { return #type; } \
    56     template <> \
    57     inline std::string typeToString<const type&>() { return #type; }
    58 
    59     CreateTypeToStringTemplate(int);
    60     CreateTypeToStringTemplate(unsigned int);
    61     CreateTypeToStringTemplate(char);
    62     CreateTypeToStringTemplate(unsigned char);
    63     CreateTypeToStringTemplate(short);
    64     CreateTypeToStringTemplate(unsigned short);
    65     CreateTypeToStringTemplate(long);
    66     CreateTypeToStringTemplate(unsigned long);
    67     CreateTypeToStringTemplate(long long);
    68     CreateTypeToStringTemplate(unsigned long long);
    69     CreateTypeToStringTemplate(float);
    70     CreateTypeToStringTemplate(double);
    71     CreateTypeToStringTemplate(long double);
    72     CreateTypeToStringTemplate(bool);
    73     CreateTypeToStringTemplate(Vector2);
    74     CreateTypeToStringTemplate(Vector3);
    75     CreateTypeToStringTemplate(Quaternion);
    76     CreateTypeToStringTemplate(ColourValue);
    77     CreateTypeToStringTemplate(Radian);
    78     CreateTypeToStringTemplate(Degree);
    79 
    80     template <>
    81     inline std::string typeToString<std::string>() { return "string"; }
    82     template <>
    83     inline std::string typeToString<std::string&>() { return "string"; }
    84     template <>
    85     inline std::string typeToString<const std::string>() { return "string"; }
    86     template <>
    87     inline std::string typeToString<const std::string&>() { return "string"; }
     46    inline std::string _typeToString() { return "unknown"; }
     47
     48    template <> inline std::string _typeToString<void>()               { return ""; }
     49    template <> inline std::string _typeToString<int>()                { return "int"; }
     50    template <> inline std::string _typeToString<unsigned int>()       { return "uint"; }
     51    template <> inline std::string _typeToString<char>()               { return "char"; }
     52    template <> inline std::string _typeToString<unsigned char>()      { return "uchar"; }
     53    template <> inline std::string _typeToString<short>()              { return "short"; }
     54    template <> inline std::string _typeToString<unsigned short>()     { return "ushort"; }
     55    template <> inline std::string _typeToString<long>()               { return "long"; }
     56    template <> inline std::string _typeToString<unsigned long>()      { return "ulong"; }
     57    template <> inline std::string _typeToString<long long>()          { return "longlong"; }
     58    template <> inline std::string _typeToString<unsigned long long>() { return "ulonglong"; }
     59    template <> inline std::string _typeToString<float>()              { return "float"; }
     60    template <> inline std::string _typeToString<double>()             { return "double"; }
     61    template <> inline std::string _typeToString<long double>()        { return "longdouble"; }
     62    template <> inline std::string _typeToString<bool>()               { return "bool"; }
     63    template <> inline std::string _typeToString<std::string>()        { return "string"; }
     64    template <> inline std::string _typeToString<Vector2>()            { return "Vector2"; }
     65    template <> inline std::string _typeToString<Vector3>()            { return "Vector3"; }
     66    template <> inline std::string _typeToString<Quaternion>()         { return "Quaternion"; }
     67    template <> inline std::string _typeToString<ColourValue>()        { return "ColourValue"; }
     68    template <> inline std::string _typeToString<Radian>()             { return "Radian"; }
     69    template <> inline std::string _typeToString<Degree>()             { return "Degree"; }
     70
     71    template <class T>
     72    inline std::string typeToString() { return _typeToString<typename Loki::TypeTraits<T>::UnqualifiedReferredType>(); }
    8873
    8974    class _CoreExport Functor
     
    9479                enum Enum
    9580                {
    96                     Member,
    97                     ConstMember,
    9881                    Static,
    99                     Lua
     82                    Member
    10083                };
    10184            };
    10285
    10386        public:
    104             Functor() {}
    105             virtual ~Functor() {}
    106 
    10787            virtual MultiType operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) = 0;
    10888
     
    11999            virtual void* getRawObjectPointer() const { return 0; }
    120100
     101            template <class F>
     102            inline bool setFunction(F* function)
     103            {
     104                if (this->getFullIdentifier() == typeid(F*))
     105                {
     106                    modifyFunctor(this, function);
     107                    return true;
     108                }
     109                return false;
     110            }
     111
     112            virtual const std::type_info& getFullIdentifier() const = 0;
    121113            virtual const std::type_info& getHeaderIdentifier() const = 0;
    122114    };
    123115
    124     class _CoreExport FunctorStatic : public Functor
    125     {
    126         public:
    127             virtual ~FunctorStatic() {}
    128             virtual MultiType operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) = 0;
    129     };
    130 
    131     template <class T>
     116    template <class O>
    132117    class FunctorMember : public Functor
    133118    {
    134119        public:
    135             FunctorMember()
    136             {
    137                 this->object_ = 0;
    138                 this->constObject_ = 0;
    139             }
    140             virtual ~FunctorMember() {}
    141 
    142             virtual MultiType operator()(T* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) = 0;
    143             virtual MultiType operator()(const T* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) = 0;
    144 
    145             virtual MultiType operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null)
     120            FunctorMember(O* object = 0) : object_(object) {}
     121
     122            virtual MultiType operator()(O* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) = 0;
     123
     124            MultiType operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null)
    146125            {
    147126                if (this->object_)
    148127                    return (*this)(this->object_, param1, param2, param3, param4, param5);
    149                 else if (this->constObject_)
    150                     return (*this)(this->constObject_, param1, param2, param3, param4, param5);
    151128                else
    152129                {
    153                     COUT(1) << "An error occurred in Functor.h:" << std::endl;
    154                     COUT(1) << "Error: No object set." << std::endl;
     130                    COUT(1) << "Error: Can't execute FunctorMember, no object set." << std::endl;
    155131                    return MT_Type::Null;
    156132                }
    157133            }
    158134
    159             inline FunctorMember<T>* setObject(T* object)
    160             {
    161                 this->object_ = object;
    162                 this->constObject_ = 0;
    163                 return this;
    164             }
    165 
    166             inline FunctorMember<T>* setObject(const T* object)
    167             {
    168                 this->object_ = 0;
    169                 this->constObject_ = object;
    170                 return this;
    171             }
    172 
    173             void setRawObjectPointer(void* object)
    174             {
    175                 this->object_ = (T*)object;
    176                 this->constObject_ = 0;
    177             }
    178 
    179             void* getRawObjectPointer() const
    180             {
    181                 if (this->object_)
    182                     return (void*)this->object_;
    183                 else
    184                     return (void*)this->constObject_;
    185             }
    186 
    187             typedef std::pair<T*, const T*> Objects;
    188 
    189             inline Objects getObjects() const
    190             {
    191                 return Objects(this->object_, this->constObject_);
    192             }
    193 
    194             inline void setObjects(const Objects& objects)
    195             {
    196                 this->object_ = objects.first;
    197                 this->constObject_ = objects.second;
    198             }
    199 
    200         private:
    201             T* object_;
    202             const T* constObject_;
    203     };
    204 
    205 
    206 
    207     template <class R, class P1, class P2, class P3, class P4, class P5>
    208     struct FunctorHeaderIdentifier {};
    209 
    210 
    211 
    212     inline const FunctorPtr& createFunctor(const FunctorPtr& functor)
    213     {
    214         return functor;
     135            Functor::Type::Enum getType() const
     136                { return Functor::Type::Member; }
     137
     138            inline void setObject(O* object)
     139                { this->object_ = object;}
     140            inline O* getObject() const
     141                { return this->object_; }
     142
     143            inline void setRawObjectPointer(void* object)
     144                { this->object_ = (O*)object; }
     145            inline void* getRawObjectPointer() const
     146                { return this->object_; }
     147
     148        protected:
     149            O* object_;
     150    };
     151
     152    template <>
     153    class _CoreExport FunctorMember<void> : public Functor
     154    {
     155        public:
     156            FunctorMember(void* = 0) {}
     157
     158            virtual MultiType operator()(void* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) = 0;
     159
     160            MultiType operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null)
     161            {
     162                return (*this)(0, param1, param2, param3, param4, param5);
     163            }
     164
     165            Functor::Type::Enum getType() const
     166                { return Functor::Type::Static; }
     167    };
     168
     169    typedef FunctorMember<void> FunctorStatic;
     170
     171    template <class F, class O>
     172    class FunctorPointer : public FunctorMember<O>
     173    {
     174        public:
     175            FunctorPointer(F functionPointer, O* object = 0) : FunctorMember<O>(object), functionPointer_(functionPointer) {}
     176
     177            inline void setFunction(F functionPointer)
     178                { this->functionPointer_ = functionPointer; }
     179            inline F getFunction() const
     180                { return this->functionPointer_; }
     181
     182            const std::type_info& getFullIdentifier() const
     183                { return typeid(F); }
     184
     185        protected:
     186            F functionPointer_;
     187    };
     188
     189    namespace detail
     190    {
     191        template <class R, class O, bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctionPointer                                            { typedef R (O::*Type)(P1, P2, P3, P4, P5); };
     192        template <class R, class O, class P1, class P2, class P3, class P4, class P5>               struct FunctionPointer<R, O, false, P1, P2, P3, P4, P5>           { typedef R (O::*Type)(P1, P2, P3, P4, P5); };
     193        template <class R, class O, class P1, class P2, class P3, class P4>                         struct FunctionPointer<R, O, false, P1, P2, P3, P4, void>         { typedef R (O::*Type)(P1, P2, P3, P4); };
     194        template <class R, class O, class P1, class P2, class P3>                                   struct FunctionPointer<R, O, false, P1, P2, P3, void, void>       { typedef R (O::*Type)(P1, P2, P3); };
     195        template <class R, class O, class P1, class P2>                                             struct FunctionPointer<R, O, false, P1, P2, void, void, void>     { typedef R (O::*Type)(P1, P2); };
     196        template <class R, class O, class P1>                                                       struct FunctionPointer<R, O, false, P1, void, void, void, void>   { typedef R (O::*Type)(P1); };
     197        template <class R, class O>                                                                 struct FunctionPointer<R, O, false, void, void, void, void, void> { typedef R (O::*Type)(); };
     198        template <class R, class O, class P1, class P2, class P3, class P4, class P5> struct FunctionPointer<R, O, true, P1, P2, P3, P4, P5>           { typedef R (O::*Type)(P1, P2, P3, P4, P5) const; };
     199        template <class R, class O, class P1, class P2, class P3, class P4>           struct FunctionPointer<R, O, true, P1, P2, P3, P4, void>         { typedef R (O::*Type)(P1, P2, P3, P4) const; };
     200        template <class R, class O, class P1, class P2, class P3>                     struct FunctionPointer<R, O, true, P1, P2, P3, void, void>       { typedef R (O::*Type)(P1, P2, P3) const; };
     201        template <class R, class O, class P1, class P2>                               struct FunctionPointer<R, O, true, P1, P2, void, void, void>     { typedef R (O::*Type)(P1, P2) const; };
     202        template <class R, class O, class P1>                                         struct FunctionPointer<R, O, true, P1, void, void, void, void>   { typedef R (O::*Type)(P1) const; };
     203        template <class R, class O>                                                   struct FunctionPointer<R, O, true, void, void, void, void, void> { typedef R (O::*Type)() const; };
     204        template <class R, class P1, class P2, class P3, class P4, class P5> struct FunctionPointer<R, void, false, P1, P2, P3, P4, P5>           { typedef R (*Type)(P1, P2, P3, P4, P5); };
     205        template <class R, class P1, class P2, class P3, class P4>           struct FunctionPointer<R, void, false, P1, P2, P3, P4, void>         { typedef R (*Type)(P1, P2, P3, P4); };
     206        template <class R, class P1, class P2, class P3>                     struct FunctionPointer<R, void, false, P1, P2, P3, void, void>       { typedef R (*Type)(P1, P2, P3); };
     207        template <class R, class P1, class P2>                               struct FunctionPointer<R, void, false, P1, P2, void, void, void>     { typedef R (*Type)(P1, P2); };
     208        template <class R, class P1>                                         struct FunctionPointer<R, void, false, P1, void, void, void, void>   { typedef R (*Type)(P1); };
     209        template <class R>                                                   struct FunctionPointer<R, void, false, void, void, void, void, void> { typedef R (*Type)(); };
     210
     211        template <class R, class O, bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctorCaller                                              { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, P4, P5>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (object->*functionPointer)(param1, param2, param3, param4, param5); } };
     212        template <class R, class O, bool isconst, class P1, class P2, class P3, class P4>           struct FunctorCaller<R, O, isconst, P1, P2, P3, P4, void>         { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, P4, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (object->*functionPointer)(param1, param2, param3, param4); } };
     213        template <class R, class O, bool isconst, class P1, class P2, class P3>                     struct FunctorCaller<R, O, isconst, P1, P2, P3, void, void>       { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (object->*functionPointer)(param1, param2, param3); } };
     214        template <class R, class O, bool isconst, class P1, class P2>                               struct FunctorCaller<R, O, isconst, P1, P2, void, void, void>     { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, P2, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (object->*functionPointer)(param1, param2); } };
     215        template <class R, class O, bool isconst, class P1>                                         struct FunctorCaller<R, O, isconst, P1, void, void, void, void>   { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, void, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (object->*functionPointer)(param1); } };
     216        template <class R, class O, bool isconst>                                                   struct FunctorCaller<R, O, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, void, void, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (object->*functionPointer)(); } };
     217        template <class O, bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctorCaller<void, O, isconst, P1, P2, P3, P4, P5>           { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, P3, P4, P5>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (object->*functionPointer)(param1, param2, param3, param4, param5); return MT_Type::Null; } };
     218        template <class O, bool isconst, class P1, class P2, class P3, class P4>           struct FunctorCaller<void, O, isconst, P1, P2, P3, P4, void>         { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, P3, P4, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (object->*functionPointer)(param1, param2, param3, param4); return MT_Type::Null; } };
     219        template <class O, bool isconst, class P1, class P2, class P3>                     struct FunctorCaller<void, O, isconst, P1, P2, P3, void, void>       { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, P3, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (object->*functionPointer)(param1, param2, param3); return MT_Type::Null; } };
     220        template <class O, bool isconst, class P1, class P2>                               struct FunctorCaller<void, O, isconst, P1, P2, void, void, void>     { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (object->*functionPointer)(param1, param2); return MT_Type::Null; } };
     221        template <class O, bool isconst, class P1>                                         struct FunctorCaller<void, O, isconst, P1, void, void, void, void>   { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, void, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (object->*functionPointer)(param1); return MT_Type::Null; } };
     222        template <class O, bool isconst>                                                   struct FunctorCaller<void, O, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, void, void, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (object->*functionPointer)(); return MT_Type::Null; } };
     223        template <class R, bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctorCaller<R, void, isconst, P1, P2, P3, P4, P5>           { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, P2, P3, P4, P5>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (*functionPointer)(param1, param2, param3, param4, param5); } };
     224        template <class R, bool isconst, class P1, class P2, class P3, class P4>           struct FunctorCaller<R, void, isconst, P1, P2, P3, P4, void>         { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, P2, P3, P4, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (*functionPointer)(param1, param2, param3, param4); } };
     225        template <class R, bool isconst, class P1, class P2, class P3>                     struct FunctorCaller<R, void, isconst, P1, P2, P3, void, void>       { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, P2, P3, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (*functionPointer)(param1, param2, param3); } };
     226        template <class R, bool isconst, class P1, class P2>                               struct FunctorCaller<R, void, isconst, P1, P2, void, void, void>     { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, P2, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (*functionPointer)(param1, param2); } };
     227        template <class R, bool isconst, class P1>                                         struct FunctorCaller<R, void, isconst, P1, void, void, void, void>   { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, void, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (*functionPointer)(param1); } };
     228        template <class R, bool isconst>                                                   struct FunctorCaller<R, void, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, void, void, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (*functionPointer)(); } };
     229        template <bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctorCaller<void, void, isconst, P1, P2, P3, P4, P5>           { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, P3, P4, P5>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (*functionPointer)(param1, param2, param3, param4, param5); return MT_Type::Null; } };
     230        template <bool isconst, class P1, class P2, class P3, class P4>           struct FunctorCaller<void, void, isconst, P1, P2, P3, P4, void>         { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, P3, P4, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (*functionPointer)(param1, param2, param3, param4); return MT_Type::Null; } };
     231        template <bool isconst, class P1, class P2, class P3>                     struct FunctorCaller<void, void, isconst, P1, P2, P3, void, void>       { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, P3, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (*functionPointer)(param1, param2, param3); return MT_Type::Null; } };
     232        template <bool isconst, class P1, class P2>                               struct FunctorCaller<void, void, isconst, P1, P2, void, void, void>     { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (*functionPointer)(param1, param2); return MT_Type::Null; } };
     233        template <bool isconst, class P1>                                         struct FunctorCaller<void, void, isconst, P1, void, void, void, void>   { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, void, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (*functionPointer)(param1); return MT_Type::Null; } };
     234        template <bool isconst>                                                   struct FunctorCaller<void, void, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, void, void, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (*functionPointer)(); return MT_Type::Null; } };
     235
     236        template <class R, class P1, class P2, class P3, class P4, class P5>
     237        struct FunctorHeaderIdentifier
     238        {};
     239
     240        template <typename T>
     241        struct FunctorHasReturnvalue
     242        { enum { result = true }; };
     243        template <>
     244        struct FunctorHasReturnvalue<void>
     245        { enum { result = false }; };
     246
     247        template <class P1, class P2, class P3, class P4, class P5>
     248        struct FunctorParamCount
     249        { enum { result = 5 }; };
     250        template <class P1, class P2, class P3, class P4>
     251        struct FunctorParamCount<P1, P2, P3, P4, void>
     252        { enum { result = 4 }; };
     253        template <class P1, class P2, class P3>
     254        struct FunctorParamCount<P1, P2, P3, void, void>
     255        { enum { result = 3 }; };
     256        template <class P1, class P2>
     257        struct FunctorParamCount<P1, P2, void, void, void>
     258        { enum { result = 2 }; };
     259        template <class P1>
     260        struct FunctorParamCount<P1, void, void, void, void>
     261        { enum { result = 1 }; };
     262        template <>
     263        struct FunctorParamCount<void, void, void, void, void>
     264        { enum { result = 0 }; };
    215265    }
    216266
    217 
    218 
    219 #define FUNCTOR_TEMPLATE(ismember, returnvalue, numparams, additionalobject) FUNCTOR_TEMPLATE##ismember##returnvalue##numparams(additionalobject)
    220 #define FUNCTOR_TEMPLATE000(additionalobject)
    221 #define FUNCTOR_TEMPLATE001(additionalobject) template <class P1>
    222 #define FUNCTOR_TEMPLATE002(additionalobject) template <class P1, class P2>
    223 #define FUNCTOR_TEMPLATE003(additionalobject) template <class P1, class P2, class P3>
    224 #define FUNCTOR_TEMPLATE004(additionalobject) template <class P1, class P2, class P3, class P4>
    225 #define FUNCTOR_TEMPLATE005(additionalobject) template <class P1, class P2, class P3, class P4, class P5>
    226 #define FUNCTOR_TEMPLATE010(additionalobject) template <class R>
    227 #define FUNCTOR_TEMPLATE011(additionalobject) template <class R, class P1>
    228 #define FUNCTOR_TEMPLATE012(additionalobject) template <class R, class P1, class P2>
    229 #define FUNCTOR_TEMPLATE013(additionalobject) template <class R, class P1, class P2, class P3>
    230 #define FUNCTOR_TEMPLATE014(additionalobject) template <class R, class P1, class P2, class P3, class P4>
    231 #define FUNCTOR_TEMPLATE015(additionalobject) template <class R, class P1, class P2, class P3, class P4, class P5>
    232 #define FUNCTOR_TEMPLATE100(additionalobject) template <class T FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) >
    233 #define FUNCTOR_TEMPLATE101(additionalobject) template <class T, class P1 FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) >
    234 #define FUNCTOR_TEMPLATE102(additionalobject) template <class T, class P1, class P2 FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) >
    235 #define FUNCTOR_TEMPLATE103(additionalobject) template <class T, class P1, class P2, class P3 FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) >
    236 #define FUNCTOR_TEMPLATE104(additionalobject) template <class T, class P1, class P2, class P3, class P4 FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) >
    237 #define FUNCTOR_TEMPLATE105(additionalobject) template <class T, class P1, class P2, class P3, class P4, class P5 FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) >
    238 #define FUNCTOR_TEMPLATE110(additionalobject) template <class T, class R FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) >
    239 #define FUNCTOR_TEMPLATE111(additionalobject) template <class T, class R, class P1 FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) >
    240 #define FUNCTOR_TEMPLATE112(additionalobject) template <class T, class R, class P1, class P2 FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) >
    241 #define FUNCTOR_TEMPLATE113(additionalobject) template <class T, class R, class P1, class P2, class P3 FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) >
    242 #define FUNCTOR_TEMPLATE114(additionalobject) template <class T, class R, class P1, class P2, class P3, class P4 FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) >
    243 #define FUNCTOR_TEMPLATE115(additionalobject) template <class T, class R, class P1, class P2, class P3, class P4, class P5 FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) >
    244 
    245 
    246 
    247 #define FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT##additionalobject
    248 #define FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT0
    249 #define FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT1 , class O
    250 
    251 
    252 
    253 #define FUNCTOR_TEMPLATE_CLASSES(ismember, returnvalue, numparams) FUNCTOR_TEMPLATE_CLASSES##ismember##returnvalue##numparams
    254 #define FUNCTOR_TEMPLATE_CLASSES000
    255 #define FUNCTOR_TEMPLATE_CLASSES001 <P1>
    256 #define FUNCTOR_TEMPLATE_CLASSES002 <P1, P2>
    257 #define FUNCTOR_TEMPLATE_CLASSES003 <P1, P2, P3>
    258 #define FUNCTOR_TEMPLATE_CLASSES004 <P1, P2, P3, P4>
    259 #define FUNCTOR_TEMPLATE_CLASSES005 <P1, P2, P3, P4, P5>
    260 #define FUNCTOR_TEMPLATE_CLASSES010 <R>
    261 #define FUNCTOR_TEMPLATE_CLASSES011 <R, P1>
    262 #define FUNCTOR_TEMPLATE_CLASSES012 <R, P1, P2>
    263 #define FUNCTOR_TEMPLATE_CLASSES013 <R, P1, P2, P3>
    264 #define FUNCTOR_TEMPLATE_CLASSES014 <R, P1, P2, P3, P4>
    265 #define FUNCTOR_TEMPLATE_CLASSES015 <R, P1, P2, P3, P4, P5>
    266 #define FUNCTOR_TEMPLATE_CLASSES100 <T>
    267 #define FUNCTOR_TEMPLATE_CLASSES101 <T, P1>
    268 #define FUNCTOR_TEMPLATE_CLASSES102 <T, P1, P2>
    269 #define FUNCTOR_TEMPLATE_CLASSES103 <T, P1, P2, P3>
    270 #define FUNCTOR_TEMPLATE_CLASSES104 <T, P1, P2, P3, P4>
    271 #define FUNCTOR_TEMPLATE_CLASSES105 <T, P1, P2, P3, P4, P5>
    272 #define FUNCTOR_TEMPLATE_CLASSES110 <T, R>
    273 #define FUNCTOR_TEMPLATE_CLASSES111 <T, R, P1>
    274 #define FUNCTOR_TEMPLATE_CLASSES112 <T, R, P1, P2>
    275 #define FUNCTOR_TEMPLATE_CLASSES113 <T, R, P1, P2, P3>
    276 #define FUNCTOR_TEMPLATE_CLASSES114 <T, R, P1, P2, P3, P4>
    277 #define FUNCTOR_TEMPLATE_CLASSES115 <T, R, P1, P2, P3, P4, P5>
    278 
    279 
    280 
    281 #define FUNCTOR_TYPENAME_PARAM(numparams) FUNCTOR_TYPENAME_PARAM##numparams
    282 #define FUNCTOR_TYPENAME_PARAM0 \
    283     return BLANKSTRING
    284 #define FUNCTOR_TYPENAME_PARAM1 \
    285     if (param == 0) { return typeToString<P1>(); } \
    286     else { return BLANKSTRING; }
    287 #define FUNCTOR_TYPENAME_PARAM2 \
    288     if (param == 0) { return typeToString<P1>(); } \
    289     else if (param == 1) { return typeToString<P2>(); } \
    290     else { return BLANKSTRING; }
    291 #define FUNCTOR_TYPENAME_PARAM3 \
    292     if (param == 0) { return typeToString<P1>(); } \
    293     else if (param == 1) { return typeToString<P2>(); } \
    294     else if (param == 2) { return typeToString<P3>(); } \
    295     else { return BLANKSTRING; }
    296 #define FUNCTOR_TYPENAME_PARAM4 \
    297     if (param == 0) { return typeToString<P1>(); } \
    298     else if (param == 1) { return typeToString<P2>(); } \
    299     else if (param == 2) { return typeToString<P3>(); } \
    300     else if (param == 3) { return typeToString<P4>(); } \
    301     else { return BLANKSTRING; }
    302 #define FUNCTOR_TYPENAME_PARAM5 \
    303     if (param == 0) { return typeToString<P1>(); } \
    304     else if (param == 1) { return typeToString<P2>(); } \
    305     else if (param == 2) { return typeToString<P3>(); } \
    306     else if (param == 3) { return typeToString<P4>(); } \
    307     else if (param == 4) { return typeToString<P5>(); } \
    308     else { return BLANKSTRING; }
    309 
    310 #define FUNCTOR_TYPENAME_RETURN(returnvalue) FUNCTOR_TYPENAME_RETURN##returnvalue
    311 #define FUNCTOR_TYPENAME_RETURN0 BLANKSTRING
    312 #define FUNCTOR_TYPENAME_RETURN1 typeToString<R>()
    313 
    314 
    315 
    316 #define FUNCTOR_FUNCTION_PARAMS(numparams) FUNCTOR_FUNCTION_PARAMS##numparams
    317 #define FUNCTOR_FUNCTION_PARAMS0
    318 #define FUNCTOR_FUNCTION_PARAMS1 P1 param1
    319 #define FUNCTOR_FUNCTION_PARAMS2 P1 param1, P2 param2
    320 #define FUNCTOR_FUNCTION_PARAMS3 P1 param1, P2 param2, P3 param3
    321 #define FUNCTOR_FUNCTION_PARAMS4 P1 param1, P2 param2, P3 param3, P4 param4
    322 #define FUNCTOR_FUNCTION_PARAMS5 P1 param1, P2 param2, P3 param3, P4 param4, P5 param5
    323 
    324 #define FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) FUNCTOR_FUNCTION_RETURNVALUE##returnvalue
    325 #define FUNCTOR_FUNCTION_RETURNVALUE0 void
    326 #define FUNCTOR_FUNCTION_RETURNVALUE1 R
    327 
    328 
    329 
    330 #define FUNCTOR_FUNCTION_CALL(numparams) FUNCTOR_FUNCTION_CALL##numparams
    331 #define FUNCTOR_FUNCTION_CALL0
    332 #define FUNCTOR_FUNCTION_CALL1 param1
    333 #define FUNCTOR_FUNCTION_CALL2 param1, param2
    334 #define FUNCTOR_FUNCTION_CALL3 param1, param2, param3
    335 #define FUNCTOR_FUNCTION_CALL4 param1, param2, param3, param4
    336 #define FUNCTOR_FUNCTION_CALL5 param1, param2, param3, param4, param5
    337 
    338 #define FUNCTOR_STORE_RETURNVALUE(returnvalue, functioncall) FUNCTOR_STORE_RETURNVALUE##returnvalue(functioncall)
    339 #define FUNCTOR_STORE_RETURNVALUE0(functioncall) functioncall; return MT_Type::Null
    340 #define FUNCTOR_STORE_RETURNVALUE1(functioncall) return functioncall
    341 
    342 
    343 
    344 #define FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES(returnvalue, numparams) FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES##numparams(returnvalue)
    345 #define FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES0(returnvalue) <FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES_RETURNVALUE(returnvalue), void, void, void, void, void>
    346 #define FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES1(returnvalue) <FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES_RETURNVALUE(returnvalue), P1, void, void, void, void>
    347 #define FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES2(returnvalue) <FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES_RETURNVALUE(returnvalue), P1, P2, void, void, void>
    348 #define FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES3(returnvalue) <FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES_RETURNVALUE(returnvalue), P1, P2, P3, void, void>
    349 #define FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES4(returnvalue) <FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES_RETURNVALUE(returnvalue), P1, P2, P3, P4, void>
    350 #define FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES5(returnvalue) <FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES_RETURNVALUE(returnvalue), P1, P2, P3, P4, P5>
    351 
    352 #define FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES_RETURNVALUE(returnvalue) FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES_RETURNVALUE##returnvalue
    353 #define FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES_RETURNVALUE0 void
    354 #define FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES_RETURNVALUE1 R
    355 
    356 
    357 
    358 #define FUNCTOR_EVALUATE_PARAM(numparams) FUNCTOR_EVALUATE_PARAM##numparams
    359 #define FUNCTOR_EVALUATE_PARAM0
    360 #define FUNCTOR_EVALUATE_PARAM1 \
    361     if (index == 0) { param.convert<P1>(); }
    362 #define FUNCTOR_EVALUATE_PARAM2 \
    363     if (index == 0) { param.convert<P1>(); } \
    364     else if (index == 1) { param.convert<P2>(); }
    365 #define FUNCTOR_EVALUATE_PARAM3 \
    366     if (index == 0) { param.convert<P1>(); } \
    367     else if (index == 1) { param.convert<P2>(); } \
    368     else if (index == 2) { param.convert<P3>(); }
    369 #define FUNCTOR_EVALUATE_PARAM4 \
    370     if (index == 0) { param.convert<P1>(); } \
    371     else if (index == 1) { param.convert<P2>(); } \
    372     else if (index == 2) { param.convert<P3>(); } \
    373     else if (index == 3) { param.convert<P4>(); }
    374 #define FUNCTOR_EVALUATE_PARAM5 \
    375     if (index == 0) { param.convert<P1>(); } \
    376     else if (index == 1) { param.convert<P2>(); } \
    377     else if (index == 2) { param.convert<P3>(); } \
    378     else if (index == 3) { param.convert<P4>(); } \
    379     else if (index == 4) { param.convert<P5>(); }
    380 
    381 
    382 
    383 
    384 #define CREATE_STATIC_FUNCTOR(returnvalue, numparams) \
    385     FUNCTOR_TEMPLATE(0, returnvalue, numparams, 0) \
    386     class FunctorStatic##returnvalue##numparams : public FunctorStatic \
    387     { \
    388         public: \
    389             FunctorStatic##returnvalue##numparams(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams))) \
    390             { \
    391                 this->functionPointer_ = functionPointer; \
    392             } \
    393     \
    394             MultiType operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) \
    395             { \
    396                 FUNCTOR_STORE_RETURNVALUE(returnvalue, (*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
    397             } \
    398     \
    399             void evaluateParam(unsigned int index, MultiType& param) const \
    400             { \
    401                 FUNCTOR_EVALUATE_PARAM(numparams); \
    402             } \
    403     \
    404             Functor::Type::Enum getType() const { return Functor::Type::Static; } \
    405             unsigned int getParamCount() const { return numparams; } \
    406             bool hasReturnvalue() const { return returnvalue; } \
    407             std::string getTypenameParam(unsigned int param) const { FUNCTOR_TYPENAME_PARAM(numparams); } \
    408             std::string getTypenameReturnvalue() const { return FUNCTOR_TYPENAME_RETURN(returnvalue); } \
    409     \
    410             const std::type_info& getHeaderIdentifier() const \
    411             { \
    412                 return typeid(FunctorHeaderIdentifier FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES(returnvalue, numparams)); \
    413             } \
    414     \
    415         private: \
    416             FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (*functionPointer_)(FUNCTOR_FUNCTION_PARAMS(numparams)); \
    417     }; \
    418     \
    419     \
    420     FUNCTOR_TEMPLATE(0, returnvalue, numparams, 0) \
    421     inline SharedChildPtr<FunctorStatic##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(0, returnvalue, numparams), FunctorStaticPtr> createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams))) \
    422     { \
    423         return new FunctorStatic##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(0, returnvalue, numparams) (functionPointer); \
    424     }
    425 
    426 
    427 
    428 
    429 
    430 #define CREATE_MEMBER_FUNCTOR(returnvalue, numparams) \
    431     FUNCTOR_TEMPLATE(1, returnvalue, numparams, 0) \
    432     class FunctorMember##returnvalue##numparams : public FunctorMember<T> \
    433     { \
    434         public: \
    435             FunctorMember##returnvalue##numparams(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams))) \
    436             { \
    437                 this->functionPointer_ = functionPointer; \
    438             } \
    439     \
    440             MultiType operator()(T* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) \
    441             { \
    442                 FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
    443             } \
    444     \
    445             MultiType operator()(const T* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) \
    446             { \
    447                 COUT(1) << "An error occurred in Functor.h:" << std::endl; \
    448                 COUT(1) << "Error: Function is not const." << std::endl; \
    449                 return MT_Type::Null; \
    450             } \
    451     \
    452             void evaluateParam(unsigned int index, MultiType& param) const \
    453             { \
    454                 FUNCTOR_EVALUATE_PARAM(numparams); \
    455             } \
    456     \
    457             Functor::Type::Enum getType() const { return Functor::Type::Member; } \
    458             unsigned int getParamCount() const { return numparams; } \
    459             bool hasReturnvalue() const { return returnvalue; } \
    460             std::string getTypenameParam(unsigned int param) const { FUNCTOR_TYPENAME_PARAM(numparams); } \
    461             std::string getTypenameReturnvalue() const { return FUNCTOR_TYPENAME_RETURN(returnvalue); } \
    462     \
    463             const std::type_info& getHeaderIdentifier() const \
    464             { \
    465                 return typeid(FunctorHeaderIdentifier FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES(returnvalue, numparams)); \
    466             } \
    467     \
    468         private: \
    469             FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer_)(FUNCTOR_FUNCTION_PARAMS(numparams)); \
    470     }; \
    471     \
    472     \
    473     FUNCTOR_TEMPLATE(1, returnvalue, numparams, 0) \
    474     class FunctorConstMember##returnvalue##numparams : public FunctorMember<T> \
    475     { \
    476         public: \
    477             FunctorConstMember##returnvalue##numparams(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams)) const) \
    478             { \
    479                 this->functionPointer_ = functionPointer; \
    480             } \
    481     \
    482             MultiType operator()(T* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) \
    483             { \
    484                 FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
    485             } \
    486     \
    487             MultiType operator()(const T* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) \
    488             { \
    489                 FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
    490             } \
    491     \
    492             void evaluateParam(unsigned int index, MultiType& param) const \
    493             { \
    494                 FUNCTOR_EVALUATE_PARAM(numparams); \
    495             } \
    496     \
    497             Functor::Type::Enum getType() const { return Functor::Type::ConstMember; } \
    498             unsigned int getParamCount() const { return numparams; } \
    499             bool hasReturnvalue() const { return returnvalue; } \
    500             std::string getTypenameParam(unsigned int param) const { FUNCTOR_TYPENAME_PARAM(numparams); } \
    501             std::string getTypenameReturnvalue() const { return FUNCTOR_TYPENAME_RETURN(returnvalue); } \
    502     \
    503             const std::type_info& getHeaderIdentifier() const \
    504             { \
    505                 return typeid(FunctorHeaderIdentifier FUNCTOR_HEADER_IDENTIFIER_TEMPLATE_CLASSES(returnvalue, numparams)); \
    506             } \
    507     \
    508         private: \
    509             FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer_)(FUNCTOR_FUNCTION_PARAMS(numparams)) const; \
    510     }; \
    511     \
    512     \
    513     FUNCTOR_TEMPLATE(1, returnvalue, numparams, 0) \
    514     inline SharedChildPtr<FunctorMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams), FunctorMemberPtr<T> > createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams))) \
    515     { \
    516         return new FunctorMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams) (functionPointer); \
    517     } \
    518     \
    519     \
    520     FUNCTOR_TEMPLATE(1, returnvalue, numparams, 0) \
    521     inline SharedChildPtr<FunctorConstMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams), FunctorMemberPtr<T> > createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams)) const) \
    522     { \
    523         return new FunctorConstMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams) (functionPointer); \
    524     } \
    525     \
    526     FUNCTOR_TEMPLATE(1, returnvalue, numparams, 1) \
    527     inline SharedChildPtr<FunctorMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams), FunctorMemberPtr<T> > createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams)), O* object) \
    528     { \
    529         FunctorMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams)* functor = new FunctorMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams) (functionPointer); \
    530         functor->setObject(object); \
    531         return functor; \
    532     } \
    533     \
    534     \
    535     FUNCTOR_TEMPLATE(1, returnvalue, numparams, 1) \
    536     inline SharedChildPtr<FunctorConstMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams), FunctorMemberPtr<T> > createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams)) const, O* object) \
    537     { \
    538         FunctorConstMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams)* functor = new FunctorConstMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams) (functionPointer); \
    539         functor->setObject(object); \
    540         return functor; \
    541     }
    542 
    543 
    544 
    545 // disable annoying warning about forcing value to boolean
    546 #ifdef ORXONOX_COMPILER_MSVC
    547 #pragma warning(push)
    548 #pragma warning(disable:4100 4800)
    549 #endif
    550 
    551 #define CREATE_ALL_STATIC_FUNCTORS() \
    552     CREATE_STATIC_FUNCTOR(0, 0); \
    553     CREATE_STATIC_FUNCTOR(0, 1); \
    554     CREATE_STATIC_FUNCTOR(0, 2); \
    555     CREATE_STATIC_FUNCTOR(0, 3); \
    556     CREATE_STATIC_FUNCTOR(0, 4); \
    557     CREATE_STATIC_FUNCTOR(0, 5); \
    558     CREATE_STATIC_FUNCTOR(1, 0); \
    559     CREATE_STATIC_FUNCTOR(1, 1); \
    560     CREATE_STATIC_FUNCTOR(1, 2); \
    561     CREATE_STATIC_FUNCTOR(1, 3); \
    562     CREATE_STATIC_FUNCTOR(1, 4); \
    563     CREATE_STATIC_FUNCTOR(1, 5)
    564 
    565 
    566 #define CREATE_ALL_MEMBER_FUNCTORS() \
    567     CREATE_MEMBER_FUNCTOR(0, 0); \
    568     CREATE_MEMBER_FUNCTOR(0, 1); \
    569     CREATE_MEMBER_FUNCTOR(0, 2); \
    570     CREATE_MEMBER_FUNCTOR(0, 3); \
    571     CREATE_MEMBER_FUNCTOR(0, 4); \
    572     CREATE_MEMBER_FUNCTOR(0, 5); \
    573     CREATE_MEMBER_FUNCTOR(1, 0); \
    574     CREATE_MEMBER_FUNCTOR(1, 1); \
    575     CREATE_MEMBER_FUNCTOR(1, 2); \
    576     CREATE_MEMBER_FUNCTOR(1, 3); \
    577     CREATE_MEMBER_FUNCTOR(1, 4); \
    578     CREATE_MEMBER_FUNCTOR(1, 5)
    579 
    580 
    581     CREATE_ALL_STATIC_FUNCTORS();
    582     CREATE_ALL_MEMBER_FUNCTORS();
     267    template <class R, class O, bool isconst, class P1, class P2, class P3, class P4, class P5>
     268    class FunctorTemplate : public FunctorPointer<typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, P4, P5>::Type, O>
     269    {
     270        public:
     271            FunctorTemplate(typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, P4, P5>::Type functionPointer, O* object = 0) : FunctorPointer<typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, P4, P5>::Type, O>(functionPointer, object) {}
     272
     273            MultiType operator()(O* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null)
     274            {
     275                return detail::FunctorCaller<R, O, isconst, P1, P2, P3, P4, P5>::call(this->functionPointer_, object, param1, param2, param3, param4, param5);
     276            }
     277
     278            void evaluateParam(unsigned int index, MultiType& param) const
     279            {
     280                switch (index)
     281                {
     282                    case 0: param.convert<P1>(); break;
     283                    case 1: param.convert<P2>(); break;
     284                    case 2: param.convert<P3>(); break;
     285                    case 3: param.convert<P4>(); break;
     286                    case 4: param.convert<P5>(); break;
     287                }
     288            }
     289
     290            unsigned int getParamCount() const
     291            {
     292                return detail::FunctorParamCount<P1, P2, P3, P4, P5>::result;
     293            }
     294
     295            bool hasReturnvalue() const
     296            {
     297                return detail::FunctorHasReturnvalue<R>::result;
     298            }
     299
     300            std::string getTypenameParam(unsigned int param) const
     301            {
     302                switch (param)
     303                {
     304                    case 0: return typeToString<P1>();
     305                    case 1: return typeToString<P2>();
     306                    case 2: return typeToString<P3>();
     307                    case 3: return typeToString<P4>();
     308                    case 4: return typeToString<P5>();
     309                    default: return "";
     310                }
     311            }
     312
     313            std::string getTypenameReturnvalue() const
     314            {
     315                return typeToString<R>();
     316            }
     317
     318            const std::type_info& getHeaderIdentifier() const
     319            {
     320                return typeid(detail::FunctorHeaderIdentifier<R, P1, P2, P3, P4, P5>);
     321            }
     322    };
     323
     324    template <class R, class O, class OO, class P1, class P2, class P3, class P4, class P5> SharedChildPtr<FunctorTemplate<R, O, false, P1, P2, P3, P4, P5>,           FunctorPointerPtr<typename detail::FunctionPointer<R, O, false, P1, P2, P3, P4, P5>::Type, O> >           createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5), OO* object) { return new FunctorTemplate<R, O, false, P1, P2, P3, P4, P5>(functionPointer, object); }
     325    template <class R, class O, class OO, class P1, class P2, class P3, class P4>           SharedChildPtr<FunctorTemplate<R, O, false, P1, P2, P3, P4, void>,         FunctorPointerPtr<typename detail::FunctionPointer<R, O, false, P1, P2, P3, P4, void>::Type, O> >         createFunctor(R (O::*functionPointer)(P1, P2, P3, P4), OO* object)     { return new FunctorTemplate<R, O, false, P1, P2, P3, P4, void>(functionPointer, object); }
     326    template <class R, class O, class OO, class P1, class P2, class P3>                     SharedChildPtr<FunctorTemplate<R, O, false, P1, P2, P3, void, void>,       FunctorPointerPtr<typename detail::FunctionPointer<R, O, false, P1, P2, P3, void, void>::Type, O> >       createFunctor(R (O::*functionPointer)(P1, P2, P3), OO* object)         { return new FunctorTemplate<R, O, false, P1, P2, P3, void, void>(functionPointer, object); }
     327    template <class R, class O, class OO, class P1, class P2>                               SharedChildPtr<FunctorTemplate<R, O, false, P1, P2, void, void, void>,     FunctorPointerPtr<typename detail::FunctionPointer<R, O, false, P1, P2, void, void, void>::Type, O> >     createFunctor(R (O::*functionPointer)(P1, P2), OO* object)             { return new FunctorTemplate<R, O, false, P1, P2, void, void, void>(functionPointer, object); }
     328    template <class R, class O, class OO, class P1>                                         SharedChildPtr<FunctorTemplate<R, O, false, P1, void, void, void, void>,   FunctorPointerPtr<typename detail::FunctionPointer<R, O, false, P1, void, void, void, void>::Type, O> >   createFunctor(R (O::*functionPointer)(P1), OO* object)                 { return new FunctorTemplate<R, O, false, P1, void, void, void, void>(functionPointer, object); }
     329    template <class R, class O, class OO>                                                   SharedChildPtr<FunctorTemplate<R, O, false, void, void, void, void, void>, FunctorPointerPtr<typename detail::FunctionPointer<R, O, false, void, void, void, void, void>::Type, O> > createFunctor(R (O::*functionPointer)(), OO* object)                   { return new FunctorTemplate<R, O, false, void, void, void, void, void>(functionPointer, object); }
     330    template <class R, class O, class OO, class P1, class P2, class P3, class P4, class P5> SharedChildPtr<FunctorTemplate<R, O, true, P1, P2, P3, P4, P5>,           FunctorPointerPtr<typename detail::FunctionPointer<R, O, true, P1, P2, P3, P4, P5>::Type, O> >           createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5) const, OO* object) { return new FunctorTemplate<R, O, true, P1, P2, P3, P4, P5>(functionPointer, object); }
     331    template <class R, class O, class OO, class P1, class P2, class P3, class P4>           SharedChildPtr<FunctorTemplate<R, O, true, P1, P2, P3, P4, void>,         FunctorPointerPtr<typename detail::FunctionPointer<R, O, true, P1, P2, P3, P4, void>::Type, O> >         createFunctor(R (O::*functionPointer)(P1, P2, P3, P4) const, OO* object)     { return new FunctorTemplate<R, O, true, P1, P2, P3, P4, void>(functionPointer, object); }
     332    template <class R, class O, class OO, class P1, class P2, class P3>                     SharedChildPtr<FunctorTemplate<R, O, true, P1, P2, P3, void, void>,       FunctorPointerPtr<typename detail::FunctionPointer<R, O, true, P1, P2, P3, void, void>::Type, O> >       createFunctor(R (O::*functionPointer)(P1, P2, P3) const, OO* object)         { return new FunctorTemplate<R, O, true, P1, P2, P3, void, void>(functionPointer, object); }
     333    template <class R, class O, class OO, class P1, class P2>                               SharedChildPtr<FunctorTemplate<R, O, true, P1, P2, void, void, void>,     FunctorPointerPtr<typename detail::FunctionPointer<R, O, true, P1, P2, void, void, void>::Type, O> >     createFunctor(R (O::*functionPointer)(P1, P2) const, OO* object)             { return new FunctorTemplate<R, O, true, P1, P2, void, void, void>(functionPointer, object); }
     334    template <class R, class O, class OO, class P1>                                         SharedChildPtr<FunctorTemplate<R, O, true, P1, void, void, void, void>,   FunctorPointerPtr<typename detail::FunctionPointer<R, O, true, P1, void, void, void, void>::Type, O> >   createFunctor(R (O::*functionPointer)(P1) const, OO* object)                 { return new FunctorTemplate<R, O, true, P1, void, void, void, void>(functionPointer, object); }
     335    template <class R, class O, class OO>                                                   SharedChildPtr<FunctorTemplate<R, O, true, void, void, void, void, void>, FunctorPointerPtr<typename detail::FunctionPointer<R, O, true, void, void, void, void, void>::Type, O> > createFunctor(R (O::*functionPointer)() const, OO* object)                   { return new FunctorTemplate<R, O, true, void, void, void, void, void>(functionPointer, object); }
     336
     337    template <class R, class O, class P1, class P2, class P3, class P4, class P5> SharedChildPtr<FunctorTemplate<R, O, false, P1, P2, P3, P4, P5>,           FunctorPointerPtr<typename detail::FunctionPointer<R, O, false, P1, P2, P3, P4, P5>::Type, O> >           createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5)) { return new FunctorTemplate<R, O, false, P1, P2, P3, P4, P5>(functionPointer); }
     338    template <class R, class O, class P1, class P2, class P3, class P4>           SharedChildPtr<FunctorTemplate<R, O, false, P1, P2, P3, P4, void>,         FunctorPointerPtr<typename detail::FunctionPointer<R, O, false, P1, P2, P3, P4, void>::Type, O> >         createFunctor(R (O::*functionPointer)(P1, P2, P3, P4))     { return new FunctorTemplate<R, O, false, P1, P2, P3, P4, void>(functionPointer); }
     339    template <class R, class O, class P1, class P2, class P3>                     SharedChildPtr<FunctorTemplate<R, O, false, P1, P2, P3, void, void>,       FunctorPointerPtr<typename detail::FunctionPointer<R, O, false, P1, P2, P3, void, void>::Type, O> >       createFunctor(R (O::*functionPointer)(P1, P2, P3))         { return new FunctorTemplate<R, O, false, P1, P2, P3, void, void>(functionPointer); }
     340    template <class R, class O, class P1, class P2>                               SharedChildPtr<FunctorTemplate<R, O, false, P1, P2, void, void, void>,     FunctorPointerPtr<typename detail::FunctionPointer<R, O, false, P1, P2, void, void, void>::Type, O> >     createFunctor(R (O::*functionPointer)(P1, P2))             { return new FunctorTemplate<R, O, false, P1, P2, void, void, void>(functionPointer); }
     341    template <class R, class O, class P1>                                         SharedChildPtr<FunctorTemplate<R, O, false, P1, void, void, void, void>,   FunctorPointerPtr<typename detail::FunctionPointer<R, O, false, P1, void, void, void, void>::Type, O> >   createFunctor(R (O::*functionPointer)(P1))                 { return new FunctorTemplate<R, O, false, P1, void, void, void, void>(functionPointer); }
     342    template <class R, class O>                                                   SharedChildPtr<FunctorTemplate<R, O, false, void, void, void, void, void>, FunctorPointerPtr<typename detail::FunctionPointer<R, O, false, void, void, void, void, void>::Type, O> > createFunctor(R (O::*functionPointer)())                   { return new FunctorTemplate<R, O, false, void, void, void, void, void>(functionPointer); }
     343    template <class R, class O, class P1, class P2, class P3, class P4, class P5> SharedChildPtr<FunctorTemplate<R, O, true, P1, P2, P3, P4, P5>,           FunctorPointerPtr<typename detail::FunctionPointer<R, O, true, P1, P2, P3, P4, P5>::Type, O> >           createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5) const) { return new FunctorTemplate<R, O, true, P1, P2, P3, P4, P5>(functionPointer); }
     344    template <class R, class O, class P1, class P2, class P3, class P4>           SharedChildPtr<FunctorTemplate<R, O, true, P1, P2, P3, P4, void>,         FunctorPointerPtr<typename detail::FunctionPointer<R, O, true, P1, P2, P3, P4, void>::Type, O> >         createFunctor(R (O::*functionPointer)(P1, P2, P3, P4) const)     { return new FunctorTemplate<R, O, true, P1, P2, P3, P4, void>(functionPointer); }
     345    template <class R, class O, class P1, class P2, class P3>                     SharedChildPtr<FunctorTemplate<R, O, true, P1, P2, P3, void, void>,       FunctorPointerPtr<typename detail::FunctionPointer<R, O, true, P1, P2, P3, void, void>::Type, O> >       createFunctor(R (O::*functionPointer)(P1, P2, P3) const)         { return new FunctorTemplate<R, O, true, P1, P2, P3, void, void>(functionPointer); }
     346    template <class R, class O, class P1, class P2>                               SharedChildPtr<FunctorTemplate<R, O, true, P1, P2, void, void, void>,     FunctorPointerPtr<typename detail::FunctionPointer<R, O, true, P1, P2, void, void, void>::Type, O> >     createFunctor(R (O::*functionPointer)(P1, P2) const)             { return new FunctorTemplate<R, O, true, P1, P2, void, void, void>(functionPointer); }
     347    template <class R, class O, class P1>                                         SharedChildPtr<FunctorTemplate<R, O, true, P1, void, void, void, void>,   FunctorPointerPtr<typename detail::FunctionPointer<R, O, true, P1, void, void, void, void>::Type, O> >   createFunctor(R (O::*functionPointer)(P1) const)                 { return new FunctorTemplate<R, O, true, P1, void, void, void, void>(functionPointer); }
     348    template <class R, class O>                                                   SharedChildPtr<FunctorTemplate<R, O, true, void, void, void, void, void>, FunctorPointerPtr<typename detail::FunctionPointer<R, O, true, void, void, void, void, void>::Type, O> > createFunctor(R (O::*functionPointer)() const)                   { return new FunctorTemplate<R, O, true, void, void, void, void, void>(functionPointer); }
     349
     350    template <class R, class P1, class P2, class P3, class P4, class P5> SharedChildPtr<FunctorTemplate<R, void, false, P1, P2, P3, P4, P5>,           FunctorPointerPtr<typename detail::FunctionPointer<R, void, false, P1, P2, P3, P4, P5>::Type, void> >           createFunctor(R (*functionPointer)(P1, P2, P3, P4, P5)) { return new FunctorTemplate<R, void, false, P1, P2, P3, P4, P5>(functionPointer); }
     351    template <class R, class P1, class P2, class P3, class P4>           SharedChildPtr<FunctorTemplate<R, void, false, P1, P2, P3, P4, void>,         FunctorPointerPtr<typename detail::FunctionPointer<R, void, false, P1, P2, P3, P4, void>::Type, void> >         createFunctor(R (*functionPointer)(P1, P2, P3, P4))     { return new FunctorTemplate<R, void, false, P1, P2, P3, P4, void>(functionPointer); }
     352    template <class R, class P1, class P2, class P3>                     SharedChildPtr<FunctorTemplate<R, void, false, P1, P2, P3, void, void>,       FunctorPointerPtr<typename detail::FunctionPointer<R, void, false, P1, P2, P3, void, void>::Type, void> >       createFunctor(R (*functionPointer)(P1, P2, P3))         { return new FunctorTemplate<R, void, false, P1, P2, P3, void, void>(functionPointer); }
     353    template <class R, class P1, class P2>                               SharedChildPtr<FunctorTemplate<R, void, false, P1, P2, void, void, void>,     FunctorPointerPtr<typename detail::FunctionPointer<R, void, false, P1, P2, void, void, void>::Type, void> >     createFunctor(R (*functionPointer)(P1, P2))             { return new FunctorTemplate<R, void, false, P1, P2, void, void, void>(functionPointer); }
     354    template <class R, class P1>                                         SharedChildPtr<FunctorTemplate<R, void, false, P1, void, void, void, void>,   FunctorPointerPtr<typename detail::FunctionPointer<R, void, false, P1, void, void, void, void>::Type, void> >   createFunctor(R (*functionPointer)(P1))                 { return new FunctorTemplate<R, void, false, P1, void, void, void, void>(functionPointer); }
     355    template <class R>                                                   SharedChildPtr<FunctorTemplate<R, void, false, void, void, void, void, void>, FunctorPointerPtr<typename detail::FunctionPointer<R, void, false, void, void, void, void, void>::Type, void> > createFunctor(R (*functionPointer)())                   { return new FunctorTemplate<R, void, false, void, void, void, void, void>(functionPointer); }
    583356}
    584357
    585 #ifdef ORXONOX_COMPILER_MSVC
    586 #pragma warning(pop)
    587 #endif
    588 
    589358#endif /* _Functor_H__ */
  • code/branches/consolecommands3/src/libraries/core/command/FunctorPtr.h

    r7205 r7212  
    3737    typedef SharedPtr<Functor> FunctorPtr;
    3838
    39     typedef SharedChildPtr<FunctorStatic, FunctorPtr> FunctorStaticPtr;
    40 
    4139    template <class T>
    4240    class FunctorMemberPtr : public SharedChildPtr<FunctorMember<T>, FunctorPtr>
     
    4745            inline FunctorMemberPtr(const SharedPtr<FunctorMember<T> >& other) : SharedChildPtr<FunctorMember<T>, FunctorPtr>(other) {}
    4846    };
     47
     48    typedef FunctorMemberPtr<void> FunctorStaticPtr;
     49
     50    template <class F, class T>
     51    class FunctorPointerPtr : public SharedChildPtr<FunctorPointer<F, T>, FunctorMemberPtr<T> >
     52    {
     53        public:
     54            inline FunctorPointerPtr() : SharedChildPtr<FunctorPointer<F, T>, FunctorMemberPtr<T> >() {}
     55            inline FunctorPointerPtr(FunctorPointer<F, T>* pointer) : SharedChildPtr<FunctorPointer<F, T>, FunctorMemberPtr<T> >(pointer) {}
     56            inline FunctorPointerPtr(const SharedPtr<FunctorPointer<F, T> >& other) : SharedChildPtr<FunctorPointer<F, T>, FunctorMemberPtr<T> >(other) {}
     57    };
    4958}
    5059
  • code/branches/consolecommands3/src/libraries/util/MultiType.h

    r7189 r7212  
    493493    template <> inline bool MultiType::isType<orxonox::Degree>()      const { return (this->value_ && this->value_->type_ == MT_Type::Degree);           } /** @brief Returns true if the current type equals the given type. */
    494494
     495    template <> inline bool MultiType::convert<void>()                 { this->reset(); return true; } /** @brief Deletes the content, type becomes MT_Type::Null. */
     496
    495497    // Specialization to avoid ambiguities with the conversion operator
    496498    template <> inline bool MultiType::convert<std::string>()          { return this->setValue<std::string>         (this->operator std::string());          } /** @brief Converts the current value to the given type. */
  • code/branches/consolecommands3/src/libraries/util/SharedPtr.h

    r7205 r7212  
    137137            }
    138138
     139            inline T* get() const
     140            {
     141                return this->pointer_;
     142            }
     143
    139144            inline operator bool() const
    140145            {
Note: See TracChangeset for help on using the changeset viewer.