ComponentOpsRegistry Class
Global registry for component lifecycle function pointers. More...
Declaration
Public Static Functions Index
| static void | setOps (const helios::engine::ecs::types::ComponentTypeId typeId, const ComponentOps &ops) |
|
Registers ComponentOps for a component type. More... | |
| static const ComponentOps & | ops (const helios::engine::ecs::types::ComponentTypeId typeId) |
|
Retrieves ComponentOps for a component type. More... | |
Private Static Attributes Index
| static std::vector< ComponentOps > | operations_ |
|
Type-indexed storage for ComponentOps. More... | |
| static constexpr ComponentOps | emptyOps_ {} |
|
Empty ops returned for unregistered types. More... | |
Description
Global registry for component lifecycle function pointers.
`ComponentOpsRegistry` provides O(1) lookup of `ComponentOps` by `ComponentTypeId`. It uses a type-indexed vector where the index corresponds to the component type's unique identifier.
## Usage
```cpp // Registration (done by ComponentReflector) ComponentOpsRegistry::setOps(typeId, ops);
// Lookup at runtime const auto& ops = ComponentOpsRegistry::ops(typeId); if (ops.onAcquire) { ops.onAcquire(rawComponent); } ```
Not thread-safe. All registration must complete before concurrent access.
- See Also
- See Also
Definition at line 44 of file ComponentOpsRegistry.ixx.
Public Static Functions
ops()
| inline static |
Retrieves ComponentOps for a component type.
- Parameters
-
typeId The unique identifier for the component type.
- Returns
Reference to the registered ComponentOps, or empty ops if not registered.
Definition at line 82 of file ComponentOpsRegistry.ixx.
Reference helios::engine::ecs::types::ComponentTypeId::value.
Referenced by helios::engine::ecs::GameObject::add, helios::engine::ecs::EntityManager::clone, helios::engine::ecs::EntityManager::destroy, helios::engine::ecs::EntityManager::enable, helios::engine::ecs::GameObject::onAcquire, helios::engine::ecs::GameObject::onRelease, helios::engine::ecs::EntityManager::remove, helios::engine::ecs::GameObject::setActive, setOps and helios::engine::mechanics::lifecycle::systems::DelayedComponentEnablerSystem::update.
setOps()
| inline static |
Registers ComponentOps for a component type.
Auto-resizes the internal vector if necessary.
- Parameters
-
typeId The unique identifier for the component type.
ops The lifecycle function pointers to register.
Definition at line 66 of file ComponentOpsRegistry.ixx.
References ops and helios::engine::ecs::types::ComponentTypeId::value.
Referenced by helios::engine::ecs::ComponentReflector::registerType.
Private Static Attributes
emptyOps_
| constexpr static |
Empty ops returned for unregistered types.
Definition at line 54 of file ComponentOpsRegistry.ixx.
operations_
| static |
Type-indexed storage for ComponentOps.
Definition at line 49 of file ComponentOpsRegistry.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.