Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 16, 2006, 1:38:36 PM (18 years ago)
Author:
bensch
Message:

multiple generic inclusion of Executors, better and nicer interface for include

File:
1 copied

Legend:

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

    r9739 r9740  
    11/*!
    2  * @file executor_functional.h
    3  * Definition of an Executor
     2 * @file functor_member.h
     3 * Definition of an Functor
    44 */
    55
     
    2020
    2121
    22 #ifndef __FUNCTOR_MEMBER_H_
    23 #define __FUNCTOR_MEMBER_H_
     22#ifndef __FUNCTOR_STATIC_H_
     23#define __FUNCTOR_STATIC_H_
    2424
    25 #include "executor_member.h"
     25#include "executor_static.h"
    2626#include "substring.h"
    2727
    28 // // // // // // // // // // // // //
    29 //// EXTENSION TO HIDE CONSTRUCT /////
    30 // // // // // // // // // // // // //
    31 /**
    32  * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
    33  */
    34 #define EXECUTOR_FUNCTIONAL_CREATOR0() \
    35 template<class T> Executor<const SubString>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST) \
    36 { \
    37   return new __EXECUTOR_FUNCTIONAL_NAME(0)<T, const SubString>(functionPointer); \
    38 }
     28#define FUNCTOR_CALL_TYPE const SubString
    3929
    40 /**
    41  * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
    42  * @param type0 for internal usage: the first Argument
    43  */
    44 #define EXECUTOR_FUNCTIONAL_CREATOR1(type0) \
    45 template<class T> Executor<const SubString>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST) \
    46 { \
    47   return new __EXECUTOR_FUNCTIONAL_NAME(1)<T, const SubString, type0>(functionPointer); \
    48 }
     30/// Define all Constructs, that define an Executor.
    4931
    50 /**
    51  * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
    52  * @param type0 for internal usage: the first Argument
    53  * @param type1 for internal usage: the second Argument
    54  */
    55 #define EXECUTOR_FUNCTIONAL_CREATOR2(type0, type1) \
    56 template<class T> Executor<const SubString>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST) \
    57 { \
    58   return new __EXECUTOR_FUNCTIONAL_NAME(2)<T, const SubString, type0, type1>(functionPointer); \
    59 }
     32//! The Name to be attached to the functional (for normal, static, and const modes)
     33#define __EXECUTOR_FUNCTIONAL_NAME(ParamCount)   Executor##ParamCount##Params_static
     34//! if Functional is constant calling
     35#define __EXECUTOR_FUNCTIONAL_CONST
     36//! The Function-Pointer, and how to save it internally.
     37#define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER   *functionPointer
     38//! The Type of Function
     39#define __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE       Executor<CallType, BaseClass>::FunctionStatic
    6040
    61 /**
    62  * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
    63  * @param type0 for internal usage: the first Argument
    64  * @param type1 for internal usage: the second Argument
    65  * @param type2 for internal usage: the third Argument
    66  */
    67 #define EXECUTOR_FUNCTIONAL_CREATOR3(type0, type1, type2) \
    68 template<class T> Executor<const SubString>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST) \
    69 { \
    70   return new __EXECUTOR_FUNCTIONAL_NAME(3)<T, const SubString, type0, type1, type2>(functionPointer); \
    71 }
    72 
    73 /**
    74  * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
    75  * @param type0 for internal usage: the first Argument
    76  * @param type1 for internal usage: the second Argument
    77  * @param type2 for internal usage: the third Argument
    78  * @param type3 for internal usage: the fourth Argument
    79  */
    80 #define EXECUTOR_FUNCTIONAL_CREATOR4(type0, type1, type2, type3) \
    81 template<class T> Executor<const SubString>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST) \
    82 { \
    83   return new __EXECUTOR_FUNCTIONAL_NAME(4)<T, const SubString, type0, type1, type2, type3>(functionPointer); \
    84 }
    85 
    86 /**
    87  * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
    88  * @param type0 for internal usage: the first Argument
    89  * @param type1 for internal usage: the second Argument
    90  * @param type2 for internal usage: the third Argument
    91  * @param type3 for internal usage: the fourth Argument
    92  * @param type4 for internal usage: the fifth Argument
    93  */
    94 #define EXECUTOR_FUNCTIONAL_CREATOR5(type0, type1, type2, type3, type4) \
    95 template<class T> Executor<const SubString>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST) \
    96 { \
    97     return new __EXECUTOR_FUNCTIONAL_NAME(5)<T, const SubString, type0, type1, type2, type3, type4>(functionPointer); \
    98 }
    99 
    100 /**
    101  * Creates the FunctionCallers imediately
    102  */
    103 #define FUNCTOR_LIST(x) EXECUTOR_FUNCTIONAL_CREATOR ## x
    104 #include "functor_list.h"
    105 #undef FUNCTOR_LIST
     41/// Now we include The generic Functor, that generate the functions.
     42#include "functor_generic.h"
    10643
    10744
    108 #undef __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS
     45#undef __EXECUTOR_FUNCTIONAL_NAME
     46#undef __EXECUTOR_FUNCTIONAL_CONST
     47#undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER
     48#undef __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE
     49
     50
     51
     52#endif /* __FUNCTOR_STATIC_H_ */
Note: See TracChangeset for help on using the changeset viewer.