12#ifndef RTCTK_COMPONENTFRAMEWORK_FACTORYREGISTRY_HPP
13#define RTCTK_COMPONENTFRAMEWORK_FACTORYREGISTRY_HPP
45template <
class BaseIf>
143 static std::shared_ptr<FactoryRegistry<BaseIf>>
GetInstance();
153 mutable std::mutex m_mutex;
156 std::vector<const FactoryIf*> m_factories;
185template <
class BaseIf,
class Factory>
The base class for all factory objects that are registered in the FactoryRegistry.
Definition factoryRegistry.hpp:56
FactoryIf(FactoryIf &&)=delete
typename BaseIf::AdapterIdType AdapterIdType
Definition factoryRegistry.hpp:58
FactoryIf & operator=(const FactoryIf &)=delete
virtual std::unique_ptr< BaseIf > CreateInstance(const AdapterIdType &id) const =0
Create a new adapter instance to access the service specified by the given identifier.
FactoryIf & operator=(FactoryIf &&)=delete
virtual ~FactoryIf()=default
virtual bool CanHandle(const AdapterIdType &id) const =0
Check if this factory is compatible with the given service identifier.
FactoryIf(const FactoryIf &)=delete
void Register(const FactoryIf *factory)
Register the factory if it was not already registered.
Definition factoryRegistry.ipp:36
void Deregister(const FactoryIf *factory) noexcept
Remove the factory from the registry if it was already registered.
Definition factoryRegistry.ipp:47
FactoryRegistry()=default
FactoryRegistry & operator=(const FactoryRegistry &)=delete
~FactoryRegistry()
Definition factoryRegistry.ipp:23
static std::shared_ptr< FactoryRegistry< BaseIf > > GetInstance()
Returns the registry singleton.
Definition factoryRegistry.ipp:71
FactoryRegistry & operator=(FactoryRegistry &&)=delete
const FactoryIf * FindCompatibleFactory(const AdapterIdType &id) const noexcept
Finds the first factory that can handle the given identifier.
Definition factoryRegistry.ipp:59
typename BaseIf::AdapterIdType AdapterIdType
Definition factoryRegistry.hpp:48
FactoryRegistry(const FactoryRegistry &)=delete
FactoryRegistry(FactoryRegistry &&)=delete
Factory m_factory
Definition factoryRegistry.hpp:203
RegisterFactory()
Definition factoryRegistry.ipp:103
std::shared_ptr< FactoryRegistry< BaseIf > > m_registry
Definition factoryRegistry.hpp:200
~RegisterFactory()
Definition factoryRegistry.ipp:109
RegisterFactory(RegisterFactory &&)=delete
RegisterFactory & operator=(const RegisterFactory &)=delete
RegisterFactory(const RegisterFactory &)=delete
RegisterFactory & operator=(RegisterFactory &&)=delete
Implementation file for FactoryRegistry and related helper template classes.
Definition commandReplier.cpp:21