Skip to main content

HierarchyComponent Class

Stores parent-child relationships for hierarchical entity graphs. More...

Declaration

class helios::engine::ecs::components::HierarchyComponent { ... }

Public Member Functions Index

voidaddChild (const helios::engine::ecs::EntityHandle child)

Adds a child entity to this hierarchy node. More...

voidsetParent (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...

voidmarkDirty ()

Marks the hierarchy as requiring propagation. More...

voidclearDirty ()

Clears the dirty flag after propagation. More...

boolisDirty () 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...

boolisDirty_ = false

Dirty flag indicating pending hierarchy updates. More...

boolisEnabled_ = 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()

void helios::engine::ecs::components::HierarchyComponent::addChild (const helios::engine::ecs::EntityHandle child)
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.

55 children_.push_back(child);
56 }

children()

std::span< const helios::engine::ecs::EntityHandle > helios::engine::ecs::components::HierarchyComponent::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.

81 [[nodiscard]] std::span<const helios::engine::ecs::EntityHandle> children() noexcept {
82 return children_;
83 }

clearDirty()

void helios::engine::ecs::components::HierarchyComponent::clearDirty ()
inline

Clears the dirty flag after propagation.

Definition at line 95 of file HierarchyComponent.ixx.

95 void clearDirty() {
96 isDirty_ = false;
97 }

isDirty()

bool helios::engine::ecs::components::HierarchyComponent::isDirty ()
inline nodiscard noexcept

Checks whether the hierarchy needs propagation.

Returns

True if dirty, false otherwise.

Definition at line 104 of file HierarchyComponent.ixx.

104 [[nodiscard]] bool isDirty() const noexcept {
105 return isDirty_;
106 }

markDirty()

void helios::engine::ecs::components::HierarchyComponent::markDirty ()
inline

Marks the hierarchy as requiring propagation.

Definition at line 88 of file HierarchyComponent.ixx.

88 void markDirty() {
89 isDirty_ = true;
90 }

parent()

std::optional< helios::engine::ecs::EntityHandle > helios::engine::ecs::components::HierarchyComponent::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.

72 [[nodiscard]] std::optional<helios::engine::ecs::EntityHandle> parent() const noexcept {
73 return parent_;
74 }

Referenced by setParent.

setParent()

void helios::engine::ecs::components::HierarchyComponent::setParent (const helios::engine::ecs::EntityHandle parent)
inline

Sets the parent entity for this hierarchy node.

Parameters
parent

Handle of the parent entity.

Definition at line 63 of file HierarchyComponent.ixx.

64 parent_ = parent;
65 }

Reference parent.

Private Member Attributes

children_

std::vector<helios::engine::ecs::EntityHandle> helios::engine::ecs::components::HierarchyComponent::children_

Child entity handles.

Definition at line 30 of file HierarchyComponent.ixx.

30 std::vector<helios::engine::ecs::EntityHandle> children_;

isDirty_

bool helios::engine::ecs::components::HierarchyComponent::isDirty_ = false

Dirty flag indicating pending hierarchy updates.

Definition at line 40 of file HierarchyComponent.ixx.

40 bool isDirty_ = false;

isEnabled_

bool helios::engine::ecs::components::HierarchyComponent::isEnabled_ = true

Whether this component is enabled.

Definition at line 45 of file HierarchyComponent.ixx.

45 bool isEnabled_ = true;

parent_

std::optional<helios::engine::ecs::EntityHandle> helios::engine::ecs::components::HierarchyComponent::parent_

Optional parent entity handle.

Definition at line 35 of file HierarchyComponent.ixx.

35 std::optional<helios::engine::ecs::EntityHandle> parent_;

The documentation for this class was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.