IRegistry
#include <icy/iregistry.h>
template<class ItemT>
class IRegistryDefined in src/base/include/icy/iregistry.h:25
Public Attributes
| Return | Name | Description |
|---|---|---|
Signal< void(const std::string &)> | TypeRegistered | |
Signal< void(const std::string &)> | TypeUnregistered |
TypeRegistered
Signal< void(const std::string &)> TypeRegisteredType: Signal< void(const std::string &)>
Defined in src/base/include/icy/iregistry.h:77
TypeUnregistered
Signal< void(const std::string &)> TypeUnregisteredType: Signal< void(const std::string &)>
Defined in src/base/include/icy/iregistry.h:78
Public Methods
| Return | Name | Description |
|---|---|---|
IRegistry | Defaulted constructor. | |
~IRegistry virtual | Defaulted destructor. | |
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
IRegistry() = defaultDefined in src/base/include/icy/iregistry.h:36
Defaulted constructor.
~IRegistry
virtual
virtual ~IRegistry() = defaultDefined in src/base/include/icy/iregistry.h:37
Defaulted destructor.
createInstance
virtual inline
virtual inline ItemT * createInstance(const std::string & s)Defined in src/base/include/icy/iregistry.h:42
Creates and returns a new heap-allocated instance of the type registered under key s.
Returns
Pointer to the new instance, or nullptr if s is not registered.
Parameters
| Parameter | Type | Description |
|---|---|---|
s | const std::string & | The registration key (type name). |
registerType
inline
template<typename T> inline void registerType(const std::string & s)Defined in src/base/include/icy/iregistry.h:55
Registers type T under the given key s. Emits TypeRegistered. Subsequent calls to createInstance(s) will return new T().
Parameters
| Parameter | Type | Description |
|---|---|---|
s | const std::string & | Registration key (type name). |
unregisterType
virtual inline
virtual inline void unregisterType(const std::string & s)Defined in src/base/include/icy/iregistry.h:64
Removes the type registered under key s. Emits TypeUnregistered. Does nothing if s is not registered.
Parameters
| Parameter | Type | Description |
|---|---|---|
s | const std::string & | Registration key to remove. |
types
const inline
inline TypeMap types() constDefined in src/base/include/icy/iregistry.h:75
Returns a copy of the current type map.
Returns
Map of registration keys to factory function pointers.
Public Types
| Name | Description |
|---|---|
TypeMap |
TypeMap
using TypeMap = std::map< std::string, ItemT *(*)()>Defined in src/base/include/icy/iregistry.h:34
Private Attributes
_types
TypeMap _typesType: TypeMap
Defined in src/base/include/icy/iregistry.h:81
Private Static Methods
| Return | Name | Description |
|---|---|---|
ItemT * | createT static inline |
createT
static inline
template<typename T> static inline ItemT * createT()