Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/core2/src/orxonox/core/Functor.h @ 967

Last change on this file since 967 was 967, checked in by landauf, 16 years ago

hum, i forgot what i was doing there… oh wait, i remember… it had something to do with executor evaluation. strange thing, no wonder my brain has a leak or something… what's that SVN thing all around my cursor? what's a cursor anyway? oh, and what am i doing here? i feel like having breakfast and it's all dark… stupid clock change…

File size: 20.4 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *
4 *
5 *   License notice:
6 *
7 *   This program is free software; you can redistribute it and/or
8 *   modify it under the terms of the GNU General Public License
9 *   as published by the Free Software Foundation; either version 2
10 *   of the License, or (at your option) any later version.
11 *
12 *   This program is distributed in the hope that it will be useful,
13 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 *   GNU General Public License for more details.
16 *
17 *   You should have received a copy of the GNU General Public License
18 *   along with this program; if not, write to the Free Software
19 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 *
21 *   Author:
22 *      Fabian 'x3n' Landau
23 *   Co-authors:
24 *      ...
25 *
26 *   Inspiration: Functor by Benjamin Grauer
27 */
28
29#ifndef _Functor_H__
30#define _Functor_H__
31
32#include "util/MultiTypeMath.h"
33#include "Debug.h"
34
35#include "CorePrereqs.h"
36
37#define MAX_FUNCTOR_ARGUMENTS 5
38
39namespace orxonox
40{
41    enum FunctionType
42    {
43        FT_MEMBER,
44        FT_CONSTMEMBER,
45        FT_STATIC
46    };
47
48
49    template <class T>
50    inline std::string typeToString() { return "unknown"; }
51
52#define CreateTypeToStringTemplate(type) \
53    template <> \
54    inline std::string typeToString<type>() { return #type; } \
55    template <> \
56    inline std::string typeToString<type&>() { return #type; } \
57    template <> \
58    inline std::string typeToString<const type>() { return #type; } \
59    template <> \
60    inline std::string typeToString<const type&>() { return #type; }
61
62    CreateTypeToStringTemplate(int);
63    CreateTypeToStringTemplate(unsigned int);
64    CreateTypeToStringTemplate(char);
65    CreateTypeToStringTemplate(unsigned char);
66    CreateTypeToStringTemplate(short);
67    CreateTypeToStringTemplate(unsigned short);
68    CreateTypeToStringTemplate(long);
69    CreateTypeToStringTemplate(unsigned long);
70    CreateTypeToStringTemplate(float);
71    CreateTypeToStringTemplate(double);
72    CreateTypeToStringTemplate(long double);
73    CreateTypeToStringTemplate(bool);
74    CreateTypeToStringTemplate(Vector2);
75    CreateTypeToStringTemplate(Vector3);
76    CreateTypeToStringTemplate(Quaternion);
77    CreateTypeToStringTemplate(ColourValue);
78    CreateTypeToStringTemplate(Radian);
79    CreateTypeToStringTemplate(Degree);
80
81    template <> \
82    inline std::string typeToString<std::string>() { return "string"; } \
83    template <> \
84    inline std::string typeToString<std::string&>() { return "string"; } \
85    template <> \
86    inline std::string typeToString<const std::string>() { return "string"; } \
87    template <> \
88    inline std::string typeToString<const std::string&>() { return "string"; }
89
90    class _CoreExport Functor
91    {
92        public:
93            Functor() {}
94            virtual ~Functor() {}
95
96            virtual void operator()(const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) = 0;
97
98            inline unsigned int getParamCount() const { return this->numParams_; }
99            inline bool hasReturnvalue() const { return this->hasReturnValue_; }
100            inline FunctionType getType() const { return this->type_; }
101            inline MultiTypeMath getReturnvalue() const { return this->returnedValue_; }
102
103            std::string getTypenameParam(unsigned int param) const { return (param >= 0 && param < 5) ? this->typeParam_[param] : ""; }
104            std::string getTypenameReturnvalue() const { return this->typeReturnvalue_; }
105
106            virtual void evaluateParam(unsigned int index, MultiTypeMath& param) const = 0;
107
108        protected:
109            unsigned int numParams_;
110            bool hasReturnValue_;
111            FunctionType type_;
112            MultiTypeMath returnedValue_;
113
114            std::string typeReturnvalue_;
115            std::string typeParam_[MAX_FUNCTOR_ARGUMENTS];
116    };
117
118    class _CoreExport FunctorStatic : public Functor
119    {
120        public:
121            virtual ~FunctorStatic() {}
122            virtual void operator()(const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) = 0;
123    };
124
125    template <class T>
126    class FunctorMember : public Functor
127    {
128        public:
129            FunctorMember()
130            {
131                constObject_ = 0;
132                object_ = 0;
133                bConstObject_ = false;
134            }
135            virtual ~FunctorMember() {}
136
137            virtual void operator()(T* object, const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) = 0;
138            virtual void operator()(const T* object, const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) = 0;
139
140            virtual void operator()(const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null)
141            {
142                if (this->bConstObject_)
143                {
144                    if (this->constObject_)
145                        (*this)(this->constObject_, param1, param2, param3, param4, param5);
146                    else
147                    {
148                        COUT(1) << "An error occurred in Functor.h:" << std::endl;
149                        COUT(1) << "Error: No const object set." << std::endl;
150                    }
151                }
152                else
153                {
154                    if (this->object_)
155                        (*this)(this->object_, param1, param2, param3, param4, param5);
156                    else
157                    {
158                        COUT(1) << "An error occurred in Functor.h:" << std::endl;
159                        COUT(1) << "Error: No object set." << std::endl;
160                    }
161                }
162            }
163
164            void setObject(T* object)
165            {
166                this->bConstObject_ = false;
167                this->object_ = object;
168            }
169
170            void setObject(const T* object)
171            {
172                this->bConstObject_ = true;
173                this->constObject_ = object;
174            }
175
176        private:
177            const T* constObject_;
178            T* object_;
179            bool bConstObject_;
180    };
181
182
183
184#define FUNCTOR_TEMPLATE(ismember, returnvalue, numparams) FUNCTOR_TEMPLATE##ismember##returnvalue##numparams
185#define FUNCTOR_TEMPLATE000
186#define FUNCTOR_TEMPLATE001 template <class P1>
187#define FUNCTOR_TEMPLATE002 template <class P1, class P2>
188#define FUNCTOR_TEMPLATE003 template <class P1, class P2, class P3>
189#define FUNCTOR_TEMPLATE004 template <class P1, class P2, class P3, class P4>
190#define FUNCTOR_TEMPLATE005 template <class P1, class P2, class P3, class P4, class P5>
191#define FUNCTOR_TEMPLATE010 template <class R>
192#define FUNCTOR_TEMPLATE011 template <class R, class P1>
193#define FUNCTOR_TEMPLATE012 template <class R, class P1, class P2>
194#define FUNCTOR_TEMPLATE013 template <class R, class P1, class P2, class P3>
195#define FUNCTOR_TEMPLATE014 template <class R, class P1, class P2, class P3, class P4>
196#define FUNCTOR_TEMPLATE015 template <class R, class P1, class P2, class P3, class P4, class P5>
197#define FUNCTOR_TEMPLATE100 template <class T>
198#define FUNCTOR_TEMPLATE101 template <class T, class P1>
199#define FUNCTOR_TEMPLATE102 template <class T, class P1, class P2>
200#define FUNCTOR_TEMPLATE103 template <class T, class P1, class P2, class P3>
201#define FUNCTOR_TEMPLATE104 template <class T, class P1, class P2, class P3, class P4>
202#define FUNCTOR_TEMPLATE105 template <class T, class P1, class P2, class P3, class P4, class P5>
203#define FUNCTOR_TEMPLATE110 template <class T, class R>
204#define FUNCTOR_TEMPLATE111 template <class T, class R, class P1>
205#define FUNCTOR_TEMPLATE112 template <class T, class R, class P1, class P2>
206#define FUNCTOR_TEMPLATE113 template <class T, class R, class P1, class P2, class P3>
207#define FUNCTOR_TEMPLATE114 template <class T, class R, class P1, class P2, class P3, class P4>
208#define FUNCTOR_TEMPLATE115 template <class T, class R, class P1, class P2, class P3, class P4, class P5>
209
210
211
212#define FUNCTOR_TEMPLATE_CLASSES(ismember, returnvalue, numparams) FUNCTOR_TEMPLATE_CLASSES##ismember##returnvalue##numparams
213#define FUNCTOR_TEMPLATE_CLASSES000
214#define FUNCTOR_TEMPLATE_CLASSES001 <P1>
215#define FUNCTOR_TEMPLATE_CLASSES002 <P1, P2>
216#define FUNCTOR_TEMPLATE_CLASSES003 <P1, P2, P3>
217#define FUNCTOR_TEMPLATE_CLASSES004 <P1, P2, P3, P4>
218#define FUNCTOR_TEMPLATE_CLASSES005 <P1, P2, P3, P4, P5>
219#define FUNCTOR_TEMPLATE_CLASSES010 <R>
220#define FUNCTOR_TEMPLATE_CLASSES011 <R, P1>
221#define FUNCTOR_TEMPLATE_CLASSES012 <R, P1, P2>
222#define FUNCTOR_TEMPLATE_CLASSES013 <R, P1, P2, P3>
223#define FUNCTOR_TEMPLATE_CLASSES014 <R, P1, P2, P3, P4>
224#define FUNCTOR_TEMPLATE_CLASSES015 <R, P1, P2, P3, P4, P5>
225#define FUNCTOR_TEMPLATE_CLASSES100 <T>
226#define FUNCTOR_TEMPLATE_CLASSES101 <T, P1>
227#define FUNCTOR_TEMPLATE_CLASSES102 <T, P1, P2>
228#define FUNCTOR_TEMPLATE_CLASSES103 <T, P1, P2, P3>
229#define FUNCTOR_TEMPLATE_CLASSES104 <T, P1, P2, P3, P4>
230#define FUNCTOR_TEMPLATE_CLASSES105 <T, P1, P2, P3, P4, P5>
231#define FUNCTOR_TEMPLATE_CLASSES110 <T, R>
232#define FUNCTOR_TEMPLATE_CLASSES111 <T, R, P1>
233#define FUNCTOR_TEMPLATE_CLASSES112 <T, R, P1, P2>
234#define FUNCTOR_TEMPLATE_CLASSES113 <T, R, P1, P2, P3>
235#define FUNCTOR_TEMPLATE_CLASSES114 <T, R, P1, P2, P3, P4>
236#define FUNCTOR_TEMPLATE_CLASSES115 <T, R, P1, P2, P3, P4, P5>
237
238
239
240#define FUNCTOR_TYPENAME_PARAMS(numparams) FUNCTOR_TYPENAME_PARAMS##numparams
241#define FUNCTOR_TYPENAME_PARAMS0
242#define FUNCTOR_TYPENAME_PARAMS1 this->typeParam_[0] = typeToString<P1>();
243#define FUNCTOR_TYPENAME_PARAMS2 this->typeParam_[0] = typeToString<P1>(); this->typeParam_[1] = typeToString<P2>();
244#define FUNCTOR_TYPENAME_PARAMS3 this->typeParam_[0] = typeToString<P1>(); this->typeParam_[1] = typeToString<P2>(); this->typeParam_[2] = typeToString<P3>();
245#define FUNCTOR_TYPENAME_PARAMS4 this->typeParam_[0] = typeToString<P1>(); this->typeParam_[1] = typeToString<P2>(); this->typeParam_[2] = typeToString<P3>(); this->typeParam_[3] = typeToString<P4>();
246#define FUNCTOR_TYPENAME_PARAMS5 this->typeParam_[0] = typeToString<P1>(); this->typeParam_[1] = typeToString<P2>(); this->typeParam_[2] = typeToString<P3>(); this->typeParam_[3] = typeToString<P4>(); this->typeParam_[4] = typeToString<P5>();
247
248#define FUNCTOR_TYPENAME_RETURN(returnvalue) FUNCTOR_TYPENAME_RETURN##returnvalue
249#define FUNCTOR_TYPENAME_RETURN0
250#define FUNCTOR_TYPENAME_RETURN1 this->typeReturnvalue_ = typeToString<R>();
251
252
253
254#define FUNCTOR_FUNCTION_PARAMS(numparams) FUNCTOR_FUNCTION_PARAMS##numparams
255#define FUNCTOR_FUNCTION_PARAMS0
256#define FUNCTOR_FUNCTION_PARAMS1 P1 param1
257#define FUNCTOR_FUNCTION_PARAMS2 P1 param1, P2 param2
258#define FUNCTOR_FUNCTION_PARAMS3 P1 param1, P2 param2, P3 param3
259#define FUNCTOR_FUNCTION_PARAMS4 P1 param1, P2 param2, P3 param3, P4 param4
260#define FUNCTOR_FUNCTION_PARAMS5 P1 param1, P2 param2, P3 param3, P4 param4, P5 param5
261
262#define FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) FUNCTOR_FUNCTION_RETURNVALUE##returnvalue
263#define FUNCTOR_FUNCTION_RETURNVALUE0 void
264#define FUNCTOR_FUNCTION_RETURNVALUE1 R
265
266
267
268#define FUNCTOR_FUNCTION_CALL(numparams) FUNCTOR_FUNCTION_CALL##numparams
269#define FUNCTOR_FUNCTION_CALL0
270#define FUNCTOR_FUNCTION_CALL1 param1
271#define FUNCTOR_FUNCTION_CALL2 param1, param2
272#define FUNCTOR_FUNCTION_CALL3 param1, param2, param3
273#define FUNCTOR_FUNCTION_CALL4 param1, param2, param3, param4
274#define FUNCTOR_FUNCTION_CALL5 param1, param2, param3, param4, param5
275
276#define FUNCTOR_STORE_RETURNVALUE(returnvalue, functioncall) FUNCTOR_STORE_RETURNVALUE##returnvalue(functioncall)
277#define FUNCTOR_STORE_RETURNVALUE0(functioncall) functioncall
278#define FUNCTOR_STORE_RETURNVALUE1(functioncall) this->returnedValue_ = functioncall
279
280
281
282#define FUNCTOR_EVALUATE_PARAM(numparams) FUNCTOR_EVALUATE_PARAM##numparams
283#define FUNCTOR_EVALUATE_PARAM0
284#define FUNCTOR_EVALUATE_PARAM1 \
285    if (index == 0) param = (P1)param
286#define FUNCTOR_EVALUATE_PARAM2 \
287    if (index == 0) param = (P1)param; \
288    else if (index == 1) param = (P2)param
289#define FUNCTOR_EVALUATE_PARAM3 \
290    if (index == 0) param = (P1)param; \
291    else if (index == 1) param = (P2)param; \
292    else if (index == 2) param = (P3)param
293#define FUNCTOR_EVALUATE_PARAM4 \
294    if (index == 0) param = (P1)param; \
295    else if (index == 1) param = (P2)param; \
296    else if (index == 2) param = (P3)param; \
297    else if (index == 3) param = (P4)param
298#define FUNCTOR_EVALUATE_PARAM5 \
299    if (index == 0) param = (P1)param; \
300    else if (index == 1) param = (P2)param; \
301    else if (index == 2) param = (P3)param; \
302    else if (index == 3) param = (P4)param; \
303    else if (index == 4) param = (P5)param
304
305
306
307
308
309#define CREATE_STATIC_FUNCTOR(returnvalue, numparams) \
310    FUNCTOR_TEMPLATE(0, returnvalue, numparams) \
311    class FunctorStatic##returnvalue##numparams : public FunctorStatic \
312    { \
313        public: \
314            FunctorStatic##returnvalue##numparams(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams))) \
315            { \
316                this->numParams_ = numparams; \
317                this->hasReturnValue_ = returnvalue; \
318                this->type_ = FT_STATIC; \
319                this->functionPointer_ = functionPointer; \
320                \
321                FUNCTOR_TYPENAME_PARAMS(numparams); \
322                FUNCTOR_TYPENAME_RETURN(returnvalue); \
323            } \
324    \
325            void operator()(const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) \
326            { \
327                FUNCTOR_STORE_RETURNVALUE(returnvalue, (*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
328            } \
329    \
330            virtual void evaluateParam(unsigned int index, MultiTypeMath& param) const \
331            { \
332                FUNCTOR_EVALUATE_PARAM(numparams); \
333            } \
334    \
335        private: \
336            FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (*functionPointer_)(FUNCTOR_FUNCTION_PARAMS(numparams)); \
337    }; \
338    \
339    \
340    FUNCTOR_TEMPLATE(0, returnvalue, numparams) \
341    inline FunctorStatic##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(0, returnvalue, numparams)* createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams))) \
342    { \
343        return new FunctorStatic##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(0, returnvalue, numparams) (functionPointer); \
344    }
345
346
347
348
349
350#define CREATE_MEMBER_FUNCTOR(returnvalue, numparams) \
351    FUNCTOR_TEMPLATE(1, returnvalue, numparams) \
352    class FunctorMember##returnvalue##numparams : public FunctorMember<T> \
353    { \
354        public: \
355            FunctorMember##returnvalue##numparams(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams))) \
356            { \
357                this->numParams_ = numparams; \
358                this->hasReturnValue_ = returnvalue; \
359                this->type_ = FT_MEMBER; \
360                this->functionPointer_ = functionPointer; \
361            } \
362    \
363            void operator()(T* object, const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) \
364            { \
365                FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
366            } \
367    \
368            void operator()(const T* object, const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) \
369            { \
370                COUT(1) << "An error occurred in Functor.h:" << std::endl; \
371                COUT(1) << "Error: Function is not const." << std::endl; \
372            } \
373    \
374            virtual void evaluateParam(unsigned int index, MultiTypeMath& param) const \
375            { \
376                FUNCTOR_EVALUATE_PARAM(numparams); \
377            } \
378    \
379        private: \
380            FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer_)(FUNCTOR_FUNCTION_PARAMS(numparams)); \
381    }; \
382    \
383    \
384    FUNCTOR_TEMPLATE(1, returnvalue, numparams) \
385    class FunctorConstMember##returnvalue##numparams : public FunctorMember<T> \
386    { \
387        public: \
388            FunctorConstMember##returnvalue##numparams(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams)) const) \
389            { \
390                this->numParams_ = numparams; \
391                this->hasReturnValue_ = returnvalue; \
392                this->type_ = FT_CONSTMEMBER; \
393                this->functionPointer_ = functionPointer; \
394            } \
395    \
396            void operator()(T* object, const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) \
397            { \
398                FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
399            } \
400    \
401            void operator()(const T* object, const MultiTypeMath& param1 = MT_null, const MultiTypeMath& param2 = MT_null, const MultiTypeMath& param3 = MT_null, const MultiTypeMath& param4 = MT_null, const MultiTypeMath& param5 = MT_null) \
402            { \
403                FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
404            } \
405    \
406            virtual void evaluateParam(unsigned int index, MultiTypeMath& param) const \
407            { \
408                FUNCTOR_EVALUATE_PARAM(numparams); \
409            } \
410    \
411        private: \
412            FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer_)(FUNCTOR_FUNCTION_PARAMS(numparams)) const; \
413    }; \
414    \
415    \
416    FUNCTOR_TEMPLATE(1, returnvalue, numparams) \
417    inline FunctorMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams)* createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams))) \
418    { \
419        return new FunctorMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams) (functionPointer); \
420    } \
421    \
422    \
423    FUNCTOR_TEMPLATE(1, returnvalue, numparams) \
424    inline FunctorConstMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams)* createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams)) const) \
425    { \
426        return new FunctorConstMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams) (functionPointer); \
427    }
428
429
430
431
432#define CREATE_ALL_STATIC_FUNCTORS() \
433    CREATE_STATIC_FUNCTOR(0, 0); \
434    CREATE_STATIC_FUNCTOR(0, 1); \
435    CREATE_STATIC_FUNCTOR(0, 2); \
436    CREATE_STATIC_FUNCTOR(0, 3); \
437    CREATE_STATIC_FUNCTOR(0, 4); \
438    CREATE_STATIC_FUNCTOR(0, 5); \
439    CREATE_STATIC_FUNCTOR(1, 0); \
440    CREATE_STATIC_FUNCTOR(1, 1); \
441    CREATE_STATIC_FUNCTOR(1, 2); \
442    CREATE_STATIC_FUNCTOR(1, 3); \
443    CREATE_STATIC_FUNCTOR(1, 4); \
444    CREATE_STATIC_FUNCTOR(1, 5)
445
446
447#define CREATE_ALL_MEMBER_FUNCTORS() \
448    CREATE_MEMBER_FUNCTOR(0, 0); \
449    CREATE_MEMBER_FUNCTOR(0, 1); \
450    CREATE_MEMBER_FUNCTOR(0, 2); \
451    CREATE_MEMBER_FUNCTOR(0, 3); \
452    CREATE_MEMBER_FUNCTOR(0, 4); \
453    CREATE_MEMBER_FUNCTOR(0, 5); \
454    CREATE_MEMBER_FUNCTOR(1, 0); \
455    CREATE_MEMBER_FUNCTOR(1, 1); \
456    CREATE_MEMBER_FUNCTOR(1, 2); \
457    CREATE_MEMBER_FUNCTOR(1, 3); \
458    CREATE_MEMBER_FUNCTOR(1, 4); \
459    CREATE_MEMBER_FUNCTOR(1, 5)
460
461
462    CREATE_ALL_STATIC_FUNCTORS();
463    CREATE_ALL_MEMBER_FUNCTORS();
464}
465
466#endif /* _Functor_H__ */
Note: See TracBrowser for help on using the repository browser.