Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 12, 2009, 11:58:01 PM (15 years ago)
Author:
rgrieder
Message:

Merged most of the core4 revisions back to the trunk except for:

  • orxonox_cast
  • all the radical changes in the input library
Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

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

    r3196 r3280  
    3535#include "util/Debug.h"
    3636#include "util/MultiType.h"
    37 #include "util/String.h"
     37#include "util/StringUtils.h"
    3838
    3939namespace orxonox
     
    4141    const unsigned int MAX_FUNCTOR_ARGUMENTS = 5;
    4242
    43     enum FunctionType
     43    namespace FunctionType
    4444    {
    45         FT_MEMBER,
    46         FT_CONSTMEMBER,
    47         FT_STATIC
    48     };
     45        enum Value
     46        {
     47            Member,
     48            ConstMember,
     49            Static
     50        };
     51    }
    4952
    5053
     
    98101            virtual ~Functor() {}
    99102
    100             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;
     103            virtual void 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;
    101104
    102105            inline unsigned int getParamCount() const { return this->numParams_; }
    103106            inline bool hasReturnvalue() const { return this->hasReturnValue_; }
    104             inline FunctionType getType() const { return this->type_; }
     107            inline FunctionType::Value getType() const { return this->type_; }
    105108            inline const MultiType& getReturnvalue() const { return this->returnedValue_; }
    106109
     
    113116            unsigned int numParams_;
    114117            bool hasReturnValue_;
    115             FunctionType type_;
     118            FunctionType::Value type_;
    116119            MultiType returnedValue_;
    117120
     
    124127        public:
    125128            virtual ~FunctorStatic() {}
    126             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;
     129            virtual void 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;
    127130    };
    128131
     
    139142            virtual ~FunctorMember() {}
    140143
    141             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;
    142             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;
    143 
    144             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)
     144            virtual void 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;
     145            virtual void 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;
     146
     147            virtual void 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)
    145148            {
    146149                if (this->bConstObject_)
     
    322325                this->numParams_ = numparams; \
    323326                this->hasReturnValue_ = returnvalue; \
    324                 this->type_ = FT_STATIC; \
     327                this->type_ = FunctionType::Static; \
    325328                this->functionPointer_ = functionPointer; \
    326329                \
     
    329332            } \
    330333    \
    331             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) \
     334            void 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) \
    332335            { \
    333336                FUNCTOR_STORE_RETURNVALUE(returnvalue, (*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
     
    363366                this->numParams_ = numparams; \
    364367                this->hasReturnValue_ = returnvalue; \
    365                 this->type_ = FT_MEMBER; \
     368                this->type_ = FunctionType::Member; \
    366369                this->functionPointer_ = functionPointer; \
    367370            } \
    368371    \
    369             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) \
     372            void 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) \
    370373            { \
    371374                FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
    372375            } \
    373376    \
    374             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) \
     377            void 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) \
    375378            { \
    376379                COUT(1) << "An error occurred in Functor.h:" << std::endl; \
     
    396399                this->numParams_ = numparams; \
    397400                this->hasReturnValue_ = returnvalue; \
    398                 this->type_ = FT_CONSTMEMBER; \
     401                this->type_ = FunctionType::ConstMember; \
    399402                this->functionPointer_ = functionPointer; \
    400403            } \
    401404    \
    402             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) \
     405            void 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) \
    403406            { \
    404407                FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
    405408            } \
    406409    \
    407             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) \
     410            void 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) \
    408411            { \
    409412                FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
Note: See TracChangeset for help on using the changeset viewer.