Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 14, 2006, 10:31:40 PM (18 years ago)
Author:
bensch
Message:

cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/util/executor/executor_functional.h

    r9727 r9728  
    2424
    2525#include "executor.h"
    26 
    27 template<typename type> MT_Type ExecutorParamType() { return MT_EXT1; };
    28 template<> MT_Type ExecutorParamType<bool>();
    29 template<> MT_Type ExecutorParamType<int>();
    30 template<> MT_Type ExecutorParamType<unsigned int>();
    31 template<> MT_Type ExecutorParamType<float>();
    32 template<> MT_Type ExecutorParamType<char>();
    33 template<> MT_Type ExecutorParamType<const std::string&>();
     26#include "substring.h"
     27
    3428
    3529template<typename type> type fromString(const std::string& input, type defaultValue) { return defaultValue; };
     
    7064
    7165#ifdef EXECUTOR_FUNCTIONAL_USE_CONST
     66 #ifdef __EXECUTOR_FUNCTIONAL_CONST_INCLUDED
     67  #define __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS
     68 #else
     69  #define __EXECUTOR_FUNCTIONAL_CONST_INCLUDED
     70 #endif
    7271 #undef __EXECUTOR_FUNCTIONAL_CONST
    7372 #define __EXECUTOR_FUNCTIONAL_CONST const
    7473 #undef __EXECUTOR_FUNCTIONAL_NAME
    7574 #define __EXECUTOR_FUNCTIONAL_NAME(ParamCount) Executor##ParamCount##Params_const
    76 #endif
    77 
    78 #ifdef EXECUTOR_FUNCTIONAL_USE_STATIC
     75//#endif /* EXECUTOR_FUNCTIONAL_USE_CONST */
     76
     77#elif defined EXECUTOR_FUNCTIONAL_USE_STATIC
    7978 #ifdef EXECUTOR_FUNCTIONAL_USE_CONST
    8079  #error you obviously do not know what you are doing !! ask the bensch
    81  #endif /* EXECUTOR_FUNCTIONAL_USE_CONST */
     80 #endif
     81
     82  #ifdef __EXECUTOR_FUNCTIONAL_STATIC_INCLUDED
     83   #define __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS
     84  #else
     85   #define __EXECUTOR_FUNCTIONAL_STATIC_INCLUDED
     86  #endif
    8287
    8388#undef __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC
     
    8893 #define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER    *functionPointer
    8994
    90 #endif /* EXECUTOR_FUNCTIONAL_USE_STATIC */
    91 
     95//#endif /* EXECUTOR_FUNCTIONAL_USE_STATIC */
     96#else
     97 #ifdef __EXECUTOR_FUNCTIONAL_PLAIN_INCLUDED
     98  #define __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS
     99 #else
     100  #define __EXECUTOR_FUNCTIONAL_PLAIN_INCLUDED
     101 #endif
     102#endif
     103
     104#ifndef __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS
    92105///////////
    93106//// 0 ////
     
    122135  };
    123136
    124   /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
    125   virtual void operator()(BaseObject* object, int& count, void* values) const
    126   {
    127     (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)();
    128   }
    129 
    130137  /**
    131138   * @brief copies the Executor
     
    161168    this->functionPointer = functionPointer;
    162169  };
    163 
    164   /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
    165   virtual void operator()(BaseObject* object, int& count, void* values) const
    166   {
    167     const MultiType* mt = (const MultiType*)values;
    168     return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    169              fromMulti<type0>((count > 0)? mt[0] : this->defaultValue[0]) );
    170   }
    171 
    172170
    173171  /**
     
    225223      (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1])));
    226224  };
    227 
    228   /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
    229   virtual void operator()(BaseObject* object, int& count, void* values) const
    230   {
    231     const MultiType* mt = (const MultiType*)values;
    232     return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    233              fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),
    234              fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]) );
    235   }
    236225
    237226  /**
     
    280269      (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2])));
    281270  };
    282 
    283   /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
    284   virtual void operator()(BaseObject* object, int& count, void* values) const
    285   {
    286     const MultiType* mt = (const MultiType*)values;
    287     return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    288              fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),
    289              fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]),
    290              fromMulti<type2>((count > 2) ? mt[2] : this->defaultValue[2]) );
    291   }
    292271
    293272  /**
     
    338317      (sub.size() > 3) ? fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)) : (fromMulti<type3>(this->defaultValue[3])));
    339318  };
    340 
    341   /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
    342   virtual void operator()(BaseObject* object, int& count, void* values) const
    343   {
    344     const MultiType* mt = (const MultiType*)values;
    345     return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    346              fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),
    347              fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]),
    348              fromMulti<type2>((count > 2) ? mt[2] : this->defaultValue[2]),
    349              fromMulti<type3>((count > 3) ? mt[3] : this->defaultValue[3]) );
    350   }
    351319
    352320  /**
     
    399367  };
    400368
    401   /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
    402   virtual void operator()(BaseObject* object, int& count, void* values) const
    403   {
    404     const MultiType* mt = (const MultiType*)values;
    405     return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    406              fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),
    407              fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]),
    408              fromMulti<type2>((count > 2) ? mt[2] : this->defaultValue[2]),
    409              fromMulti<type3>((count > 3) ? mt[3] : this->defaultValue[3]),
    410              fromMulti<type4>((count > 4) ? mt[4] : this->defaultValue[4]) );
    411   }
    412 
    413369  /**
    414370   * @brief copies the Executor
     
    513469 #undef EXECUTOR_FUNCTIONAL_USE_STATIC
    514470#endif
     471
     472
     473#endif /* __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS */
     474#undef __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS
Note: See TracChangeset for help on using the changeset viewer.