HierarchyComponent Class
Stores parent-child relationships for hierarchical entity graphs. More...
Declaration
Public Member Functions Index
| void | addChild (const helios::engine::ecs::EntityHandle child) |
|
Adds a child entity to this hierarchy node. More... | |
| void | setParent (const helios::engine::ecs::EntityHandle parent) |
|
Sets the parent entity for this hierarchy node. More... | |
| std::optional< helios::engine::ecs::EntityHandle > | parent () const noexcept |
|
Returns the parent entity handle if set. More... | |
| std::span< const helios::engine::ecs::EntityHandle > | children () noexcept |
|
Returns a span over all child entity handles. More... | |
| void | markDirty () |
|
Marks the hierarchy as requiring propagation. More... | |
| void | clearDirty () |
|
Clears the dirty flag after propagation. More... | |
| bool | isDirty () const noexcept |
|
Checks whether the hierarchy needs propagation. More... | |
Private Member Attributes Index
| std::vector< helios::engine::ecs::EntityHandle > | children_ |
|
Child entity handles. More... | |
| std::optional< helios::engine::ecs::EntityHandle > | parent_ |
|
Optional parent entity handle. More... | |
| bool | isDirty_ = false |
|
Dirty flag indicating pending hierarchy updates. More... | |
| bool | isEnabled_ = true |
|
Whether this component is enabled. More... | |
Description
Stores parent-child relationships for hierarchical entity graphs.
HierarchyComponent enables entities to form tree structures where state changes (e.g., activation, transformation) can propagate from parent to child entities. The dirty flag signals that the hierarchy has changed and needs propagation.
Definition at line 25 of file HierarchyComponent.ixx.
Public Member Functions
addChild()
| inline |
Adds a child entity to this hierarchy node.
- Parameters
-
child Handle of the child entity to add.
Definition at line 54 of file HierarchyComponent.ixx.
children()
| inline nodiscard noexcept |
Returns a span over all child entity handles.
- Returns
Read-only span of child handles.
Definition at line 81 of file HierarchyComponent.ixx.
clearDirty()
| inline |
Clears the dirty flag after propagation.
Definition at line 95 of file HierarchyComponent.ixx.
isDirty()
| inline nodiscard noexcept |
Checks whether the hierarchy needs propagation.
- Returns
True if dirty, false otherwise.
Definition at line 104 of file HierarchyComponent.ixx.
markDirty()
| inline |
Marks the hierarchy as requiring propagation.
Definition at line 88 of file HierarchyComponent.ixx.
parent()
| inline nodiscard noexcept |
Returns the parent entity handle if set.
- Returns
Optional containing the parent handle, or std::nullopt.
Definition at line 72 of file HierarchyComponent.ixx.
Referenced by setParent.
setParent()
| inline |
Sets the parent entity for this hierarchy node.
- Parameters
-
parent Handle of the parent entity.
Definition at line 63 of file HierarchyComponent.ixx.
Reference parent.
Private Member Attributes
children_
|
Child entity handles.
Definition at line 30 of file HierarchyComponent.ixx.
isDirty_
|
Dirty flag indicating pending hierarchy updates.
Definition at line 40 of file HierarchyComponent.ixx.
isEnabled_
|
Whether this component is enabled.
Definition at line 45 of file HierarchyComponent.ixx.
parent_
|
Optional parent entity handle.
Definition at line 35 of file HierarchyComponent.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.