|
Deki 1.3.0
Modular C++ 2D engine for embedded displays and desktop
|
Registry for component metadata. More...
#include <ComponentRegistry.h>
Public Member Functions | |
| void | Register (const DekiComponentMeta *meta) |
| Register a component's metadata. | |
| const DekiComponentMeta * | GetMeta (uint32_t typeId) const |
| Get metadata by component type ID. | |
| void | RegisterFields (uint32_t typeId, const DekiFieldRef *fields, int count) |
| Register a component's flattened field table (idempotent per typeId). | |
| const DekiFieldRef * | FindField (uint32_t typeId, uint32_t nameHash) const |
| Look up one field by name hash. | |
| const DekiFieldRef * | GetFields (uint32_t typeId, int &outCount) const |
| The whole table for a type (nullptr and outCount 0 when absent). | |
| const DekiComponentMeta * | GetMeta (const std::string &name) const |
| Get metadata by component serialized name (GUID). | |
| const DekiComponentMeta * | GetMetaByClassName (const std::string &className) const |
| Get metadata by class name (e.g., "PlatformSetupComponent"). | |
| DekiComponent * | CreateComponent (uint32_t typeId) const |
| Create a new component instance by type ID. | |
| DekiComponent * | CreateComponent (const std::string &name) const |
| Create a new component instance by serialized name (GUID). | |
| const std::vector< const DekiComponentMeta * > & | GetAllComponents () const |
| Get all registered components. | |
| std::vector< const DekiComponentMeta * > | GetComponentsByCategory (const std::string &category) const |
| Get components by category. | |
| std::vector< std::string > | GetCategories () const |
| Get all unique category names. | |
| void | RegisterPluginComponent (const DekiComponentMeta *meta) |
| Register a plugin component's metadata. | |
| void | ClearPluginComponents () |
| Clear all plugin-loaded components from the registry. | |
| bool | IsPluginComponent (uint32_t typeId) const |
| Check if a component type is from a plugin. | |
| void | Unregister (uint32_t typeId) |
| Unregister a component by type ID. | |
| void | FreezeEngineComponents () |
| Snapshot current entries as engine-core components. | |
| void | ClearNonEngineComponents () |
| Remove ALL entries not frozen as engine-core. | |
Static Public Member Functions | |
| static ComponentRegistry & | Instance () |
Registry for component metadata.
On ESP32-S3: Minimal implementation - just provides metadata lookup by type. In Editor: Full implementation with name-based lookup and enumeration.
|
static |
| void ComponentRegistry::Register | ( | const DekiComponentMeta * | meta | ) |
Register a component's metadata.
| meta | Pointer to static component metadata |
| const DekiComponentMeta * ComponentRegistry::GetMeta | ( | uint32_t | typeId | ) | const |
Get metadata by component type ID.
| typeId | The ComponentType value |
| void ComponentRegistry::RegisterFields | ( | uint32_t | typeId, |
| const DekiFieldRef * | fields, | ||
| int | count ) |
Register a component's flattened field table (idempotent per typeId).
| const DekiFieldRef * ComponentRegistry::FindField | ( | uint32_t | typeId, |
| uint32_t | nameHash ) const |
Look up one field by name hash.
nullptr when absent.
| const DekiFieldRef * ComponentRegistry::GetFields | ( | uint32_t | typeId, |
| int & | outCount ) const |
The whole table for a type (nullptr and outCount 0 when absent).
| const DekiComponentMeta * ComponentRegistry::GetMeta | ( | const std::string & | name | ) | const |
Get metadata by component serialized name (GUID).
| name | The serialized name / GUID from scene files |
| const DekiComponentMeta * ComponentRegistry::GetMetaByClassName | ( | const std::string & | className | ) | const |
Get metadata by class name (e.g., "PlatformSetupComponent").
| className | The C++ class name |
| DekiComponent * ComponentRegistry::CreateComponent | ( | uint32_t | typeId | ) | const |
Create a new component instance by type ID.
| typeId | The ComponentType value |
| DekiComponent * ComponentRegistry::CreateComponent | ( | const std::string & | name | ) | const |
Create a new component instance by serialized name (GUID).
| name | The serialized name / GUID |
| const std::vector< const DekiComponentMeta * > & ComponentRegistry::GetAllComponents | ( | ) | const |
Get all registered components.
| std::vector< const DekiComponentMeta * > ComponentRegistry::GetComponentsByCategory | ( | const std::string & | category | ) | const |
Get components by category.
| category | The category name (e.g., "2D") |
| std::vector< std::string > ComponentRegistry::GetCategories | ( | ) | const |
Get all unique category names.
| void ComponentRegistry::RegisterPluginComponent | ( | const DekiComponentMeta * | meta | ) |
Register a plugin component's metadata.
| meta | Pointer to static component metadata |
Use this instead of Register() for plugin components so they can be properly cleared during hot-reload while preserving engine components.
| void ComponentRegistry::ClearPluginComponents | ( | ) |
Clear all plugin-loaded components from the registry.
This is called before hot-reloading plugins. Only components registered via RegisterPluginComponent() are removed; engine components are preserved.
| bool ComponentRegistry::IsPluginComponent | ( | uint32_t | typeId | ) | const |
Check if a component type is from a plugin.
| typeId | The ComponentType value |
| void ComponentRegistry::Unregister | ( | uint32_t | typeId | ) |
Unregister a component by type ID.
| typeId | The ComponentType value |
Used during package hot-reload to clear entries BEFORE FreeLibrary, preventing dangling pointers in the registry.
| void ComponentRegistry::FreezeEngineComponents | ( | ) |
Snapshot current entries as engine-core components.
Call once after engine initialization, before loading any packages. Frozen entries are preserved by ClearNonEngineComponents().
| void ComponentRegistry::ClearNonEngineComponents | ( | ) |
Remove ALL entries not frozen as engine-core.
Atomically clears every package and plugin component from the registry, ensuring no stale pointers survive after FreeLibrary.