DEKI/ENGINE docs
Deki 0.19.0
Modular C++ 2D engine for embedded displays and desktop
Loading...
Searching...
No Matches

Creates components by type id and tells which class an id belongs to. More...

#include <deki/reflection/ComponentFactory.h>

Public Member Functions

void Register (const ComponentTypeInfo *info)
 Registers a component class.
void Unregister (uint32_t typeId)
 Removes a component class, when its package unloads.
const ComponentTypeInfo * Find (uint32_t typeId) const
 The class entry for a type id, or nullptr when unknown.
Component * Create (uint32_t typeId) const
 Creates a component by type id, with its type info attached.
bool IsRegistered (uint32_t typeId) const
size_t GetRegisteredCount () const
void Clear ()
 Removes every registered class, for plugin hot-reload.

Static Public Member Functions

static ComponentFactory & Instance ()

Detailed Description

Creates components by type id and tells which class an id belongs to.

Lookups are O(1).

Member Function Documentation

◆ Instance()

ComponentFactory & Deki::ComponentFactory::Instance ( )
static

◆ Register()

void Deki::ComponentFactory::Register ( const ComponentTypeInfo * info)
inline

Registers a component class.

Registering the same id again replaces the entry, which a hot-reloaded package needs.

◆ Unregister()

void Deki::ComponentFactory::Unregister ( uint32_t typeId)
inline

Removes a component class, when its package unloads.

◆ Find()

const ComponentTypeInfo * Deki::ComponentFactory::Find ( uint32_t typeId) const
inline

The class entry for a type id, or nullptr when unknown.

◆ Create()

Component * Deki::ComponentFactory::Create ( uint32_t typeId) const
inline

Creates a component by type id, with its type info attached.

Returns nullptr when the id is unknown or the class is abstract.

◆ IsRegistered()

bool Deki::ComponentFactory::IsRegistered ( uint32_t typeId) const
inline

◆ GetRegisteredCount()

size_t Deki::ComponentFactory::GetRegisteredCount ( ) const
inline

◆ Clear()

void Deki::ComponentFactory::Clear ( )
inline

Removes every registered class, for plugin hot-reload.


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