- Timestamp:
- May 3, 2015, 1:54:43 PM (10 years ago)
- Location:
- code/branches/core7/src/libraries
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/libraries/core/UpdateListener.h
r10413 r10418 36 36 namespace orxonox 37 37 { 38 /** 39 * Inherit from UpdateListener if you need to receive calls before or after the game is ticked. All classes inheriting from UpdateListener 40 * need to be strictly independent of each other and may not rely on a specific order in which all UpdateListeners are called. 41 * 42 * If you do have such a dependency between two UpdateListeners, e.g. A::preUpdate() always needs to be called before B::preUpdate(), then 43 * you need to create a third class C (which inherits from UpdateListener) with the following implementation: 44 * void C::preUpdate() 45 * { 46 * A::preUpdate(); 47 * B::preUpdate(); 48 * } 49 * This is the only way to ensure that A gets called before B. In this example, only C inherits from UpdateListener, while A and B do not. 50 * Instead they receive the update from C. 51 */ 38 52 class _CoreExport UpdateListener : virtual public Listable 39 53 { -
code/branches/core7/src/libraries/core/singleton/ScopedSingletonManager.h
r10413 r10418 61 61 If this macro is called for a singleton, it is registered with ScopedSingletonManager 62 62 and will thus be created if its scope becomes active and destroyed if is deactivated. 63 64 65 Usually a singleton gets created automatically when it is first used, but it will never 66 be destroyed (unless the singleton explicitly deletes itself). To allow controlled 67 construction and destruction, the singleton can be put within a virtual scope. This is 68 done by registering the singleton class with orxonox::ScopedSingletonManager. To 69 do so, the ManageScopedSingleton() macro has to be called: 70 71 @code 72 ManageScopedSingleton(TestSingleton, ScopeID::Graphics, false); // muste be called in a source (*.cc) file 73 @endcode 74 75 @b Important: If you call ManageScopedSingleton(), you don't have to initialize singletonPtr_s anymore, 76 because that's already done by the macro. 77 78 Now the singleton TestSingleton gets automatically created if the scope Graphics becomes 79 active and also gets destroyed if the scope is deactivated. 80 81 Note that not all singletons must register with a scope, but it's recommended. 82 63 83 */ 64 84 #define ManageScopedSingleton(className, scope, allowedToFail) \ -
code/branches/core7/src/libraries/util/Singleton.h
r10413 r10418 68 68 TestSingleton* TestSingleton::singletonPtr_s = NULL; 69 69 @endcode 70 71 Usually a singleton gets created automatically when it is first used, but it will never72 be destroyed (unless the singleton explicitly deletes itself). To allow controlled73 construction and destruction, the singleton can be put within a virtual scope. This is74 done by registering the singleton class with orxonox::ScopedSingletonManager. To75 do so, the ManageScopedSingleton() macro has to be called:76 77 @code78 ManageScopedSingleton(TestSingleton, ScopeID::Graphics, false); // muste be called in a source (*.cc) file79 @endcode80 81 @b Important: If you call ManageScopedSingleton(), you don't have to initialize singletonPtr_s anymore,82 because that's already done by the macro.83 84 Now the singleton TestSingleton gets automatically created if the scope Graphics becomes85 active and also gets destroyed if the scope is deactivated.86 87 Note that not all singletons must register with a scope, but it's recommended.88 70 89 71 If a class inherits from orxonox::Singleton, it also inherits its functions. The most important
Note: See TracChangeset
for help on using the changeset viewer.