Changeset 7372 for code/branches/doc/src/libraries/core/Super.h
- Timestamp:
- Sep 7, 2010, 12:58:52 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/doc/src/libraries/core/Super.h
r7363 r7372 37 37 @brief Definition of all super-function related macros. 38 38 39 This file defines all macros needed to add a new "super-function". 40 If you add a super-function, you can call SUPER(myclass, functionname) inside your 41 code and the function of the parentclass gets called. This is comparable with 42 super.functionname() in Java or other languages. 43 44 This works only with virtual functions that return nothing (void) and belong to 45 classes that have an Identifier. Arguments however are supported. 46 47 To add a new super-function, you have process 4 steps: 48 49 1) Add a new SUPER macro 50 This allows you to call the super-function in your code. 51 Location: This file (Super.h), marked with --> HERE <-- comments (1/3) 52 53 2) Call the SUPER_FUNCTION_GLOBAL_DECLARATION_PART1/2 macros. 54 This defines some global classes and templates, needed to create and call the super-functions. 55 Location: This file (Super.h), marked with --> HERE <-- comments (2/3) 56 57 3) Call the SUPER_INTRUSIVE_DECLARATION macro. 58 This will be included into the declaration of ClassIdentifier<T>. 59 Location: This file (Super.h), marked with --> HERE <-- comments (3/3) 60 61 4) Call the SUPER_FUNCTION macro. 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 /> 62 61 This defines a partially specialized template that will decide if a class is "super" to another class. 63 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. 64 63 You have to add this into the header-file of the baseclass of the super-function (the class that first 65 64 implements the function), below the class declaration. You can't call it directly in this file, because 66 otherwise you had to include the headerfile right here, which would cause some ugly back dependencies,67 include loops and slower compilation. 68 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 /> 69 68 Location: The header-file of the baseclass (Baseclass.h), below the class declaration 70 69 */ … … 211 210 */ 212 211 213 // 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 214 213 #ifdef ORXONOX_COMPILER_MSVC 215 214 #define SUPER(classname, functionname, ...) \
Note: See TracChangeset
for help on using the changeset viewer.