ifactory.h
Go to the documentation of this file.
19 using Key = typename std::conditional<std::is_enum<ClassIdentifier>::value, int, ClassIdentifier>::type;
42 m_factoryObjects[ci] = [=]() { return static_cast<FactoryType *>(new TrueType(std::move(args)...)); };
typename std::conditional< std::is_enum< ClassIdentifier >::value, int, ClassIdentifier >::type Key
Definition: ifactory.h:19
std::function< FactoryType *()> Callback
Definition: ifactory.h:18
FactoryType * create(Key ci)
Return a new instance of type (FactoryType) with the identifier of type (ClassIdentifier) ...
Definition: ifactory.h:27
std::map< Key, Callback > m_factoryObjects
Definition: ifactory.h:46
Definition: api.h:13
IFactory()=default
void registerObject(Key ci, Args &&...args)
Register a new class of type (TrueType) witch derived of base type (FactoryType) and assign an identi...
Definition: ifactory.h:40
This class allow you to create a factory for anytype of the Base class (FactoryType) with anytype of ...
Definition: ifactory.h:16