Skylicht Engine
Loading...
Searching...
No Matches
Skylicht::CActivator Class Reference

Runtime factory that creates registered objects by type name. More...

#include <Utils/CActivator.h>

Public Member Functions

bool registerType (const char *type, ActivatorCreateInstance func)
 Register a type name and constructor callback.
IActivatorObjectcreateInstance (const char *type)
 Create an instance of a registered type.

Protected Attributes

std::map< std::string, int > m_factoryName
std::vector< ActivatorCreateInstancem_factoryFunc

Detailed Description

Runtime factory that creates registered objects by type name.

Member Function Documentation

◆ createInstance()

IActivatorObject * Skylicht::CActivator::createInstance ( const char * type)

Create an instance of a registered type.

Parameters
typeType name used during registration.
Returns
Newly allocated object, or null if the type is not registered.

◆ registerType()

bool Skylicht::CActivator::registerType ( const char * type,
ActivatorCreateInstance func )

Register a type name and constructor callback.

Parameters
typeType name used as the factory key.
funcConstructor callback.
Returns
True if the type was registered, false if the name already exists.

The documentation for this class was generated from the following file: