HierarchyComponent Class Template
Stores parent-child relationships for hierarchical entity graphs. More...
Declaration
Public Member Functions Index
template <typename THandle> | |
| void | addChild (const THandle child) |
|
Adds a child entity to this hierarchy node. More... | |
template <typename THandle> | |
| void | setParent (const THandle parent) |
|
Sets the parent entity for this hierarchy node. More... | |
template <typename THandle> | |
| auto | parent () const noexcept -> std::optional< THandle > |
|
Returns the parent entity handle if set. More... | |
template <typename THandle> | |
| auto | children () noexcept -> std::span< const THandle > |
|
Returns a span over all child entity handles. More... | |
template <typename THandle> | |
| void | markDirty () |
|
Marks the hierarchy as requiring propagation. More... | |
template <typename THandle> | |
| void | clearDirty () |
|
Clears the dirty flag after propagation. More... | |
template <typename THandle> | |
| bool | isDirty () const noexcept |
|
Checks whether the hierarchy needs propagation. More... | |
Private Member Attributes Index
template <typename THandle> | |
| std::vector< THandle > | children_ |
|
Child entity handles. More... | |
template <typename THandle> | |
| std::optional< THandle > | parent_ |
|
Optional parent entity handle. More... | |
template <typename THandle> | |
| bool | isDirty_ = false |
|
Dirty flag indicating pending hierarchy updates. More... | |
template <typename THandle> | |
| 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.
- Template Parameters
-
THandle The entity handle type used for parent/child references.
Definition at line 28 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 57 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 84 of file HierarchyComponent.ixx.
clearDirty()
| inline |
Clears the dirty flag after propagation.
Definition at line 98 of file HierarchyComponent.ixx.
isDirty()
| inline nodiscard noexcept |
Checks whether the hierarchy needs propagation.
- Returns
True if dirty, false otherwise.
Definition at line 107 of file HierarchyComponent.ixx.
markDirty()
| inline |
Marks the hierarchy as requiring propagation.
Definition at line 91 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 75 of file HierarchyComponent.ixx.
setParent()
| inline |
Private Member Attributes
children_
|
Child entity handles.
Definition at line 33 of file HierarchyComponent.ixx.
isDirty_
|
Dirty flag indicating pending hierarchy updates.
Definition at line 43 of file HierarchyComponent.ixx.
isEnabled_
|
Whether this component is enabled.
Definition at line 48 of file HierarchyComponent.ixx.
parent_
|
Optional parent entity handle.
Definition at line 38 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.