Changeset 9728 in orxonox.OLD for branches/new_class_id/src/lib/util/executor/executor_functional.h
- Timestamp:
- Sep 14, 2006, 10:31:40 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/util/executor/executor_functional.h
r9727 r9728 24 24 25 25 #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 34 28 35 29 template<typename type> type fromString(const std::string& input, type defaultValue) { return defaultValue; }; … … 70 64 71 65 #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 72 71 #undef __EXECUTOR_FUNCTIONAL_CONST 73 72 #define __EXECUTOR_FUNCTIONAL_CONST const 74 73 #undef __EXECUTOR_FUNCTIONAL_NAME 75 74 #define __EXECUTOR_FUNCTIONAL_NAME(ParamCount) Executor##ParamCount##Params_const 76 #endif 77 78 # ifdefEXECUTOR_FUNCTIONAL_USE_STATIC75 //#endif /* EXECUTOR_FUNCTIONAL_USE_CONST */ 76 77 #elif defined EXECUTOR_FUNCTIONAL_USE_STATIC 79 78 #ifdef EXECUTOR_FUNCTIONAL_USE_CONST 80 79 #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 82 87 83 88 #undef __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC … … 88 93 #define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER *functionPointer 89 94 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 92 105 /////////// 93 106 //// 0 //// … … 122 135 }; 123 136 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) const126 {127 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)();128 }129 130 137 /** 131 138 * @brief copies the Executor … … 161 168 this->functionPointer = functionPointer; 162 169 }; 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) const166 {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 172 170 173 171 /** … … 225 223 (sub.size() > 1) ? fromString<type1>(sub[1], getDefault<type1>(this->defaultValue, 1)) : (fromMulti<type1>(this->defaultValue[1]))); 226 224 }; 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) const230 {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 }236 225 237 226 /** … … 280 269 (sub.size() > 2) ? fromString<type2>(sub[2], getDefault<type2>(this->defaultValue, 2)) : (fromMulti<type2>(this->defaultValue[2]))); 281 270 }; 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) const285 {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 }292 271 293 272 /** … … 338 317 (sub.size() > 3) ? fromString<type3>(sub[3], getDefault<type3>(this->defaultValue, 3)) : (fromMulti<type3>(this->defaultValue[3]))); 339 318 }; 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) const343 {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 }351 319 352 320 /** … … 399 367 }; 400 368 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) const403 {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 413 369 /** 414 370 * @brief copies the Executor … … 513 469 #undef EXECUTOR_FUNCTIONAL_USE_STATIC 514 470 #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.