13#ifndef RTCTK_COMPONENTFRAMEWORK_FACTORYREGISTRY_HPP
14#define RTCTK_COMPONENTFRAMEWORK_FACTORYREGISTRY_HPP
46template <
class BaseIf>
144 static std::shared_ptr<FactoryRegistry<BaseIf>>
GetInstance();
154 mutable std::mutex m_mutex;
157 std::vector<const FactoryIf*> m_factories;
186template <
class BaseIf,
class Factory>
The base class for all factory objects that are registered in the FactoryRegistry.
Definition factoryRegistry.hpp:57
FactoryIf(FactoryIf &&)=delete
typename BaseIf::AdapterIdType AdapterIdType
Definition factoryRegistry.hpp:59
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:37
void Deregister(const FactoryIf *factory) noexcept
Remove the factory from the registry if it was already registered.
Definition factoryRegistry.ipp:48
FactoryRegistry()=default
FactoryRegistry & operator=(const FactoryRegistry &)=delete
~FactoryRegistry()
Definition factoryRegistry.ipp:24
static std::shared_ptr< FactoryRegistry< BaseIf > > GetInstance()
Returns the registry singleton.
Definition factoryRegistry.ipp:72
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:60
typename BaseIf::AdapterIdType AdapterIdType
Definition factoryRegistry.hpp:49
FactoryRegistry(const FactoryRegistry &)=delete
FactoryRegistry(FactoryRegistry &&)=delete
Factory m_factory
Definition factoryRegistry.hpp:204
RegisterFactory()
Definition factoryRegistry.ipp:104
std::shared_ptr< FactoryRegistry< BaseIf > > m_registry
Definition factoryRegistry.hpp:201
~RegisterFactory()
Definition factoryRegistry.ipp:110
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:22