#include <icy/iregistry.h>Abstract interface for object registries.
| Return | Name | Description |
|---|---|---|
Signal< void(const std::string &)> | TypeRegistered | |
Signal< void(const std::string &)> | TypeUnregistered |
Signal< void(const std::string &)> TypeRegisteredSignal< void(const std::string &)> TypeUnregistered| Return | Name | Description |
|---|---|---|
IRegistry | Defaulted constructor. | |
ItemT * | createInstance virtual inline | Creates and returns a new heap-allocated instance of the type registered under key s. |
void | registerType inline | Registers type T under the given key s. Emits TypeRegistered. Subsequent calls to createInstance(s) will return new T(). |
void | unregisterType virtual inline | Removes the type registered under key s. Emits TypeUnregistered. Does nothing if s is not registered. |
TypeMap | types const inline | Returns a copy of the current type map. |
IRegistry() = defaultDefaulted constructor.
virtual inline
virtual inline ItemT * createInstance(const std::string & s)Creates and returns a new heap-allocated instance of the type registered under key s.
s The registration key (type name).Pointer to the new instance, or nullptr if s is not registered.
inline
template<typename T> inline void registerType(const std::string & s)Registers type T under the given key s. Emits TypeRegistered. Subsequent calls to createInstance(s) will return new T().
T Concrete type to register; must be default-constructible and derive from ItemT.s Registration key (type name).virtual inline
virtual inline void unregisterType(const std::string & s)Removes the type registered under key s. Emits TypeUnregistered. Does nothing if s is not registered.
s Registration key to remove.const inline
inline TypeMap types() constReturns a copy of the current type map.
Map of registration keys to factory function pointers.
| Name | Description |
|---|---|
TypeMap |
std::map< std::string, ItemT *(*)()> TypeMap()| Return | Name | Description |
|---|---|---|
TypeMap | _types |
TypeMap _types| Return | Name | Description |
|---|---|---|
ItemT * | createT static inline |
static inline
template<typename T> static inline ItemT * createT()