23template <
class BaseIf>
31 std::scoped_lock
lock(m_mutex);
32 assert(m_factories.size() == 0);
36template <
class BaseIf>
40 std::scoped_lock
lock(m_mutex);
41 auto position = std::find(m_factories.begin(), m_factories.end(),
factory);
47template <
class BaseIf>
51 std::scoped_lock
lock(m_mutex);
52 auto position = std::find(m_factories.begin(), m_factories.end(),
factory);
58template <
class BaseIf>
61 std::scoped_lock
lock(m_mutex);
63 m_factories.begin(), m_factories.end(), [&](
auto&
x) { return x->CanHandle(id); });
64 if (
factory != m_factories.end()) {
71template <
class BaseIf>
98 static std::shared_ptr<FactoryRegistry<BaseIf>>
registry =
99 std::make_shared<FactoryRegistry<BaseIf>>();
103template <
class BaseIf,
class Factory>
106 m_registry->Register(&m_factory);
109template <
class BaseIf,
class Factory>
111 m_registry->Deregister(&m_factory);
The base class for all factory objects that are registered in the FactoryRegistry.
Definition factoryRegistry.hpp:57
A simple registry of various factory objects.
Definition factoryRegistry.hpp:47
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()
Definition factoryRegistry.ipp:24
static std::shared_ptr< FactoryRegistry< BaseIf > > GetInstance()
Returns the registry singleton.
Definition factoryRegistry.ipp:72
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
RegisterFactory()
Definition factoryRegistry.ipp:104
~RegisterFactory()
Definition factoryRegistry.ipp:110
Definition commandReplier.cpp:22
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition malEventInjector.hpp:23