NAP
Public Member Functions | Protected Member Functions | List of all members
Factory Class Reference

#include <rtti/factory.h>

Public Member Functions

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

Protected Member Functions

virtual ObjectcreateDefaultObject (rtti::TypeInfo typeInfo)
 

Description

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

Inheritance diagram for Factory:
[legend]

Constructor & Destructor Documentation

◆ Factory() [1/2]

Factory ( )
default

◆ Factory() [2/2]

Factory ( const Factory )
delete

◆ ~Factory()

virtual ~Factory ( )
virtualdefault

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.

◆ createDefaultObject()

virtual Object* createDefaultObject ( rtti::TypeInfo  typeInfo)
protectedvirtual

Reimplemented in CoreFactory.

◆ operator=()

Factory& operator= ( const Factory )
delete