NAP
Factory Class Reference

#include <rtti/factory.h>

Public Member Functions

 Factory ()=default
 
 Factory (const Factory &)=delete
 
Factoryoperator= (const Factory &)=delete
 
void addObjectCreator (std::unique_ptr< IObjectCreator > objectCreator)
 
Objectcreate (rtti::TypeInfo typeInfo)
 
bool canCreate (rtti::TypeInfo typeInfo) const
 

Detailed Description

Manages all the custom defined object creators. This class is given to a service when the system collects all custom object creators

Constructor & Destructor Documentation

◆ Factory() [1/2]

Factory ( )
default

◆ Factory() [2/2]

Factory ( const Factory )
delete

Member Function Documentation

◆ addObjectCreator()

void addObjectCreator ( std::unique_ptr< IObjectCreator objectCreator)

Adds association between a type and it's object creator.

Parameters
objectCreatorthe object that can create instances of the type.

◆ canCreate()

bool canCreate ( rtti::TypeInfo  typeInfo) const
Returns
If the type is registered into the Factory, returns true. If the type is not registered, the RTTI system is queried if it can be created.

◆ create()

Object* create ( rtti::TypeInfo  typeInfo)

Creates an object. If there is an existing type mapping, it will use the ObjectCreator for that type. If there isn't, the default constructor will be used.

Returns
instance of the type.
Parameters
typeInfothe type to create an instance of.

◆ operator=()

Factory& operator= ( const Factory )
delete