Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/util/executor/functor_generic.h @ 10146

Last change on this file since 10146 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File size: 4.7 KB
Line 
1/*!
2 * @file functor_generic.h
3 * Definition of an Executor
4 */
5
6/*
7   orxonox - the future of 3D-vertical-scrollers
8
9   Copyright (C) 2004 orx
10
11   This program is free software; you can redistribute it and/or modify
12   it under the terms of the GNU General Public License as published by
13   the Free Software Foundation; either version 2, or (at your option)
14   any later version.
15
16### File Specific:
17   main-programmer: Benjamin Grauer
18   co-programmer: ...
19*/
20
21// // // // // // // // // // // // //
22//// EXTENSION TO HIDE CONSTRUCT /////
23// // // // // // // // // // // // //
24/**
25 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
26 * @param CallType the Type of Executor to generate
27 */
28#define EXECUTOR_FUNCTIONAL_CREATOR0(CallType) \
29template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST) \
30{ \
31  return new __EXECUTOR_FUNCTIONAL_NAME(0,)<T, CallType, BaseClass>(functionPointer); \
32}
33
34/**
35 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
36 * @param CallType the Type of Executor to generate
37 * @param type0 for internal usage: the first Argument
38 */
39#define EXECUTOR_FUNCTIONAL_CREATOR1(CallType, type0) \
40template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST) \
41{ \
42  return new __EXECUTOR_FUNCTIONAL_NAME(1,)<T, CallType, type0, BaseClass>(functionPointer); \
43}
44
45/**
46 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
47 * @param CallType the Type of Executor to generate
48 * @param type0 for internal usage: the first Argument
49 * @param type1 for internal usage: the second Argument
50 */
51#define EXECUTOR_FUNCTIONAL_CREATOR2(CallType, type0, type1) \
52template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST) \
53{ \
54  return new __EXECUTOR_FUNCTIONAL_NAME(2,)<T, CallType, type0, type1, BaseClass>(functionPointer); \
55}
56
57/**
58 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
59 * @param CallType the Type of Executor to generate
60 * @param type0 for internal usage: the first Argument
61 * @param type1 for internal usage: the second Argument
62 * @param type2 for internal usage: the third Argument
63 */
64#define EXECUTOR_FUNCTIONAL_CREATOR3(CallType, type0, type1, type2) \
65template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST) \
66{ \
67  return new __EXECUTOR_FUNCTIONAL_NAME(3,)<T, CallType, type0, type1, type2, BaseClass>(functionPointer); \
68}
69
70/**
71 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
72 * @param CallType the Type of Executor to generate
73 * @param type0 for internal usage: the first Argument
74 * @param type1 for internal usage: the second Argument
75 * @param type2 for internal usage: the third Argument
76 * @param type3 for internal usage: the fourth Argument
77 */
78#define EXECUTOR_FUNCTIONAL_CREATOR4(CallType, type0, type1, type2, type3) \
79template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST) \
80{ \
81  return new __EXECUTOR_FUNCTIONAL_NAME(4,)<T, CallType, type0, type1, type2, type3, BaseClass>(functionPointer); \
82}
83
84/**
85 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
86 * @param CallType the Type of Executor to generate
87 * @param type0 for internal usage: the first Argument
88 * @param type1 for internal usage: the second Argument
89 * @param type2 for internal usage: the third Argument
90 * @param type3 for internal usage: the fourth Argument
91 * @param type4 for internal usage: the fifth Argument
92 */
93#define EXECUTOR_FUNCTIONAL_CREATOR5(CallType, type0, type1, type2, type3, type4) \
94template<class T, class BaseClass> Executor<CallType, BaseClass>* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST) \
95{ \
96    return new __EXECUTOR_FUNCTIONAL_NAME(5,)<T, CallType, type0, type1, type2, type3, type4, BaseClass>(functionPointer); \
97}
98
99/**
100 * Creates the FunctionCallers imediately
101 */
102#define FUNCTOR_LIST(x) EXECUTOR_FUNCTIONAL_CREATOR ## x
103#include "functor_list.h"
104#undef FUNCTOR_LIST
105
Note: See TracBrowser for help on using the repository browser.