ComponentOps Struct
Container for type-erased component lifecycle function pointers. More...
Declaration
Public Member Typedefs Index
| using | OnAcquireFn = void(*)(void *) |
|
Function signature for pool acquisition callback. More... | |
| using | OnReleaseFn = void(*)(void *) |
|
Function signature for pool release callback. More... | |
| using | OnRemoveFn = bool(*)(void *) |
|
Function signature for removal interception callback. More... | |
| using | EnableFn = void(*)(void *) |
|
Function signature for component enable callback. More... | |
| using | DisableFn = void(*)(void *) |
|
Function signature for component disable callback. More... | |
| using | CloneFn = void *(*)(void *manager, const void *source, const EntityHandle *target) |
|
Function signature for component cloning. More... | |
| using | OnActivateFn = void(*)(void *) |
|
Function signature for GameObject activation callback. More... | |
| using | OnDeactivateFn = void(*)(void *) |
|
Function signature for GameObject deactivation callback. More... | |
Public Member Attributes Index
| OnAcquireFn | onAcquire = nullptr |
|
Called when entity is acquired from an object pool. More... | |
| OnReleaseFn | onRelease = nullptr |
|
Called when entity is released back to an object pool. More... | |
| OnRemoveFn | onRemove = nullptr |
|
Called before component removal. Return `false` to block. More... | |
| EnableFn | enable = nullptr |
|
Called to enable the component. More... | |
| DisableFn | disable = nullptr |
|
Called to disable the component. More... | |
| CloneFn | clone = nullptr |
|
Called to clone the component to a target entity. More... | |
| OnActivateFn | onActivate = nullptr |
|
Called when the owning GameObject is activated. More... | |
| OnDeactivateFn | onDeactivate = nullptr |
|
Called when the owning GameObject is deactivated. More... | |
Description
Container for type-erased component lifecycle function pointers.
`ComponentOps` enables runtime invocation of component lifecycle hooks without knowing the concrete component type. Function pointers are set during type registration via `ComponentReflector::registerType<T>()`.
## Type Erasure Pattern
```cpp // At registration (type known): ComponentOps ops{ .onAcquire = [](void* ptr) { static_cast<HealthComponent*>(ptr)->onAcquire(); } };
// At runtime (type erased): if (ops.onAcquire) { ops.onAcquire(rawComponent); } ```
- See Also
- See Also
- See Also
Traits
Definition at line 40 of file ComponentOps.ixx.
Public Member Typedefs
CloneFn
|
Function signature for component cloning.
- Parameters
-
manager Raw pointer to the EntityManager.
source Raw pointer to the source component.
target Pointer to the target EntityHandle.
- Returns
Raw pointer to the newly created component.
Definition at line 88 of file ComponentOps.ixx.
DisableFn
|
Function signature for component disable callback.
- Parameters
-
ptr Raw pointer to the component instance.
Definition at line 77 of file ComponentOps.ixx.
EnableFn
|
Function signature for component enable callback.
- Parameters
-
ptr Raw pointer to the component instance.
Definition at line 70 of file ComponentOps.ixx.
OnAcquireFn
|
Function signature for pool acquisition callback.
- Parameters
-
ptr Raw pointer to the component instance.
Definition at line 47 of file ComponentOps.ixx.
OnActivateFn
|
Function signature for GameObject activation callback.
- Parameters
-
ptr Raw pointer to the component instance.
Definition at line 95 of file ComponentOps.ixx.
OnDeactivateFn
|
Function signature for GameObject deactivation callback.
- Parameters
-
ptr Raw pointer to the component instance.
Definition at line 102 of file ComponentOps.ixx.
OnReleaseFn
|
Function signature for pool release callback.
- Parameters
-
ptr Raw pointer to the component instance.
Definition at line 54 of file ComponentOps.ixx.
OnRemoveFn
|
Function signature for removal interception callback.
- Parameters
-
ptr Raw pointer to the component instance.
- Returns
`true` to allow removal, `false` to prevent it.
Definition at line 63 of file ComponentOps.ixx.
Public Member Attributes
clone
|
Called to clone the component to a target entity.
Definition at line 132 of file ComponentOps.ixx.
disable
|
Called to disable the component.
Definition at line 127 of file ComponentOps.ixx.
enable
|
Called to enable the component.
Definition at line 122 of file ComponentOps.ixx.
onAcquire
|
Called when entity is acquired from an object pool.
Definition at line 107 of file ComponentOps.ixx.
onActivate
|
Called when the owning GameObject is activated.
Definition at line 137 of file ComponentOps.ixx.
onDeactivate
|
Called when the owning GameObject is deactivated.
Definition at line 142 of file ComponentOps.ixx.
onRelease
|
Called when entity is released back to an object pool.
Definition at line 112 of file ComponentOps.ixx.
onRemove
|
Called before component removal. Return `false` to block.
Definition at line 117 of file ComponentOps.ixx.
The documentation for this struct was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.