Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/libraries/core/Super.h @ 6839

Last change on this file since 6839 was 6524, checked in by dafrick, 15 years ago

Merged pickup branch into trunk. Yay. Persisting bugs will be fixed, very soon.

  • Property svn:eol-style set to native
File size: 26.4 KB
Line 
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 */
28
29/**
30    @file
31    @brief Definition of all super-function related macros.
32
33    This file defines all macros needed to add a new "super-function".
34    If you add a super-function, you can call SUPER(myclass, functionname) inside your
35    code and the function of the parentclass gets called. This is comparable with
36    super.functionname() in Java or other languages.
37
38    This works only with virtual functions that return nothing (void) and belong to
39    classes that have an Identifier. Arguments however are supported.
40
41    To add a new super-function, you have process 4 steps:
42
43    1) Add a new SUPER macro
44       This allows you to call the super-function in your code.
45       Location: This file (Super.h), marked with --> HERE <-- comments (1/3)
46
47    2) Call the SUPER_FUNCTION_GLOBAL_DECLARATION_PART1/2 macros.
48       This defines some global classes and templates, needed to create and call the super-functions.
49       Location: This file (Super.h), marked with --> HERE <-- comments (2/3)
50
51    3) Call the SUPER_INTRUSIVE_DECLARATION macro.
52       This will be included into the declaration of ClassIdentifier<T>.
53       Location: This file (Super.h), marked with --> HERE <-- comments (3/3)
54
55    4) Call the SUPER_FUNCTION macro.
56       This defines a partially specialized template that will decide if a class is "super" to another class.
57       If the check returns true, a SuperFunctionCaller gets created, which will be used by the SUPER macro.
58       You have to add this into the header-file of the baseclass of the super-function (the class that first
59       implements the function), below the class declaration. You can't call it directly in this file, because
60       otherwise you had to include the headerfile right here, which would cause some ugly backdependencies,
61       include loops and slower compilation.
62       Dont forget to include Super.h in the header-file.
63       Location: The header-file of the baseclass (Baseclass.h), below the class declaration
64*/
65
66#ifndef _Super_H__
67#define _Super_H__
68
69#include "CorePrereqs.h"
70
71#include "util/Debug.h"
72#include "Event.h"
73
74///////////////////////
75// Macro definitions //
76///////////////////////
77
78//// Common macros ////
79
80    /**
81        @brief Declares a new super-function by creating a specialized template. Add this below the class declaration of the baseclass.
82        @param functionnumber Each super-function needs a unique number, starting with zero, increasing by one
83        @param baseclass The baseclass of the super-function (~the root)
84        @param functionname The name of the super-function
85        @param purevirtualbase "true" if the function is pure virtual in the baseclass, "false" if the function is implemented (without "")
86    */
87    #define SUPER_FUNCTION(functionnumber, baseclass, functionname, purevirtualbase) \
88        template <class T, int templatehack2> \
89        struct SuperFunctionCondition<functionnumber, T, 0, templatehack2> \
90        { \
91            static void check() \
92            { \
93                SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(0)); \
94                SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::check(); \
95            } \
96            \
97            static void apply(void* temp) {} \
98            \
99            static void apply(baseclass* temp) \
100            { \
101                ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier(); \
102                for (std::set<const Identifier*>::iterator it = identifier->getDirectChildrenIntern().begin(); it != identifier->getDirectChildrenIntern().end(); ++it) \
103                { \
104                    if (((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_) \
105                    { \
106                        delete ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_; \
107                        ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = 0; \
108                        ((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ = false; \
109                    } \
110                    \
111                    if (!((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_) \
112                    { \
113                        COUT(5) << "Added SuperFunctionCaller for " << #functionname << ": " << ClassIdentifier<T>::getIdentifier()->getName() << " <- " << ((ClassIdentifier<T>*)(*it))->getName() << std::endl; \
114                        ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>; \
115                    } \
116                } \
117            } \
118        }; \
119        \
120        SUPER_FUNCTION_PUREVIRTUAL_WORKAROUND##purevirtualbase(functionnumber, baseclass)
121
122    #define SUPER_FUNCTION_PUREVIRTUAL_WORKAROUND0(functionnumber, baseclass) SUPER_FUNCTION_PUREVIRTUAL_WORKAROUNDfalse(functionnumber, baseclass)
123    #define SUPER_FUNCTION_PUREVIRTUAL_WORKAROUND1(functionnumber, baseclass) SUPER_FUNCTION_PUREVIRTUAL_WORKAROUNDtrue(functionnumber, baseclass)
124    #define SUPER_FUNCTION_PUREVIRTUAL_WORKAROUNDfalse(functionnumber, baseclass)
125    #define SUPER_FUNCTION_PUREVIRTUAL_WORKAROUNDtrue(functionnumber, baseclass) \
126        template <int templatehack2> \
127        struct SuperFunctionCondition<functionnumber, baseclass, 0, templatehack2> \
128        { \
129            static void check() \
130            { \
131                SuperFunctionCondition<functionnumber + 1, baseclass, 0, templatehack2>::check(); \
132            } \
133        };
134
135
136    /*
137    //// Comments about the macro ////
138
139        // Partially specialized template (templatehack is now specialized too).
140        //
141        // This ensures the compiler takes THIS template if the header-file of the super-function
142        // is included. In any other case, the compiler just uses the fallback template which is
143        // defined in this file.
144        template <class T, templatehack2>
145        struct SuperFunctionCondition<functionnumber, T, 0, templatehack2>
146        {
147            static void check()
148            {
149                // This call to the apply-function is the whole check. By calling the function with
150                // a T* pointer, the right function get's called.
151                SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(0));
152
153                // Go go the check for of next super-function (functionnumber + 1)
154                SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::check();
155            }
156
157            // This function gets called if T is not a child of the baseclass.
158            // The function does nothing.
159            static void apply(void* temp) {}
160
161            // This function gets called if T is a child of the baseclass and can therefore be converted.
162            // The function adds a SuperFunctionCaller to the Identifier of all subclasses of T.
163            static void apply(baseclass* temp)
164            {
165                ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier();
166
167                // Iterate through all children
168                for (std::set<const Identifier*>::iterator it = identifier->getDirectChildrenIntern().begin(); it != identifier->getDirectChildrenIntern().end(); ++it)
169                {
170                    // Check if the caller is a fallback-caller
171                    if (((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_)
172                    {
173                        // Delete the fallback caller an prepare to get a real caller
174                        delete ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_;
175                        ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = 0;
176                        ((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ = false;
177                    }
178
179                    // Check if there's not already a caller
180                    if (!((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_)
181                    {
182                        // Add the SuperFunctionCaller
183                        COUT(5) << "adding functionpointer to " << ((ClassIdentifier<T>*)(*it))->getName() << std::endl;
184                        ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>;
185                    }
186                }
187            }
188        };
189        SUPER_FUNCTION_PUREVIRTUAL_WORKAROUND##purevirtualbase
190
191
192        // The following piece of code is only added if purevirtualbase = true
193
194        // Explicit specialization of the Condition template for the baseclass to avoid
195        // errors if the function is pure virtual in the baseclass.
196        template <int templatehack2> \
197        struct SuperFunctionCondition<functionnumber, baseclass, 0, templatehack2> \
198        { \
199            // The check function acts like the fallback - it advances to the check for the next super-function (functionnumber + 1)
200            static void check() \
201            { \
202                SuperFunctionCondition<functionnumber + 1, baseclass, 0, templatehack2>::check(); \
203            } \
204        };
205    */
206
207    // SUPER-macro: Calls Parent::functionname() where Parent is the direct parent of classname
208    #ifdef ORXONOX_COMPILER_MSVC
209        #define SUPER(classname, functionname, ...) \
210            __super::functionname(__VA_ARGS__)
211    #else
212        #define SUPER(classname, functionname, ...) \
213            SUPER_##functionname(classname, functionname, __VA_ARGS__)
214    #endif
215
216    // helper macro: for functions without arguments
217    #define SUPER_NOARGS(classname, functionname) \
218        (*ClassIdentifier<classname>::getIdentifier()->superFunctionCaller_##functionname##_)(this)
219
220    // helper macro: for functions with arguments
221    #define SUPER_ARGS(classname, functionname, ...) \
222        (*ClassIdentifier<classname>::getIdentifier()->superFunctionCaller_##functionname##_)(this, __VA_ARGS__)
223
224
225//// Function-specific macros ////
226
227    /*
228        Add a macro for each super-function
229
230        Example (no arguments):
231        #define SUPER_myfunction(classname, functionname, ...) \
232            SUPER_NOARGS(classname, functionname)
233
234        Example (with arguments):
235        #define SUPER_myfunction(classname, functionname, ...) \
236            SUPER_ARGS(classname, functionname, __VA_ARGS__)
237    */
238
239    // (1/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
240    #define SUPER_XMLPort(classname, functionname, ...) \
241        SUPER_ARGS(classname, functionname, __VA_ARGS__)
242
243    #define SUPER_tick(classname, functionname, ...) \
244        SUPER_ARGS(classname, functionname, __VA_ARGS__)
245
246    #define SUPER_changedActivity(classname, functionname, ...) \
247        SUPER_NOARGS(classname, functionname)
248
249    #define SUPER_changedVisibility(classname, functionname, ...) \
250        SUPER_NOARGS(classname, functionname)
251
252    #define SUPER_XMLEventPort(classname, functionname, ...) \
253        SUPER_ARGS(classname, functionname, __VA_ARGS__)
254
255    #define SUPER_changedScale(classname, functionname, ...) \
256        SUPER_NOARGS(classname, functionname)
257
258    #define SUPER_changedOwner(classname, functionname, ...) \
259        SUPER_NOARGS(classname, functionname)
260
261    #define SUPER_changedOverlayGroup(classname, functionname, ...) \
262        SUPER_NOARGS(classname, functionname)
263
264    #define SUPER_changedName(classname, functionname, ...) \
265        SUPER_NOARGS(classname, functionname)
266
267    #define SUPER_changedGametype(classname, functionname, ...) \
268        SUPER_NOARGS(classname, functionname)
269       
270    #define SUPER_changedUsed(classname, functionname, ...) \
271        SUPER_NOARGS(classname, functionname)
272       
273    #define SUPER_clone(classname, functionname, ...) \
274        SUPER_ARGS(classname, functionname, __VA_ARGS__)
275       
276    #define SUPER_changedCarrier(classname, functionname, ...) \
277        SUPER_NOARGS(classname, functionname)
278       
279    #define SUPER_changedPickedUp(classname, functionname, ...) \
280        SUPER_NOARGS(classname, functionname)
281       
282    // (1/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
283
284
285namespace orxonox
286{
287    /////////////////////////////////////////////////////////////////////////////////////////////////////
288    // This code gets included by Identifier.h and every other header file that needs a super-function //
289    /////////////////////////////////////////////////////////////////////////////////////////////////////
290
291    //// Common code ////
292
293        // Base templates
294        /**
295            @brief Creates the SuperFunctionCaller if T is a child of the super-functions baseclass.
296        */
297        template <int functionnumber, class T, int templatehack1, int templatehack2>
298        struct SuperFunctionCondition
299        {
300            static void check() {}
301        };
302
303        /**
304            @brief Initializes the SuperFunctionCaller-pointer with zero.
305        */
306        template <int functionnumber, class T>
307        struct SuperFunctionInitialization
308        {
309            static void initialize(ClassIdentifier<T>* identifier) {}
310        };
311
312        /**
313            @brief Deletes the SuperFunctionCaller.
314        */
315        template <int functionnumber, class T>
316        struct SuperFunctionDestruction
317        {
318            static void destroy(ClassIdentifier<T>* identifier) {}
319        };
320
321
322    //// Function-specific code ////
323
324        /**
325            @brief Creates the needed objects and templates to call a super-function.
326            @param functionnumber Each super-function needs a unique number, starting with zero, increasing by one
327            @param functionname The name of the super-function
328            @param hasarguments "false" if the function doesn't take any arguments, "true" if it does (without "")
329            @param ... Variadic: If the function takes arguments, add them here with type and name. Example: int myvalue, float myothervalue
330        */
331        #define SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(functionnumber, functionname, hasarguments, ...) \
332            template <class T, int templatehack1, int templatehack2> \
333            struct SuperFunctionCondition<functionnumber, T, templatehack1, templatehack2> \
334            { \
335                static void check() \
336                { \
337                    SuperFunctionCondition<functionnumber + 1, T, templatehack1, templatehack2>::check(); \
338                } \
339            }; \
340            \
341            class _CoreExport SuperFunctionCaller_##functionname \
342            { \
343                public: \
344                    virtual void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) = 0; \
345                    virtual ~SuperFunctionCaller_##functionname () {} \
346            }; \
347            \
348            template <class T> \
349            class SuperFunctionClassCaller_purevirtualfallback_##functionname : public SuperFunctionCaller_##functionname \
350            { \
351                public: \
352                    inline void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) \
353                    { \
354                    } \
355            }; \
356            \
357            template <class T> \
358            struct SuperFunctionInitialization<functionnumber, T> \
359            { \
360                static void initialize(ClassIdentifier<T>* identifier) \
361                { \
362                    identifier->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_purevirtualfallback_##functionname <T>; \
363                    identifier->bSuperFunctionCaller_##functionname##_isFallback_ = true; \
364                    SuperFunctionInitialization<functionnumber + 1, T>::initialize(identifier); \
365                } \
366            }; \
367            \
368            template <class T> \
369            struct SuperFunctionDestruction<functionnumber, T> \
370            { \
371                static void destroy(ClassIdentifier<T>* identifier) \
372                { \
373                    if (identifier->superFunctionCaller_##functionname##_) \
374                        delete identifier->superFunctionCaller_##functionname##_; \
375                    SuperFunctionDestruction<functionnumber + 1, T>::destroy(identifier); \
376                } \
377            }; \
378            \
379            template <class T> \
380            class SuperFunctionClassCaller_##functionname : public SuperFunctionCaller_##functionname \
381            { \
382                public: \
383                    inline void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) \
384                    { \
385                        (dynamic_cast<T*>(object))->T:: functionname
386
387        /*
388            JUST ADD THE FUNCTION ARGUMENTS BETWEEN BOTH MACROS, ENCLOSED BY BRACKETS
389            EXAMPLE:
390
391              SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(0, myfunction, true, int myvalue, float myothervalue) <-- !!! DONT ADD A SEMICOLON HERE !!!
392                (myvalue, myothervalue)
393              SUPER_FUNCTION_GLOBAL_DECLARATION_PART2
394        */
395
396        #define SUPER_FUNCTION_GLOBAL_DECLARATION_PART2 \
397                                                        ; \
398                    } \
399            };
400
401        #define SUPER_CALL_ARGUMENTSfalse(...) OrxonoxClass* object
402        #define SUPER_CALL_ARGUMENTS0(...)     OrxonoxClass* object
403        #define SUPER_CALL_ARGUMENTStrue(...) OrxonoxClass* object, __VA_ARGS__
404        #define SUPER_CALL_ARGUMENTS1(...)    OrxonoxClass* object, __VA_ARGS__
405
406
407    /*
408    //// COMMENTS ABOUT THE MACRO ////
409
410        // Partially specialized template (templatehack not yet specialized, this
411        // will be done by the real condition in the header-file of the super-function)
412        // Only used as fallback
413        template <class T, int templatehack1, int templatehack2>
414        struct SuperFunctionCondition<functionnumber, T, templatehack1, templatehack2>
415        {
416            // If this function gets called, the header-file of the super function is not
417            // included, so this fallback template (templatehack not specialized) is used
418            static void check()
419            {
420                // Calls the condition-check of the next super-function (functionnumber + 1)
421                SuperFunctionCondition<functionnumber + 1, T, templatehack1, templatehack2>::check();
422            }
423        };
424
425        // Baseclass of the super-function caller. The real call will be done by a
426        // templatized subclass through the virtual () operator.
427        class _CoreExport SuperFunctionCaller_##functionname
428        {
429            public:
430                virtual void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) = 0;
431                virtual ~SuperFunctionCaller_##functionname () {}
432        };
433
434        // Fallback if the base is pure virtual
435        template <class T>
436        class SuperFunctionClassCaller_purevirtualfallback_##functionname : public SuperFunctionCaller_##functionname
437        {
438            public:
439                // Fallback does nothing
440                inline void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) )
441                {
442                }
443        };
444
445        // Initializes the SuperFunctionCaller-pointer with a fallback caller in case the base function is pure virtual
446        template <class T>
447        struct SuperFunctionInitialization<functionnumber, T>
448        {
449            static void initialize(ClassIdentifier<T>* identifier)
450            {
451                identifier->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_purevirtualfallback_##functionname <T>;
452                identifier->bSuperFunctionCaller_##functionname##_isFallback_ = true;
453
454                // Calls the initialization of the next super-function (functionnumber + 1)
455                SuperFunctionInitialization<functionnumber + 1, T>::initialize(identifier);
456            }
457        };
458
459        // Deletes the SuperFunctionCaller.
460        template <class T>
461        struct SuperFunctionDestruction<functionnumber, T>
462        {
463            static void destroy(ClassIdentifier<T>* identifier)
464            {
465                if (identifier->superFunctionCaller_##functionname##_)
466                    delete identifier->superFunctionCaller_##functionname##_;
467
468                // Calls the destruction of the next super-function (functionnumber + 1)
469                SuperFunctionDestruction<functionnumber + 1, T>::destroy(identifier);
470            }
471        };
472
473        // The real super-function caller: Calls T::functionname()
474        // T should be the parent, but this will be done by the spezialized condition template
475        template <class T>
476        class SuperFunctionClassCaller_##functionname : public SuperFunctionCaller_##functionname
477        {
478            public:
479                // @brief Calls the function.
480                // @param object The object to call the function on
481                // @param ... The arguments of the function
482                inline void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) )
483                {
484                    (dynamic_cast<T*>(object))->T:: functionname ( Call the function with it's arguments );
485                }
486        }
487    */
488
489
490    //// Execute the code for each super-function ////
491
492        // (2/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
493        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(0, XMLPort, true, Element& xmlelement, XMLPort::Mode mode)
494            (xmlelement, mode)
495        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
496
497        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(1, tick, true, float dt)
498            (dt)
499        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
500
501        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(2, changedActivity, false)
502            ()
503        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
504
505        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(3, changedVisibility, false)
506            ()
507        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
508
509        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(4, XMLEventPort, true, Element& xmlelement, XMLPort::Mode mode)
510            (xmlelement, mode)
511        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
512
513        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(5, changedScale, false)
514            ()
515        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
516
517        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(6, changedOwner, false)
518            ()
519        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
520
521        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(7, changedOverlayGroup, false)
522            ()
523        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
524
525        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(8, changedName, false)
526            ()
527        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
528
529        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(9, changedGametype, false)
530            ()
531        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
532       
533        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(10, changedUsed, false)
534            ()
535        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
536
537        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(11, clone, true, OrxonoxClass* item)
538            (item)
539        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
540       
541        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(12, changedCarrier, false)
542            ()
543        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
544       
545        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(13, changedPickedUp, false)
546            ()
547        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
548
549        // (2/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
550
551}
552
553#else /* _Super_H__ */
554  #ifdef SUPER_INTRUSIVE_DECLARATION_INCLUDE
555
556//////////////////////////////////////////////////////////////////////////
557// This code gets included within the declaration of ClassIdentifier<T> //
558//////////////////////////////////////////////////////////////////////////
559
560//// Common code ////
561
562    private:
563
564        template <int functionnumber, class TT, int templatehack1, int templatehack2>
565        friend struct SuperFunctionCondition;
566
567        // Creates the super-function-callers by calling the first SuperFunctionCondition check
568        // This get's called within the initialization of an Identifier
569        virtual void createSuperFunctionCaller() const
570        {
571            SuperFunctionCondition<0, T, 0, 0>::check();
572        }
573
574
575//// Function-specific code ////
576
577    public:
578        /**
579            @brief Adds a pointer to the SuperFunctionCaller as a member of ClassIdentifier.
580            @param functionname The name of the super-function
581        */
582        #ifndef SUPER_INTRUSIVE_DECLARATION
583          #define SUPER_INTRUSIVE_DECLARATION(functionname) \
584            SuperFunctionCaller_##functionname * superFunctionCaller_##functionname##_; \
585            bool bSuperFunctionCaller_##functionname##_isFallback_
586        #endif
587
588
589//// Execute the code for each super-function ////
590
591    // (3/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
592    SUPER_INTRUSIVE_DECLARATION(XMLPort);
593    SUPER_INTRUSIVE_DECLARATION(tick);
594    SUPER_INTRUSIVE_DECLARATION(changedActivity);
595    SUPER_INTRUSIVE_DECLARATION(changedVisibility);
596    SUPER_INTRUSIVE_DECLARATION(XMLEventPort);
597    SUPER_INTRUSIVE_DECLARATION(changedScale);
598    SUPER_INTRUSIVE_DECLARATION(changedOwner);
599    SUPER_INTRUSIVE_DECLARATION(changedOverlayGroup);
600    SUPER_INTRUSIVE_DECLARATION(changedName);
601    SUPER_INTRUSIVE_DECLARATION(changedGametype);
602    SUPER_INTRUSIVE_DECLARATION(changedUsed);
603    SUPER_INTRUSIVE_DECLARATION(clone);
604    SUPER_INTRUSIVE_DECLARATION(changedCarrier);
605    SUPER_INTRUSIVE_DECLARATION(changedPickedUp);
606    // (3/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
607
608
609    #undef SUPER_INTRUSIVE_DECLARATION_INCLUDE
610  #endif /* SUPER_INTRUSIVE_DECLARATION_INCLUDE */
611#endif /* _Super_H__ */
Note: See TracBrowser for help on using the repository browser.