61 std::map<std::string, ConstructorFunctionType> m_constructors;
75 template <
class FactoryType,
typename CreatedType>
89 const std::string&
getKey(
void)
const {
return m_key; };
#define OT_DECL_NODEFAULT(___class)
Removes the default copy constructor and assignment operator.
Definition OTClassHelper.h:22
#define OT_DECL_NOCOPY(___class)
Removes the default copy constructor and assignment operator.
Definition OTClassHelper.h:14
The FactoryRegistrarTemplate may be used to register a constructor at the factory.
Definition FactoryTemplate.h:76
virtual ~FactoryRegistrarTemplate()
Destructor. When called the constructor will be deregistered from the factory.
Definition FactoryTemplate.hpp:88
FactoryRegistrarTemplate(const std::string &_key)
Constructor.
Definition FactoryTemplate.hpp:73
const std::string & getKey(void) const
Get the constructor key.
Definition FactoryTemplate.h:89
The FactoryTemplate may be used to quickly create default factories that are only used for item creat...
Definition FactoryTemplate.h:24
void deregisterConstructor(const std::string &_key)
Remove the constructor for the given key.
Definition FactoryTemplate.hpp:27
std::function< ValueType *()> ConstructorFunctionType
Constructor type definition.
Definition FactoryTemplate.h:27
ValueType * createFromJSON(const ConstJsonObject &_jsonObject, const char *_typeKey)
Creates an instance according to the key in the provided JSON object. If the key is empty the request...
Definition FactoryTemplate.hpp:44
~FactoryTemplate()
Protected destructor.
Definition FactoryTemplate.h:58
void registerConstructor(const std::string &_key, ConstructorFunctionType _constructor)
Will register the prvided constructor under the given key. If a constructor for the given key already...
Definition FactoryTemplate.hpp:17
ValueType * createFromKey(const std::string &_key)
Call the constructor for the given key and return the created instance.
Definition FactoryTemplate.hpp:32
FactoryTemplate()
Protected constructor.
Definition FactoryTemplate.h:55
rapidjson::GenericObject< true, rapidjson::GenericValue< rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > > > ConstJsonObject
Read only JSON Object.
Definition JSON.h:35