Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/core/Functor.h @ 2680

Last change on this file since 2680 was 2662, checked in by rgrieder, 16 years ago

Merged presentation branch back to trunk.

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