Changeset 9737 in orxonox.OLD for branches/new_class_id/src/lib/util/executor/executor_generic.h
- Timestamp:
- Sep 16, 2006, 12:39:23 PM (18 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/util/executor/executor_generic.h
r9736 r9737 1 1 /*! 2 * @file executor_ functional.h3 * Definition of a nExecutor2 * @file executor_generic.h 3 * Definition of a Generic Executor 4 4 */ 5 5 … … 20 20 21 21 22 #ifndef __EXECUTOR_ FUNCTIONAL_H_23 #define __EXECUTOR_ FUNCTIONAL_H_22 #ifndef __EXECUTOR_GENERIC_H_ 23 #define __EXECUTOR_GENERIC_H_ 24 24 25 25 #include "executor.h" … … 106 106 107 107 108 109 110 #endif /* __EXECUTOR_FUNCTIONAL_H_ */111 112 //! if Functional is constant calling113 #define __EXECUTOR_FUNCTIONAL_CONST114 //! The Name to be attached to the functional (for normal, static, and const modes)115 #define __EXECUTOR_FUNCTIONAL_NAME(ParamCount) Executor##ParamCount##Params116 //! The Execution-mode (either static or objective)117 #define __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC dynamic_cast<T*>(object)->*(functionPointer)118 //! The Function-Pointer, and how to save it internally.119 #define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER T::*functionPointer120 #define __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE Executor<CallType, BaseClass>::FunctionDefault121 122 #ifdef EXECUTOR_FUNCTIONAL_USE_CONST //! USING CONST FUNCTIONALS123 #ifdef __EXECUTOR_FUNCTIONAL_CONST_INCLUDED //!< CHECK IF ALREADY INCLUED CONST FUNCTIONALS124 #define __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS125 #else126 #define __EXECUTOR_FUNCTIONAL_CONST_INCLUDED127 #endif128 #undef __EXECUTOR_FUNCTIONAL_CONST129 #define __EXECUTOR_FUNCTIONAL_CONST const130 #undef __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE131 #define __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE Executor<CallType, BaseClass>::FunctionConst132 #undef __EXECUTOR_FUNCTIONAL_NAME133 #define __EXECUTOR_FUNCTIONAL_NAME(ParamCount) Executor##ParamCount##Params_const134 //#endif /* EXECUTOR_FUNCTIONAL_USE_CONST */135 136 #elif defined EXECUTOR_FUNCTIONAL_USE_STATIC137 #ifdef EXECUTOR_FUNCTIONAL_USE_CONST138 #error you obviously do not know what you are doing !! ask the bensch139 #endif140 141 #ifdef __EXECUTOR_FUNCTIONAL_STATIC_INCLUDED142 #define __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS143 #else144 #define __EXECUTOR_FUNCTIONAL_STATIC_INCLUDED145 #endif146 147 #undef __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC148 #define __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC functionPointer149 #undef __EXECUTOR_FUNCTIONAL_NAME150 #define __EXECUTOR_FUNCTIONAL_NAME(ParamCount) Executor##ParamCount##Params_static151 #undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER152 #define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER *functionPointer153 #undef __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE154 #define __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE Executor<CallType, BaseClass>::FunctionStatic155 156 //#endif /* EXECUTOR_FUNCTIONAL_USE_STATIC */157 #else158 #ifdef __EXECUTOR_FUNCTIONAL_PLAIN_INCLUDED159 #define __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS160 #else161 #define __EXECUTOR_FUNCTIONAL_PLAIN_INCLUDED162 #endif163 #endif164 165 #ifndef __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS166 167 168 169 170 108 /////////// 171 109 //// 0 //// … … 456 394 }; 457 395 458 459 460 461 462 463 464 465 466 // // // // // // // // // // // // // 467 //// EXTENSION TO HIDE CONSTRUCT ///// 468 // // // // // // // // // // // // // 469 /** 470 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all) 471 */ 472 #define EXECUTOR_FUNCTIONAL_CREATOR0() \ 473 template<class T> Executor<const SubString>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST) \ 474 { \ 475 return new __EXECUTOR_FUNCTIONAL_NAME(0)<T, const SubString>(functionPointer); \ 476 } 477 478 /** 479 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all) 480 * @param type0 for internal usage: the first Argument 481 */ 482 #define EXECUTOR_FUNCTIONAL_CREATOR1(type0) \ 483 template<class T> Executor<const SubString>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST) \ 484 { \ 485 return new __EXECUTOR_FUNCTIONAL_NAME(1)<T, const SubString, type0>(functionPointer); \ 486 } 487 488 /** 489 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all) 490 * @param type0 for internal usage: the first Argument 491 * @param type1 for internal usage: the second Argument 492 */ 493 #define EXECUTOR_FUNCTIONAL_CREATOR2(type0, type1) \ 494 template<class T> Executor<const SubString>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST) \ 495 { \ 496 return new __EXECUTOR_FUNCTIONAL_NAME(2)<T, const SubString, type0, type1>(functionPointer); \ 497 } 498 499 /** 500 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all) 501 * @param type0 for internal usage: the first Argument 502 * @param type1 for internal usage: the second Argument 503 * @param type2 for internal usage: the third Argument 504 */ 505 #define EXECUTOR_FUNCTIONAL_CREATOR3(type0, type1, type2) \ 506 template<class T> Executor<const SubString>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST) \ 507 { \ 508 return new __EXECUTOR_FUNCTIONAL_NAME(3)<T, const SubString, type0, type1, type2>(functionPointer); \ 509 } 510 511 /** 512 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all) 513 * @param type0 for internal usage: the first Argument 514 * @param type1 for internal usage: the second Argument 515 * @param type2 for internal usage: the third Argument 516 * @param type3 for internal usage: the fourth Argument 517 */ 518 #define EXECUTOR_FUNCTIONAL_CREATOR4(type0, type1, type2, type3) \ 519 template<class T> Executor<const SubString>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST) \ 520 { \ 521 return new __EXECUTOR_FUNCTIONAL_NAME(4)<T, const SubString, type0, type1, type2, type3>(functionPointer); \ 522 } 523 524 /** 525 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all) 526 * @param type0 for internal usage: the first Argument 527 * @param type1 for internal usage: the second Argument 528 * @param type2 for internal usage: the third Argument 529 * @param type3 for internal usage: the fourth Argument 530 * @param type4 for internal usage: the fifth Argument 531 */ 532 #define EXECUTOR_FUNCTIONAL_CREATOR5(type0, type1, type2, type3, type4) \ 533 template<class T> Executor<const SubString>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST) \ 534 { \ 535 return new __EXECUTOR_FUNCTIONAL_NAME(5)<T, const SubString, type0, type1, type2, type3, type4>(functionPointer); \ 536 } 537 538 539 /** 540 * Creates the FunctionCallers 541 */ 542 #define FUNCTOR_LIST(x) EXECUTOR_FUNCTIONAL_CREATOR ## x 543 #include "functor_list.h" 544 #undef FUNCTOR_LIST 545 546 547 548 #undef __EXECUTOR_FUNCTIONAL_CONST 549 #undef __EXECUTOR_FUNCTIONAL_NAME 550 #undef __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC 551 #undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER 552 #undef __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE 553 554 #ifdef EXECUTOR_FUNCTIONAL_USE_CONST 555 #undef EXECUTOR_FUNCTIONAL_USE_CONST 556 #endif 557 #ifdef EXECUTOR_FUNCTIONAL_USE_STATIC 558 #undef EXECUTOR_FUNCTIONAL_USE_STATIC 559 #endif 560 561 562 #endif /* __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS */ 563 #undef __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS 396 #ifndef __EXECUTOR_GENERIC_H_
Note: See TracChangeset
for help on using the changeset viewer.