dnai::interfaces::IFactory< FactoryType, ClassIdentifier > Class Template Reference
This class allow you to create a factory for anytype of the Base class (FactoryType) with anytype of identifier (ClassIdentifier) More...
#include <ifactory.h>
Collaboration diagram for dnai::interfaces::IFactory< FactoryType, ClassIdentifier >:

Public Member Functions | |
IFactory ()=default | |
FactoryType * create (Key ci) | |
Return a new instance of type (FactoryType) with the identifier of type (ClassIdentifier) More... | |
template<typename TrueType , typename... Args> | |
void registerObject (Key ci, Args &&...args) | |
Register a new class of type (TrueType) witch derived of base type (FactoryType) and assign an identifier of type ClassIdentifier. More... | |
Private Types | |
using Callback = std::function< FactoryType *()> | |
using Key = typename std::conditional< std::is_enum< ClassIdentifier >::value, int, ClassIdentifier >::type | |
Private Attributes | |
std::map< Key, Callback > m_factoryObjects | |
Detailed Description
template<typename FactoryType, class ClassIdentifier>
class dnai::interfaces::IFactory< FactoryType, ClassIdentifier >
This class allow you to create a factory for anytype of the Base class (FactoryType) with anytype of identifier (ClassIdentifier)
Member Typedef Documentation
template<typename FactoryType , class ClassIdentifier >
|
private |
template<typename FactoryType , class ClassIdentifier >
|
private |
Constructor & Destructor Documentation
template<typename FactoryType , class ClassIdentifier >
|
default |
Member Function Documentation
template<typename FactoryType , class ClassIdentifier >
|
inline |
Return a new instance of type (FactoryType) with the identifier of type (ClassIdentifier)
- Parameters
-
ci
- Returns
- return the new instance of object or nullptr if an error occur
template<typename FactoryType , class ClassIdentifier >
template<typename TrueType , typename... Args>
|
inline |
Register a new class of type (TrueType) witch derived of base type (FactoryType) and assign an identifier of type ClassIdentifier.
- Template Parameters
-
TrueType Args
- Parameters
-
ci args
Member Data Documentation
template<typename FactoryType , class ClassIdentifier >
|
private |
The documentation for this class was generated from the following file:
- Gui/app/include/dnai/interfaces/ifactory.h