Changeset 10418 for code/branches/core7/src/libraries/util
- Timestamp:
- May 3, 2015, 1:54:43 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.