Changeset 8048 in orxonox.OLD for trunk/src/lib/util/executor
- Timestamp:
- May 31, 2006, 11:10:17 PM (19 years ago)
- Location:
- trunk/src/lib/util/executor
- Files:
-
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/executor/executor.h
r8035 r8048 53 53 // EXECUTE 54 54 /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */ 55 virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const = 0;55 virtual void operator()(BaseObject* object, unsigned int count, void* values) const = 0; 56 56 /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes */ 57 57 virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const = 0; 58 /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes @brief here for your convenience*/59 void execute (BaseObject* object, const std::string& parameters = "") const { (*this)(object, parameters); };60 61 58 62 59 // RETRIEVE INFORMATION -
trunk/src/lib/util/executor/executor_functional.h
r8035 r8048 123 123 124 124 /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */ 125 virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const125 virtual void operator()(BaseObject* object, unsigned int count, void* values) const 126 126 { 127 127 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(); … … 163 163 164 164 /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */ 165 virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const 166 { 165 virtual void operator()(BaseObject* object, unsigned int count, void* values) const 166 { 167 const MultiType* mt = (const MultiType*)values; 167 168 return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 168 fromMulti<type0>((count > 0)? values[0] : this->defaultValue[0]) );169 fromMulti<type0>((count > 0)? mt[0] : this->defaultValue[0]) ); 169 170 } 170 171 … … 226 227 227 228 /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */ 228 virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const 229 { 229 virtual void operator()(BaseObject* object, unsigned int count, void* values) const 230 { 231 const MultiType* mt = (const MultiType*)values; 230 232 return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 231 fromMulti<type0>((count > 0) ? values[0] : this->defaultValue[0]),232 fromMulti<type1>((count > 1) ? values[1] : this->defaultValue[1]) );233 fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]), 234 fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]) ); 233 235 } 234 236 … … 280 282 281 283 /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */ 282 virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const 283 { 284 virtual void operator()(BaseObject* object, unsigned int count, void* values) const 285 { 286 const MultiType* mt = (const MultiType*)values; 284 287 return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 285 fromMulti<type0>((count > 0) ? values[0] : this->defaultValue[0]),286 fromMulti<type1>((count > 1) ? values[1] : this->defaultValue[1]),287 fromMulti<type2>((count > 2) ? values[2] : this->defaultValue[2]) );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]) ); 288 291 } 289 292 … … 337 340 338 341 /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */ 339 virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const 340 { 342 virtual void operator()(BaseObject* object, unsigned int count, void* values) const 343 { 344 const MultiType* mt = (const MultiType*)values; 341 345 return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 342 fromMulti<type0>((count > 0) ? values[0] : this->defaultValue[0]),343 fromMulti<type1>((count > 1) ? values[1] : this->defaultValue[1]),344 fromMulti<type2>((count > 2) ? values[2] : this->defaultValue[2]),345 fromMulti<type3>((count > 3) ? values[3] : this->defaultValue[3]) );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]) ); 346 350 } 347 351 … … 396 400 397 401 /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */ 398 virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const 399 { 402 virtual void operator()(BaseObject* object, unsigned int count, void* values) const 403 { 404 const MultiType* mt = (const MultiType*)values; 400 405 return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 401 fromMulti<type0>((count > 0) ? values[0] : this->defaultValue[0]),402 fromMulti<type1>((count > 1) ? values[1] : this->defaultValue[1]),403 fromMulti<type2>((count > 2) ? values[2] : this->defaultValue[2]),404 fromMulti<type3>((count > 3) ? values[3] : this->defaultValue[3]),405 fromMulti<type4>((count > 4) ? values[4] : this->defaultValue[4]) );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]) ); 406 411 } 407 412 … … 421 426 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all) 422 427 */ 423 #define EXECUTOR_FUNCTIONAL_CREATOR0( ret) \424 template<class T> Executor* createExecutor( ret(__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST) \428 #define EXECUTOR_FUNCTIONAL_CREATOR0() \ 429 template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST) \ 425 430 { \ 426 431 return new __EXECUTOR_FUNCTIONAL_NAME(0)<T>(functionPointer); \ … … 431 436 * @param type0 for internal usage: the first Argument 432 437 */ 433 #define EXECUTOR_FUNCTIONAL_CREATOR1( ret,type0) \434 template<class T> Executor* createExecutor( ret(__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \438 #define EXECUTOR_FUNCTIONAL_CREATOR1(type0) \ 439 template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \ 435 440 { \ 436 441 return new __EXECUTOR_FUNCTIONAL_NAME(1)<T, type0##_TYPE>(functionPointer); \ … … 442 447 * @param type1 for internal usage: the second Argument 443 448 */ 444 #define EXECUTOR_FUNCTIONAL_CREATOR2( ret,type0, type1) \445 template<class T> Executor* createExecutor( ret(__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \449 #define EXECUTOR_FUNCTIONAL_CREATOR2(type0, type1) \ 450 template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \ 446 451 { \ 447 452 return new __EXECUTOR_FUNCTIONAL_NAME(2)<T, type0##_TYPE, type1##_TYPE>(functionPointer); \ … … 454 459 * @param type2 for internal usage: the third Argument 455 460 */ 456 #define EXECUTOR_FUNCTIONAL_CREATOR3( ret,type0, type1, type2) \457 template<class T> Executor* createExecutor( ret(__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \461 #define EXECUTOR_FUNCTIONAL_CREATOR3(type0, type1, type2) \ 462 template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \ 458 463 { \ 459 464 return new __EXECUTOR_FUNCTIONAL_NAME(3)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE>(functionPointer); \ … … 467 472 * @param type3 for internal usage: the fourth Argument 468 473 */ 469 #define EXECUTOR_FUNCTIONAL_CREATOR4( ret,type0, type1, type2, type3) \470 template<class T> Executor* createExecutor( ret(__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \474 #define EXECUTOR_FUNCTIONAL_CREATOR4(type0, type1, type2, type3) \ 475 template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \ 471 476 { \ 472 477 return new __EXECUTOR_FUNCTIONAL_NAME(4)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE>(functionPointer); \ … … 481 486 * @param type4 for internal usage: the fifth Argument 482 487 */ 483 #define EXECUTOR_FUNCTIONAL_CREATOR5( ret,type0, type1, type2, type3, type4) \484 template<class T> Executor* createExecutor( ret(__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \488 #define EXECUTOR_FUNCTIONAL_CREATOR5(type0, type1, type2, type3, type4) \ 489 template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \ 485 490 { \ 486 491 return new __EXECUTOR_FUNCTIONAL_NAME(5)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE>(functionPointer); \ -
trunk/src/lib/util/executor/executor_xml.h
r8042 r8048 67 67 } 68 68 69 virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const69 virtual void operator()(BaseObject* object, unsigned int count, void* values) const 70 70 { 71 71 PRINTF(1)("missuse of XML-operator, OR IMPLEMENT.\n"); 72 72 } 73 73 -
trunk/src/lib/util/executor/functor_list.h
r8035 r8048 90 90 #ifdef FUNCTOR_LIST 91 91 92 FUNCTOR_LIST(0)( void);92 FUNCTOR_LIST(0)(); 93 93 //! makes functions with one string 94 FUNCTOR_LIST(1)( void,l_STRING);94 FUNCTOR_LIST(1)(l_STRING); 95 95 //! makes functions with two strings 96 FUNCTOR_LIST(2)( void,l_STRING, l_STRING);96 FUNCTOR_LIST(2)(l_STRING, l_STRING); 97 97 //! makes functions with three strings 98 FUNCTOR_LIST(3)( void,l_STRING, l_STRING, l_STRING);98 FUNCTOR_LIST(3)(l_STRING, l_STRING, l_STRING); 99 99 //! makes functions with four strings 100 FUNCTOR_LIST(4)( void,l_STRING, l_STRING, l_STRING, l_STRING);100 FUNCTOR_LIST(4)(l_STRING, l_STRING, l_STRING, l_STRING); 101 101 102 102 103 103 //! makes functions with one bool 104 FUNCTOR_LIST(1)( void,l_BOOL);104 FUNCTOR_LIST(1)(l_BOOL); 105 105 106 106 //! makes functions with one int 107 FUNCTOR_LIST(1)( void,l_INT);107 FUNCTOR_LIST(1)(l_INT); 108 108 //! makes functions with two ints 109 FUNCTOR_LIST(2)( void,l_INT, l_INT);109 FUNCTOR_LIST(2)(l_INT, l_INT); 110 110 //! makes functions with three ints 111 FUNCTOR_LIST(3)( void,l_INT, l_INT, l_INT);111 FUNCTOR_LIST(3)(l_INT, l_INT, l_INT); 112 112 //! makes functions with four ints 113 FUNCTOR_LIST(4)( void,l_INT, l_INT, l_INT, l_INT);113 FUNCTOR_LIST(4)(l_INT, l_INT, l_INT, l_INT); 114 114 115 115 116 116 //! makes functions with one unsigned int 117 FUNCTOR_LIST(1)( void,l_UINT);117 FUNCTOR_LIST(1)(l_UINT); 118 118 //! makes functions with two unsigned ints 119 FUNCTOR_LIST(2)( void,l_UINT, l_UINT);119 FUNCTOR_LIST(2)(l_UINT, l_UINT); 120 120 //! makes functions with three unsigned ints 121 FUNCTOR_LIST(3)( void,l_UINT, l_UINT, l_UINT);121 FUNCTOR_LIST(3)(l_UINT, l_UINT, l_UINT); 122 122 //! makes functions with four unsigned ints 123 FUNCTOR_LIST(4)( void,l_UINT, l_UINT, l_UINT, l_UINT);123 FUNCTOR_LIST(4)(l_UINT, l_UINT, l_UINT, l_UINT); 124 124 125 125 //! makes functions with one float 126 FUNCTOR_LIST(1)( void,l_FLOAT);126 FUNCTOR_LIST(1)(l_FLOAT); 127 127 //! makes functions with two floats 128 FUNCTOR_LIST(2)( void,l_FLOAT, l_FLOAT);128 FUNCTOR_LIST(2)(l_FLOAT, l_FLOAT); 129 129 //! makes functions with three floats 130 FUNCTOR_LIST(3)( void,l_FLOAT, l_FLOAT, l_FLOAT);130 FUNCTOR_LIST(3)(l_FLOAT, l_FLOAT, l_FLOAT); 131 131 //! makes functions with four floats 132 FUNCTOR_LIST(4)( void,l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT);132 FUNCTOR_LIST(4)(l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT); 133 133 //! makes functions with four floats 134 FUNCTOR_LIST(5)( void,l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT);134 FUNCTOR_LIST(5)(l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT); 135 135 136 136 //! mixed values: 137 FUNCTOR_LIST(2)( void,l_STRING, l_FLOAT);138 FUNCTOR_LIST(2)( void,l_UINT, l_LONG);139 FUNCTOR_LIST(2)( void,l_STRING, l_UINT);137 FUNCTOR_LIST(2)(l_STRING, l_FLOAT); 138 FUNCTOR_LIST(2)(l_UINT, l_LONG); 139 FUNCTOR_LIST(2)(l_STRING, l_UINT); 140 140 141 FUNCTOR_LIST(3)( void,l_STRING, l_FLOAT, l_UINT);142 FUNCTOR_LIST(4)( void,l_STRING, l_FLOAT, l_UINT, l_UINT);143 FUNCTOR_LIST(3)( void,l_STRING, l_INT, l_UINT);144 FUNCTOR_LIST(3)( void,l_STRING, l_UINT, l_UINT);141 FUNCTOR_LIST(3)(l_STRING, l_FLOAT, l_UINT); 142 FUNCTOR_LIST(4)(l_STRING, l_FLOAT, l_UINT, l_UINT); 143 FUNCTOR_LIST(3)(l_STRING, l_INT, l_UINT); 144 FUNCTOR_LIST(3)(l_STRING, l_UINT, l_UINT); 145 145 146 146 #endif /* FUNCTOR_LIST */
Note: See TracChangeset
for help on using the changeset viewer.