ComponentReflector Class
Generates and registers ComponentOps for a component type. More...
Declaration
Public Static Functions Index
template <typename T> | |
| static void | registerType () |
|
Registers a component type with the reflection system. More... | |
Description
Generates and registers ComponentOps for a component type.
`ComponentReflector` uses compile-time trait detection to generate appropriate function pointers for each lifecycle hook that a component type implements. This enables zero-overhead conditional invocation at runtime.
## Usage
```cpp // Register a component type ComponentReflector::registerType<HealthComponent>();
// Or use the module registry pattern inline void registerComponents() { using R = ComponentReflector; R::registerType<CollisionComponent>(); R::registerType<AabbColliderComponent>(); } ```
## Trait Detection
The reflector checks for the following traits at compile time:
- `HasOnAcquire` - `onAcquire()` method
- `HasOnRelease` - `onRelease()` method
- `HasOnRemove` - `onRemove()` method returning bool
- `HasToggleable` - `enable()` and `disable()` methods
- `HasClone` - `onClone(const T&)` method
- `HasActivatable` - `onActivate()` and `onDeactivate()` methods
- See Also
- See Also
- See Also
Traits
Definition at line 56 of file ComponentReflector.ixx.
Public Static Functions
registerType()
| inline static |
Registers a component type with the reflection system.
Generates `ComponentOps` function pointers based on which lifecycle hooks the type implements. Uses `if constexpr` for zero-overhead when hooks are not present.
- Template Parameters
-
T The component type to register. Must be copy-constructible for cloning support.
Definition at line 71 of file ComponentReflector.ixx.
References helios::engine::ecs::types::ComponentTypeId::id and helios::engine::ecs::ComponentOpsRegistry::setOps.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.