Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 9, 2008, 4:25:52 AM (16 years ago)
Author:
landauf
Message:

merged core3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/core/Functor.h

    r1505 r1747  
    3333#include "CorePrereqs.h"
    3434
    35 #include "util/MultiTypeMath.h"
    36 #include "Debug.h"
     35#include "util/MultiType.h"
     36#include "util/Debug.h"
    3737
    3838#define MAX_FUNCTOR_ARGUMENTS 5
     
    6969    CreateTypeToStringTemplate(long);
    7070    CreateTypeToStringTemplate(unsigned long);
     71    CreateTypeToStringTemplate(long long);
     72    CreateTypeToStringTemplate(unsigned long long);
    7173    CreateTypeToStringTemplate(float);
    7274    CreateTypeToStringTemplate(double);
     
    8082    CreateTypeToStringTemplate(Degree);
    8183
    82     template <> \
    83     inline std::string typeToString<std::string>() { return "string"; } \
    84     template <> \
    85     inline std::string typeToString<std::string&>() { return "string"; } \
    86     template <> \
    87     inline std::string typeToString<const std::string>() { return "string"; } \
    88     template <> \
     84    template <>
     85    inline std::string typeToString<std::string>() { return "string"; }
     86    template <>
     87    inline std::string typeToString<std::string&>() { return "string"; }
     88    template <>
     89    inline std::string typeToString<const std::string>() { return "string"; }
     90    template <>
    8991    inline std::string typeToString<const std::string&>() { return "string"; }
    9092
     
    9597            virtual ~Functor() {}
    9698
    97             virtual void operator()(const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) = 0;
     99            virtual void operator()(const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) = 0;
    98100
    99101            inline unsigned int getParamCount() const { return this->numParams_; }
    100102            inline bool hasReturnvalue() const { return this->hasReturnValue_; }
    101103            inline FunctionType getType() const { return this->type_; }
    102             inline MultiTypeMath getReturnvalue() const { return this->returnedValue_; }
     104            inline MultiType getReturnvalue() const { return this->returnedValue_; }
    103105
    104106            std::string getTypenameParam(unsigned int param) const { return (param >= 0 && param < 5) ? this->typeParam_[param] : ""; }
    105107            std::string getTypenameReturnvalue() const { return this->typeReturnvalue_; }
    106108
    107             virtual void evaluateParam(unsigned int index, MultiTypeMath& param) const = 0;
     109            virtual void evaluateParam(unsigned int index, MultiType& param) const = 0;
    108110
    109111        protected:
     
    111113            bool hasReturnValue_;
    112114            FunctionType type_;
    113             MultiTypeMath returnedValue_;
     115            MultiType returnedValue_;
    114116
    115117            std::string typeReturnvalue_;
     
    121123        public:
    122124            virtual ~FunctorStatic() {}
    123             virtual void operator()(const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) = 0;
     125            virtual void operator()(const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) = 0;
    124126    };
    125127
     
    136138            virtual ~FunctorMember() {}
    137139
    138             virtual void operator()(T* object, const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) = 0;
    139             virtual void operator()(const T* object, const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) = 0;
    140 
    141             virtual void operator()(const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null)
     140            virtual void operator()(T* object, const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) = 0;
     141            virtual void operator()(const T* object, const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) = 0;
     142
     143            virtual void operator()(const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null)
    142144            {
    143145                if (this->bConstObject_)
     
    284286#define FUNCTOR_EVALUATE_PARAM0
    285287#define FUNCTOR_EVALUATE_PARAM1 \
    286     if (index == 0) { P1 temp = param; param = temp; }
     288    if (index == 0) { param.convert<P1>(); }
    287289#define FUNCTOR_EVALUATE_PARAM2 \
    288     if (index == 0) { P1 temp = param; param = temp; } \
    289     else if (index == 1) { P2 temp = param; param = temp; }
     290    if (index == 0) { param.convert<P1>(); } \
     291    else if (index == 1) { param.convert<P2>(); }
    290292#define FUNCTOR_EVALUATE_PARAM3 \
    291     if (index == 0) { P1 temp = param; param = temp; } \
    292     else if (index == 1) { P2 temp = param; param = temp; } \
    293     else if (index == 2) { P3 temp = param; param = temp; }
     293    if (index == 0) { param.convert<P1>(); } \
     294    else if (index == 1) { param.convert<P2>(); } \
     295    else if (index == 2) { param.convert<P3>(); }
    294296#define FUNCTOR_EVALUATE_PARAM4 \
    295     if (index == 0) { P1 temp = param; param = temp; } \
    296     else if (index == 1) { P2 temp = param; param = temp; } \
    297     else if (index == 2) { P3 temp = param; param = temp; } \
    298     else if (index == 3) { P4 temp = param; param = temp; }
     297    if (index == 0) { param.convert<P1>(); } \
     298    else if (index == 1) { param.convert<P2>(); } \
     299    else if (index == 2) { param.convert<P3>(); } \
     300    else if (index == 3) { param.convert<P4>(); }
    299301#define FUNCTOR_EVALUATE_PARAM5 \
    300     if (index == 0) { P1 temp = param; param = temp; } \
    301     else if (index == 1) { P2 temp = param; param = temp; } \
    302     else if (index == 2) { P3 temp = param; param = temp; } \
    303     else if (index == 3) { P4 temp = param; param = temp; } \
    304     else if (index == 4) { P5 temp = param; param = temp; }
     302    if (index == 0) { param.convert<P1>(); } \
     303    else if (index == 1) { param.convert<P2>(); } \
     304    else if (index == 2) { param.convert<P3>(); } \
     305    else if (index == 3) { param.convert<P4>(); } \
     306    else if (index == 4) { param.convert<P5>(); }
    305307
    306308
     
    324326            } \
    325327    \
    326             void operator()(const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) \
     328            void operator()(const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) \
    327329            { \
    328330                FUNCTOR_STORE_RETURNVALUE(returnvalue, (*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
    329331            } \
    330332    \
    331             virtual void evaluateParam(unsigned int index, MultiTypeMath& param) const \
     333            virtual void evaluateParam(unsigned int index, MultiType& param) const \
    332334            { \
    333335                FUNCTOR_EVALUATE_PARAM(numparams); \
     
    362364            } \
    363365    \
    364             void operator()(T* object, const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) \
     366            void operator()(T* object, const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) \
    365367            { \
    366368                FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
    367369            } \
    368370    \
    369             void operator()(const T* object, const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) \
     371            void operator()(const T* object, const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) \
    370372            { \
    371373                COUT(1) << "An error occurred in Functor.h:" << std::endl; \
     
    373375            } \
    374376    \
    375             virtual void evaluateParam(unsigned int index, MultiTypeMath& param) const \
     377            virtual void evaluateParam(unsigned int index, MultiType& param) const \
    376378            { \
    377379                FUNCTOR_EVALUATE_PARAM(numparams); \
     
    395397            } \
    396398    \
    397             void operator()(T* object, const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) \
     399            void operator()(T* object, const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) \
    398400            { \
    399401                FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
    400402            } \
    401403    \
    402             void operator()(const T* object, const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) \
     404            void operator()(const T* object, const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) \
    403405            { \
    404406                FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
    405407            } \
    406408    \
    407             virtual void evaluateParam(unsigned int index, MultiTypeMath& param) const \
     409            virtual void evaluateParam(unsigned int index, MultiType& param) const \
    408410            { \
    409411                FUNCTOR_EVALUATE_PARAM(numparams); \
Note: See TracChangeset for help on using the changeset viewer.