Base module

IRegistry

Abstract interface for object registries.

#include <icy/iregistry.h>

template<class ItemT>
class IRegistry

Defined in src/base/include/icy/iregistry.h:25

Public Attributes

ReturnNameDescription
Signal< void(const std::string &)>TypeRegistered
Signal< void(const std::string &)>TypeUnregistered

TypeRegistered

Signal< void(const std::string &)> TypeRegistered

Type: Signal< void(const std::string &)>

Defined in src/base/include/icy/iregistry.h:77


TypeUnregistered

Signal< void(const std::string &)> TypeUnregistered

Type: Signal< void(const std::string &)>

Defined in src/base/include/icy/iregistry.h:78

Public Methods

ReturnNameDescription
IRegistryDefaulted constructor.
~IRegistry virtualDefaulted destructor.
ItemT *createInstance virtual inlineCreates and returns a new heap-allocated instance of the type registered under key s.
voidregisterType inlineRegisters type T under the given key s. Emits TypeRegistered. Subsequent calls to createInstance(s) will return new T().
voidunregisterType virtual inlineRemoves the type registered under key s. Emits TypeUnregistered. Does nothing if s is not registered.
TypeMaptypes const inlineReturns a copy of the current type map.

IRegistry

IRegistry() = default

Defined in src/base/include/icy/iregistry.h:36

Defaulted constructor.


~IRegistry

virtual

virtual ~IRegistry() = default

Defined 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

ParameterTypeDescription
sconst 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

ParameterTypeDescription
sconst 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

ParameterTypeDescription
sconst std::string &Registration key to remove.

types

const inline

inline TypeMap types() const

Defined 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

NameDescription
TypeMap

TypeMap

using TypeMap = std::map< std::string, ItemT *(*)()>

Defined in src/base/include/icy/iregistry.h:34

Private Attributes

ReturnNameDescription
TypeMap_types

_types

TypeMap _types

Type: TypeMap

Defined in src/base/include/icy/iregistry.h:81

Private Static Methods

ReturnNameDescription
ItemT *createT static inline

createT

static inline

template<typename T> static inline ItemT * createT()

Defined in src/base/include/icy/iregistry.h:28