Changeset 7401 for code/trunk/src/libraries/core/Super.h
- Timestamp:
- Sep 11, 2010, 12:34:00 AM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/doc (added) merged: 7290-7292,7296-7300,7302-7304,7306-7312,7315-7318,7323,7325,7327,7331-7332,7334-7335,7345-7347,7352-7353,7356-7357,7361,7363-7367,7371-7375,7388
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/Super.h
r7163 r7401 28 28 29 29 /** 30 @defgroup Super Super 31 @ingroup Class 32 */ 33 34 /** 30 35 @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 your35 code and the function of the parentclass gets called. This is comparable with36 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.36 @ingroup Class Super 37 @brief Definition of all super-function related macros, used to call functions of the base class. 38 39 This file defines all macros needed to add a new "super-function". If you add 40 a super-function, you can call <tt>SUPER(myclass, functionname, arguments)</tt> 41 inside your code and the function of the parent-class gets called. This is comparable 42 to <tt>super.functionname(arguments)</tt> in Java or other languages. 43 44 This works only with virtual functions that return nothing (@c void) and belong to 45 classes that have an @ref orxonox::Identifier "Identifier". Arguments however are 46 supported, there's no limitation for their number and type, except that the type has 47 to be known in Super.h. 48 49 To add a new super-function, you have to process 4 steps: 50 51 -# Add a new @c SUPER macro <br /> 52 This allows you to call the super-function in your code. <br /> 53 Location: This file (Super.h), marked with "--> HERE <--" comments (1/3) 54 -# Call the @c SUPER_FUNCTION_GLOBAL_DECLARATION_PART1/2 macros. <br /> 55 This defines some global classes and templates, needed to create and call the super-functions. <br /> 56 Location: This file (Super.h), marked with "--> HERE <--" comments (2/3) 57 -# Call the @c SUPER_INTRUSIVE_DECLARATION macro. <br /> 58 This will be included into the declaration of @c ClassIdentifier<T>. <br /> 59 Location: This file (Super.h), marked with "--> HERE <--" comments (3/3) 60 -# Call the @c SUPER_FUNCTION macro. <br /> 56 61 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 theSUPER macro.62 If the check returns true, a @c SuperFunctionCaller gets created, which will be used by the @c SUPER macro. 58 63 You have to add this into the header-file of the baseclass of the super-function (the class that first 59 64 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 back dependencies,61 include loops and slower compilation. 62 Dont forget to include Super.h in the header-file. 65 otherwise you had to include the headerfile right here, which would cause some ugly back-dependencies, 66 include loops and slower compilation. <br /> 67 Dont forget to include Super.h in the header-file. <br /> 63 68 Location: The header-file of the baseclass (Baseclass.h), below the class declaration 64 69 */ … … 205 210 */ 206 211 207 // SUPER-macro: Calls Parent::functionname() where Parent is the direct parent ofclassname212 /// SUPER-macro: Calls Parent::functionname(...) where Parent is the direct parent of @a classname 208 213 #ifdef ORXONOX_COMPILER_MSVC 209 214 #define SUPER(classname, functionname, ...) \
Note: See TracChangeset
for help on using the changeset viewer.