![]() |
ezEngine
Release 25.03
|
ezSingletonRegistry knows about all singleton instances of classes that use EZ_DECLARE_SINGLETON. More...
#include <Singleton.h>
Classes | |
struct | SingletonEntry |
Static Public Member Functions | |
template<typename Interface > | |
static Interface * | GetSingletonInstance () |
Retrieves a singleton instance by type name. Returns nullptr if no singleton instance is available. More... | |
template<typename Interface > | |
static Interface * | GetRequiredSingletonInstance () |
Retrieves a singleton instance by type name. Asserts if no singleton instance is available. | |
static const ezMap< size_t, SingletonEntry > & | GetAllRegisteredSingletons () |
Allows to inspect all known singletons. | |
template<typename Interface > | |
static void | Register (Interface *pSingletonInstance) |
Registers a singleton instance under a given type name. This is automatically called by ezSingletonRegistrar. | |
template<typename Interface > | |
static void | Unregister () |
Unregisters a singleton instance. This is automatically called by ezSingletonRegistrar. | |
Friends | |
template<typename > | |
class | ezSingletonRegistrar |
ezSingletonRegistry knows about all singleton instances of classes that use EZ_DECLARE_SINGLETON.
It allows to query for a specific interface implementation by type name only, which makes it possible to get rid of unwanted library dependencies and use pure virtual interface classes, without singleton code (and thus link dependencies).
See EZ_DECLARE_SINGLETON and EZ_DECLARE_SINGLETON_OF_INTERFACE for details.
|
inlinestatic |
Retrieves a singleton instance by type name. Returns nullptr if no singleton instance is available.