Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9742 in orxonox.OLD for branches/new_class_id/src


Ignore:
Timestamp:
Sep 16, 2006, 2:00:13 PM (18 years ago)
Author:
bensch
Message:

added a Substring handler

Location:
branches/new_class_id/src/lib
Files:
4 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/shell/shell_command.h

    r9740 r9742  
    1010
    1111/// THIS IS USED TO LOAD CONSTANT AND STATIC FUNCTIONS EASILY.
     12#include "executor/executor_substring.h"
    1213#include "executor/functor_member.h"
    1314#include "executor/functor_const_member.h"
  • branches/new_class_id/src/lib/util/Makefile.am

    r9741 r9742  
    88libORXexecutor_a_SOURCES = \
    99                executor/executor.cc \
    10                 executor/executor_lua.cc
     10                executor/executor_lua.cc \
     11                executor/executor_substring.cc
    1112
    1213#               executor/executor_functional.cc
     
    4849                executor/executor_xml.h \
    4950                executor/executor_lua.h \
    50                 executor/functor_list.h \
     51                executor/executor_substring.h \
    5152                executor/executor_generic.h \
    5253                executor/executor_member.h \
    5354                executor/executor_const_member.h \
    5455                executor/executor_static.h \
     56                \
     57                executor/functor_list.h \
    5558                executor/functor_generic.h \
    5659                executor/functor_member.h \
  • branches/new_class_id/src/lib/util/executor/executor_generic.h

    r9740 r9742  
    2626
    2727#include "executor.h"
    28 #include "substring.h"
    29 
    30 
    31 template<typename type> type fromString(const std::string& input, type defaultValue) { return defaultValue; };
    32 template<> bool fromString<bool>(const std::string& input, bool defaultValue);
    33 template<> int fromString<int>(const std::string& input, int defaultValue);
    34 template<> unsigned int fromString<unsigned int>(const std::string& input, unsigned int defaultValue);
    35 template<> float fromString<float>(const std::string& input, float defaultValue);
    36 template<> char fromString<char>(const std::string& input, char defaultValue);
    37 template<> const std::string& fromString<const std::string&>(const std::string& input, const std::string& defaultValue);
    38 
    39 template<typename type> type fromMulti(const MultiType& multi) { /* return defaultValue; */ };
    40 template<> bool fromMulti<bool>(const MultiType& multi);
    41 template<> int fromMulti<int>(const MultiType& multi);
    42 template<> unsigned int fromMulti<unsigned int>(const MultiType& multi);
    43 template<> float fromMulti<float>(const MultiType& multi);
    44 template<> char fromMulti<char>(const MultiType& multi);
    45 template<> const std::string& fromMulti<const std::string&>(const MultiType& multi);
    46 
    47 
    48 template<typename type> type getDefault(const MultiType* const defaultValues, unsigned int i) { return (type)0; };
    49 template<> bool getDefault<bool>(const MultiType* const defaultValues, unsigned int i);
    50 template<> int getDefault<int>(const MultiType* const defaultValues, unsigned int i);
    51 template<> unsigned int getDefault<unsigned int>(const MultiType* const defaultValues, unsigned int i);
    52 template<> float getDefault<float>(const MultiType* const defaultValues, unsigned int i);
    53 template<> char getDefault<char>(const MultiType* const defaultValues, unsigned int i);
    54 template<> const std::string& getDefault<const std::string&>(const MultiType* const defaultValues, unsigned int i);
    55 
    56 
    5728/**
    5829 * @brief this is a Template Class used as an evaluater.
     
    7849  ToType operator()(FromType& CallValue, const MultiType* const defaults)
    7950  {
    80     return defaultValue; /*(CallValue.size() > index) ?
    81            fromString<ToType>(CallValue[index], getDefault<ToType>(defaults, index)) :
    82     fromMulti<ToType>(defaults[index]); */
     51    return defaultValue;
    8352  }
    84   static FromType& defaultValue() { return FromType(); };
    85 };
    86 
    87 /**
    88  * @brief to remove writing errors, this function is Used.
    89  * @param sub The SubString to use
    90  * @param default The default Values.
    91  */
    92 template<> class ExecutorEvaluater <const SubString>
    93 {
    94 public:
    95   /** @brief Executes the Evaluater
    96    * @param CallValue the Value that should be converted
    97    * @param defaults the default Values.
    98    */
    99   template <typename ToType, int index>
    100   ToType operator()(const SubString& CallValue, const MultiType* const defaults)
    101   {
    102     return (CallValue.size() > index) ?
    103            fromString<ToType>(CallValue[index], getDefault<ToType>(defaults, index)) :
    104            fromMulti<ToType>(defaults[index]);
    105   }
    106   static const SubString& defaultValue() { return SubString::NullSubString; };
    107 };
    108 
     53  static FromType& defaultValue() { static FromType defaultValue; return defaultValue; };
     54};
    10955#endif /* __EXECUTOR_GENERIC_H_ */
    11056
     57#ifdef __EXECUTOR_FUNCTIONAL_NAME
    11158
    11259///////////
     
    13582   * @brief executes the Functional
    13683   * @param object the Object the action should be executed on.
    137    * @param sub the SubString to get the Parameters from.
    138    */
    139   virtual void operator()(BaseObject* object, CallType& sub = Evaluater<CallType>::defaultValue()) const
     84   * @param eval the CallType to get the Parameters from.
     85   */
     86  virtual void operator()(BaseObject* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
    14087  {
    14188    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)();
     
    181128   * @brief executes the Functional
    182129   * @param object the Object the action should be executed on.
    183    * @param sub the SubString to get the Parameters from.
    184    */
    185   virtual void operator()(BaseObject* object, CallType& sub = Evaluater<CallType>::defaultValue()) const
    186   {
    187     (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    188       Evaluater<CallType>().template operator()<type0, 0>(sub, this->defaultValue));
     130   * @param eval the CallType to get the Parameters from.
     131   */
     132  virtual void operator()(BaseObject* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
     133  {
     134    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
     135      Evaluater<CallType>().template operator()<type0, 0>(eval, this->defaultValue));
    189136  };
    190137
     
    228175   * @brief executes the Functional
    229176   * @param object the Object the action should be executed on.
    230    * @param sub the SubString to get the Parameters from.
    231    */
    232   virtual void operator()(BaseObject* object, CallType& sub = Evaluater<CallType>::defaultValue()) const
    233   {
    234     (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    235       Evaluater<CallType>().template operator()<type0, 0>(sub, this->defaultValue),
    236       Evaluater<CallType>().template operator()<type1, 1>(sub, this->defaultValue));
     177   * @param eval the CallType to get the Parameters from.
     178   */
     179  virtual void operator()(BaseObject* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
     180  {
     181    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
     182      Evaluater<CallType>().template operator()<type0, 0>(eval, this->defaultValue),
     183      Evaluater<CallType>().template operator()<type1, 1>(eval, this->defaultValue));
    237184  };
    238185
     
    276223   * @brief executes the Functional
    277224   * @param object the Object the action should be executed on.
    278    * @param sub the SubString to get the Parameters from.
    279    */
    280   virtual void operator()(BaseObject* object, CallType& sub = Evaluater<CallType>::defaultValue()) const
    281   {
    282     (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    283       Evaluater<CallType>().template operator()<type0, 0>(sub, this->defaultValue),
    284       Evaluater<CallType>().template operator()<type1, 1>(sub, this->defaultValue),
    285       Evaluater<CallType>().template operator()<type2, 2>(sub, this->defaultValue));
     225   * @param eval the CallType to get the Parameters from.
     226   */
     227  virtual void operator()(BaseObject* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
     228  {
     229    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
     230      Evaluater<CallType>().template operator()<type0, 0>(eval, this->defaultValue),
     231      Evaluater<CallType>().template operator()<type1, 1>(eval, this->defaultValue),
     232      Evaluater<CallType>().template operator()<type2, 2>(eval, this->defaultValue));
    286233  };
    287234
     
    325272  * @brief executes the Functional
    326273  * @param object the Object the action should be executed on.
    327   * @param sub the SubString to get the Parameters from.
    328    */
    329   virtual void operator()(BaseObject* object, CallType& sub = Evaluater<CallType>::defaultValue()) const
    330   {
    331     (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    332       Evaluater<CallType>().template operator()<type0, 0>(sub, this->defaultValue),
    333       Evaluater<CallType>().template operator()<type1, 1>(sub, this->defaultValue),
    334       Evaluater<CallType>().template operator()<type2, 2>(sub, this->defaultValue),
    335       Evaluater<CallType>().template operator()<type3, 3>(sub, this->defaultValue));
     274  * @param eval the CallType to get the Parameters from.
     275   */
     276  virtual void operator()(BaseObject* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
     277  {
     278    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
     279      Evaluater<CallType>().template operator()<type0, 0>(eval, this->defaultValue),
     280      Evaluater<CallType>().template operator()<type1, 1>(eval, this->defaultValue),
     281      Evaluater<CallType>().template operator()<type2, 2>(eval, this->defaultValue),
     282      Evaluater<CallType>().template operator()<type3, 3>(eval, this->defaultValue));
    336283  };
    337284
     
    376323  * @brief executes the Functional
    377324  * @param object the Object the action should be executed on.
    378   * @param sub the SubString to get the Parameters from.
    379    */
    380   virtual void operator()(BaseObject* object, CallType& sub = Evaluater<CallType>::defaultValue()) const
    381   {
    382     (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    383       Evaluater<CallType>().template operator()<type0, 0>(sub, this->defaultValue),
    384       Evaluater<CallType>().template operator()<type1, 1>(sub, this->defaultValue),
    385       Evaluater<CallType>().template operator()<type2, 2>(sub, this->defaultValue),
    386       Evaluater<CallType>().template operator()<type3, 3>(sub, this->defaultValue),
    387       Evaluater<CallType>().template operator()<type4, 4>(sub, this->defaultValue));
     325  * @param eval the CallType to get the Parameters from.
     326   */
     327  virtual void operator()(BaseObject* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
     328  {
     329    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
     330      Evaluater<CallType>().template operator()<type0, 0>(eval, this->defaultValue),
     331      Evaluater<CallType>().template operator()<type1, 1>(eval, this->defaultValue),
     332      Evaluater<CallType>().template operator()<type2, 2>(eval, this->defaultValue),
     333      Evaluater<CallType>().template operator()<type3, 3>(eval, this->defaultValue),
     334      Evaluater<CallType>().template operator()<type4, 4>(eval, this->defaultValue));
    388335  };
    389336
     
    398345};
    399346
    400 //#endif /* __EXECUTOR_GENERIC_H_ */
     347#endif /* __EXECUTOR_FUNCTIONAL_NAME */
  • branches/new_class_id/src/lib/util/executor/executor_substring.cc

    r9735 r9742  
    1414*/
    1515
    16 #include "executor_functional.h"
     16#include "executor_substring.h"
    1717#include "helper_functions.h"
    1818
  • branches/new_class_id/src/lib/util/executor/executor_substring.h

    r9740 r9742  
    2121
    2222
    23 #ifndef __EXECUTOR_GENERIC_H_
    24 #define __EXECUTOR_GENERIC_H_
     23#ifndef __EXECUTOR_SUBSTRING_H_
     24#define __EXECUTOR_SUBSTRING_H_
    2525
    2626
    27 #include "executor.h"
     27#include "executor_generic.h"
    2828#include "substring.h"
    2929
     
    5656
    5757/**
    58  * @brief this is a Template Class used as an evaluater.
    59  *
    60  * Trait to determine a default Value for any Type,
    61  * and to define the Convertible, and how it is transformed into the
    62  * corresponding SubTypes over the operator().
    63  *
    64  * This Class must be reimplemented for each Convertible and all of its
    65  *  conversion-members.
    66  *
    67  * e.g: Convertible SubSting, that splits up into many Stings
    68  *      conversion-members: (int) can be transformed from a String.
    69  */
    70 template<typename FromType> class ExecutorEvaluater
    71 {
    72 public:
    73   /** @brief Executes the Evaluater
    74    * @param CallValue the Value that should be converted
    75    * @param defaults the default Values.
    76    */
    77   template <typename ToType, int index>
    78   ToType operator()(FromType& CallValue, const MultiType* const defaults)
    79   {
    80     return defaultValue; /*(CallValue.size() > index) ?
    81            fromString<ToType>(CallValue[index], getDefault<ToType>(defaults, index)) :
    82     fromMulti<ToType>(defaults[index]); */
    83   }
    84   static FromType& defaultValue() { return FromType(); };
    85 };
    86 
    87 /**
    8858 * @brief to remove writing errors, this function is Used.
    8959 * @param sub The SubString to use
     
    10777};
    10878
    109 #endif /* __EXECUTOR_GENERIC_H_ */
    110 
    111 
    112 ///////////
    113 //// 0 ////
    114 ///////////
    115 //! @brief ExecutorClass, that can execute Functions without any parameters.
    116 template<class T, typename CallType, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject>
    117 class __EXECUTOR_FUNCTIONAL_NAME(0) :public Executor<CallType, BaseClass>
    118 {
    119 private:
    120   /** @brief the FunctioPointer. */
    121   void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST;
    122 
    123 public:
    124   /**
    125    * @brief constructs the Executor.
    126    * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
    127    */
    128   __EXECUTOR_FUNCTIONAL_NAME(0) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST )
    129       : Executor<CallType, BaseClass>(false, __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE)
    130   {
    131     this->functionPointer = functionPointer;
    132   };
    133 
    134   /**
    135    * @brief executes the Functional
    136    * @param object the Object the action should be executed on.
    137    * @param sub the SubString to get the Parameters from.
    138    */
    139   virtual void operator()(BaseObject* object, CallType& sub = Evaluater<CallType>::defaultValue()) const
    140   {
    141     (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)();
    142   };
    143 
    144   /**
    145    * @brief copies the Executor
    146    * @returns a new Executor that's a copy of this one.
    147    */
    148   virtual Executor<CallType, BaseClass>* clone() const
    149   {
    150     return new __EXECUTOR_FUNCTIONAL_NAME(0)<T, CallType>(this->functionPointer);
    151   };
    152 };
    153 
    154 
    155 
    156 
    157 
    158 ///////////
    159 //// 1 ////
    160 ///////////
    161 //! @brief ExecutorClass, that can execute Functions with one parameter.
    162 template<class T, typename CallType, typename type0, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject>
    163 class __EXECUTOR_FUNCTIONAL_NAME(1) : public Executor<CallType, BaseClass>
    164 {
    165 private:
    166   /** @brief the FunctioPointer. */
    167   void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST;
    168 
    169 public:
    170   /**
    171    * @brief constructs the Executor.
    172    * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
    173    */
    174   __EXECUTOR_FUNCTIONAL_NAME(1) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST)
    175       : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE)
    176   {
    177     this->functionPointer = functionPointer;
    178   };
    179 
    180   /**
    181    * @brief executes the Functional
    182    * @param object the Object the action should be executed on.
    183    * @param sub the SubString to get the Parameters from.
    184    */
    185   virtual void operator()(BaseObject* object, CallType& sub = Evaluater<CallType>::defaultValue()) const
    186   {
    187     (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    188       Evaluater<CallType>().template operator()<type0, 0>(sub, this->defaultValue));
    189   };
    190 
    191   /**
    192    * @brief copies the Executor
    193    * @returns a new Executor that's a copy of this one.
    194    */
    195   virtual Executor<CallType, BaseClass>* clone() const
    196   {
    197     return  new __EXECUTOR_FUNCTIONAL_NAME(1)<T, CallType, type0>(this->functionPointer);
    198   };
    199 };
    200 
    201 
    202 
    203 
    204 
    205 ///////////
    206 //// 2 ////
    207 ///////////
    208 //! @brief ExecutorClass, that can execute Functions with two parameters.
    209 template<class T, typename CallType, typename type0, typename type1, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject>
    210 class __EXECUTOR_FUNCTIONAL_NAME(2) : public Executor<CallType, BaseClass>
    211 {
    212 private:
    213   /** @brief the FunctioPointer. */
    214   void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST;
    215 
    216 public:
    217   /**
    218    * @brief constructs the Executor.
    219    * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
    220    */
    221   __EXECUTOR_FUNCTIONAL_NAME(2) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST)
    222       : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE)
    223   {
    224     this->functionPointer = functionPointer;
    225   };
    226 
    227   /**
    228    * @brief executes the Functional
    229    * @param object the Object the action should be executed on.
    230    * @param sub the SubString to get the Parameters from.
    231    */
    232   virtual void operator()(BaseObject* object, CallType& sub = Evaluater<CallType>::defaultValue()) const
    233   {
    234     (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    235       Evaluater<CallType>().template operator()<type0, 0>(sub, this->defaultValue),
    236       Evaluater<CallType>().template operator()<type1, 1>(sub, this->defaultValue));
    237   };
    238 
    239   /**
    240    * @brief copies the Executor
    241    * @returns a new Executor that's a copy of this one.
    242    */
    243   virtual Executor<CallType, BaseClass>* clone() const
    244   {
    245     return new __EXECUTOR_FUNCTIONAL_NAME(2)<T, CallType, type0, type1>(this->functionPointer);
    246   };
    247 };
    248 
    249 
    250 
    251 
    252 
    253 ///////////
    254 //// 3 ////
    255 ///////////
    256 //! @brief ExecutorClass, that can execute Functions with three parameters.
    257 template<class T, typename CallType, typename type0, typename type1, typename type2, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject>
    258 class __EXECUTOR_FUNCTIONAL_NAME(3) : public Executor<CallType, BaseClass>
    259 {
    260 private:
    261   /** @brief the FunctioPointer. */
    262   void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST;
    263 
    264 public:
    265   /**
    266    * @brief constructs the Executor.
    267    * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
    268    */
    269   __EXECUTOR_FUNCTIONAL_NAME(3) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST)
    270       : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE)
    271   {
    272     this->functionPointer = functionPointer;
    273   };
    274 
    275   /**
    276    * @brief executes the Functional
    277    * @param object the Object the action should be executed on.
    278    * @param sub the SubString to get the Parameters from.
    279    */
    280   virtual void operator()(BaseObject* object, CallType& sub = Evaluater<CallType>::defaultValue()) const
    281   {
    282     (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    283       Evaluater<CallType>().template operator()<type0, 0>(sub, this->defaultValue),
    284       Evaluater<CallType>().template operator()<type1, 1>(sub, this->defaultValue),
    285       Evaluater<CallType>().template operator()<type2, 2>(sub, this->defaultValue));
    286   };
    287 
    288   /**
    289    * @brief copies the Executor
    290    * @returns a new Executor that's a copy of this one.
    291    */
    292   virtual Executor<CallType, BaseClass>* clone() const
    293   {
    294     return new __EXECUTOR_FUNCTIONAL_NAME(3)<T, CallType, type0, type1, type2>(this->functionPointer);
    295   };
    296 };
    297 
    298 
    299 
    300 
    301 
    302 ///////////
    303 //// 4 ////
    304 ///////////
    305 //! @brief ExecutorClass, that can execute Functions with four parameters.
    306 template<class T, typename CallType, typename type0, typename type1, typename type2, typename type3, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject>
    307 class __EXECUTOR_FUNCTIONAL_NAME(4) : public Executor<CallType, BaseClass>
    308 {
    309 private:
    310   /** @brief the FunctioPointer. */
    311   void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST;
    312 
    313 public:
    314   /**
    315    * @brief constructs the Executor.
    316    * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
    317    */
    318   __EXECUTOR_FUNCTIONAL_NAME(4) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST)
    319       : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE)
    320   {
    321     this->functionPointer = functionPointer;
    322   };
    323 
    324   /**
    325   * @brief executes the Functional
    326   * @param object the Object the action should be executed on.
    327   * @param sub the SubString to get the Parameters from.
    328    */
    329   virtual void operator()(BaseObject* object, CallType& sub = Evaluater<CallType>::defaultValue()) const
    330   {
    331     (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    332       Evaluater<CallType>().template operator()<type0, 0>(sub, this->defaultValue),
    333       Evaluater<CallType>().template operator()<type1, 1>(sub, this->defaultValue),
    334       Evaluater<CallType>().template operator()<type2, 2>(sub, this->defaultValue),
    335       Evaluater<CallType>().template operator()<type3, 3>(sub, this->defaultValue));
    336   };
    337 
    338   /**
    339    * @brief copies the Executor
    340    * @returns a new Executor that's a copy of this one.
    341    */
    342   virtual Executor<CallType, BaseClass>* clone() const
    343   {
    344     return new __EXECUTOR_FUNCTIONAL_NAME(4)<T, CallType, type0, type1, type2, type3>(this->functionPointer);
    345   };
    346 };
    347 
    348 
    349 
    350 
    351 
    352 
    353 ///////////
    354 //// 5 ////
    355 ///////////
    356 //! @brief ExecutorClass, that can execute Functions with five parameters.
    357 template<class T, typename CallType, typename type0, typename type1, typename type2, typename type3, typename type4, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject>
    358 class __EXECUTOR_FUNCTIONAL_NAME(5) : public Executor<CallType, BaseClass>
    359 {
    360 private:
    361   /** @brief the FunctioPointer. */
    362   void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST;
    363 
    364 public:
    365   /**
    366    * @brief constructs the Executor.
    367    * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function.
    368    */
    369   __EXECUTOR_FUNCTIONAL_NAME(5) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST)
    370       : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE)
    371   {
    372     this->functionPointer = functionPointer;
    373   };
    374 
    375   /**
    376   * @brief executes the Functional
    377   * @param object the Object the action should be executed on.
    378   * @param sub the SubString to get the Parameters from.
    379    */
    380   virtual void operator()(BaseObject* object, CallType& sub = Evaluater<CallType>::defaultValue()) const
    381   {
    382     (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    383       Evaluater<CallType>().template operator()<type0, 0>(sub, this->defaultValue),
    384       Evaluater<CallType>().template operator()<type1, 1>(sub, this->defaultValue),
    385       Evaluater<CallType>().template operator()<type2, 2>(sub, this->defaultValue),
    386       Evaluater<CallType>().template operator()<type3, 3>(sub, this->defaultValue),
    387       Evaluater<CallType>().template operator()<type4, 4>(sub, this->defaultValue));
    388   };
    389 
    390   /**
    391    * @brief copies the Executor
    392    * @returns a new Executor that's a copy of this one.
    393    */
    394   virtual Executor<CallType, BaseClass>* clone() const
    395   {
    396     return new __EXECUTOR_FUNCTIONAL_NAME(5)<T, CallType, type0, type1, type2, type3, type4>(this->functionPointer);
    397   };
    398 };
    399 
    400 //#endif /* __EXECUTOR_GENERIC_H_ */
     79#endif /* __EXECUTOR_SUBSTRING_H_ */
  • branches/new_class_id/src/lib/util/loading/load_param.h

    r9740 r9742  
    2424#include "base_object.h"
    2525
     26#include "executor/executor_substring.h"
    2627#include "executor/executor_member.h"
    2728#include "executor/functor_member.h"
Note: See TracChangeset for help on using the changeset viewer.