IRegistry
IRegistry
#include <icy/iregistry.h>template<class ItemT>
class IRegistryDefined in src/base/include/icy/iregistry.h:25
Abstract interface for object registries.
List of all members
| Name | Kind | Owner |
|---|---|---|
TypeRegistered | variable | Declared here |
TypeUnregistered | variable | Declared here |
IRegistry | function | Declared here |
~IRegistry | function | Declared here |
createInstance | function | Declared here |
registerType | function | Declared here |
unregisterType | function | Declared here |
types | function | Declared here |
TypeMap | typedef | Declared here |
_types | variable | Declared here |
createT | function | Declared here |
Public Attributes
| Return | Name | Description |
|---|---|---|
Signal< void(const std::string &)> | TypeRegistered | |
Signal< void(const std::string &)> | TypeUnregistered |
TypeRegistered
Signal< void(const std::string &)> TypeRegisteredDefined in src/base/include/icy/iregistry.h:77
TypeUnregistered
Signal< void(const std::string &)> TypeUnregisteredDefined in src/base/include/icy/iregistry.h:78
Public Methods
| 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
IRegistry() = defaultDefined in src/base/include/icy/iregistry.h:36
Defaulted constructor.
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.
Parameters
sThe registration key (type name).
Returns
Pointer to the new instance, or nullptr if s is not registered.
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
TConcrete type to register; must be default-constructible and derive from ItemT.
Parameters
sRegistration 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
sRegistration 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
| Return | Name | Description |
|---|---|---|
TypeMap | _types |
_types
TypeMap _typesDefined 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()