Changeset 7401 for code/trunk/src/libraries/core/CoreIncludes.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/CoreIncludes.h
r6423 r7401 28 28 29 29 /** 30 @defgroup Factory RegisterObject() and CreateFactory() 31 @ingroup Object 32 */ 33 34 /** 30 35 @file 31 @brief Definition of macros for Identifiers 36 @ingroup Object Factory 37 @brief Defines several very important macros used to register objects, create factories, and to work with identifiers. 32 38 33 Every class needs the RegisterObject(class) macro in its constructor. If the class is an interface34 or the BaseObject itself, it needs the macroRegisterRootObject(class) instead.39 Every class needs the @c RegisterObject(class) macro in its constructor. If the class is an interface 40 or the @c BaseObject itself, it needs the macro @c RegisterRootObject(class) instead. 35 41 36 To allow the object being created through the factory, use the CreateFactory(class) macro outside 37 the of the class implementation, so it gets executed before main(). 42 To allow the object being created through the factory, use the @c CreateFactory(class) macro outside 43 of the class implementation, so it gets executed statically before @c main(). This will at the same time 44 register @a class in the class-hierarchy. If you don't want @a class to be loadable, but still 45 register it, call @c CreateUnloadableFactory(class). 46 47 Example: 48 @code 49 // Create the factory for MyClass 50 CreateFactory(MyClass); 51 52 // Constructor: 53 MyClass::MyClass() 54 { 55 // Register the object in the Identifier of MyClass 56 RegisterObject(MyClass); 57 } 58 @endcode 59 60 This file also defines a number of other useful macros, like, for example, @c Class(class) which 61 returns the @ref orxonox::Identifier "Identifier" of @a class, or @c ClassByString("class") which 62 returns the Identifier of a class with name @a "class". 63 64 Example: 65 @code 66 // Assigns the Identifier of MyClass 67 Identifier* identifier = Class(MyClass); 68 @endcode 69 @code 70 // Assigns the Identifier of a class named "MyClass" 71 Identifier* identifier = ClassByString("MyClass"); 72 @endcode 38 73 */ 39 74 … … 51 86 52 87 /** 53 @brief Intern macro, containing the common parts of RegisterObject andRegisterRootObject.88 @brief Intern macro, containing the common parts of @c RegisterObject and @c RegisterRootObject. 54 89 @param ClassName The name of the class 55 @param bRootClass True if the class is directly derived from OrxonoxClass90 @param bRootClass True if the class is directly derived from orxonox::OrxonoxClass 56 91 */ 57 92 #define InternRegisterObject(ClassName, bRootClass) \ … … 62 97 63 98 /** 64 @brief Register Object - with and without debug output.99 @brief Registers a newly created object in the core. Has to be called at the beginning of the constructor of @a ClassName. 65 100 @param ClassName The name of the class 66 101 */ … … 69 104 70 105 /** 71 @brief Register RootObject - with and without debug output.106 @brief Registers a newly created object in the core. Has to be called at the beginning of the constructor of @a ClassName. 72 107 @param ClassName The name of the class 108 109 In contrast to RegisterObject, this is used for classes that inherit directly from 110 orxonox::OrxonoxClass, namely all interfaces and orxonox::BaseObject. 73 111 */ 74 112 #define RegisterRootObject(ClassName) \ … … 101 139 /** 102 140 @brief Returns the Identifier with a given name. 103 @param StringThe name of the class141 @param name The name of the class 104 142 */ 105 143 inline Identifier* ClassByString(const std::string& name) … … 110 148 /** 111 149 @brief Returns the Identifier with a given lowercase name. 112 @param StringThe lowercase name of the class150 @param name The lowercase name of the class 113 151 */ 114 152 inline Identifier* ClassByLowercaseString(const std::string& name) … … 119 157 /** 120 158 @brief Returns the Identifier with a given network ID. 121 @param networkIDThe network ID of the class159 @param id The network ID of the class 122 160 */ 123 161 inline Identifier* ClassByID(uint32_t id) … … 130 168 @note This of course only works with OrxonoxClasses. 131 169 The only use is in conjunction with macros that don't know the class type. 132 @param Pointer to an OrxonoxClass170 @param object Pointer to an OrxonoxClass 133 171 */ 134 172 template <class T>
Note: See TracChangeset
for help on using the changeset viewer.