|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
Place of an entity in the entity tree: its parent, its direct children and its depth. More...
#include <headers/guillaume/components/hierarchy.hpp>


Public Member Functions | |
| Hierarchy (void)=default | |
| Construct the hierarchy of a root entity without children. | |
| ~Hierarchy (void)=default | |
| Default destructor. | |
| ecs::Entity::Identifier | getParentIdentifier (void) const noexcept |
| Get the identifier of the parent entity. | |
| Hierarchy & | setParentIdentifier (ecs::Entity::Identifier identifier) |
| Store the identifier of the parent entity. | |
| bool | hasParent (void) const noexcept |
| Check whether the entity has a parent. | |
| const std::vector< ecs::Entity::Identifier > & | getChildIdentifiers (void) const noexcept |
| Get the direct children, in the order they were attached. | |
| bool | hasChild (ecs::Entity::Identifier identifier) const noexcept |
| Check whether an entity is a direct child of this one. | |
| bool | addChild (ecs::Entity::Identifier identifier) |
| Append an entity to the direct children. | |
| bool | removeChild (ecs::Entity::Identifier identifier) |
| Remove an entity from the direct children. | |
| std::int32_t | getLayer (void) const noexcept |
| Get the depth of the entity in the tree. | |
| Hierarchy & | setLayer (std::int32_t layer) |
| Store the depth of the entity in the tree. | |
| Public Member Functions inherited from guillaume::ecs::Component | |
| bool | hasChanged (void) const |
| Tell whether a value of the component changed since the flags were last reset (the end of the previous frame). | |
| void | setHasChanged (bool hasChanged) |
| Raise or lower the changed flag. | |
| Component (void)=default | |
| Create a component that is not marked as changed. | |
| virtual | ~Component (void)=default |
| Virtual destructor, so components can be destroyed through the base class. | |
Place of an entity in the entity tree: its parent, its direct children and its depth.
It lets a system walk the tree from identifiers alone, without entity objects. Every entity built on a component registry has one. ecs::Entity::setParent writes it: it updates the parent identifier of the entity, the child lists of the previous and of the new parent, and the layer of the entity and of all its descendants. Removing an entity unlinks it from its parent and resets the parent of its children. Systems read it: systems::Layout::layerOf returns the layer, which stacks content in front of its container, and systems::Selection takes the members of a selection group from the child list.
Treat it as read-only outside ecs::Entity. Each setter changes this component only: setParentIdentifier() does not touch the child list of the parent, and addChild() does not set the parent or the layer of the child.
Definition at line 60 of file hierarchy.hpp.
| bool guillaume::components::Hierarchy::addChild | ( | ecs::Entity::Identifier | identifier | ) |
Append an entity to the direct children.
Called by ecs::Entity::setParent. Marks the component changed when the child is added.
| identifier | The child identifier. |
Definition at line 61 of file hierarchy.cpp.

|
noexcept |
Get the direct children, in the order they were attached.
Definition at line 49 of file hierarchy.cpp.
|
noexcept |
Get the depth of the entity in the tree.
Definition at line 83 of file hierarchy.cpp.

|
noexcept |
Get the identifier of the parent entity.
Definition at line 28 of file hierarchy.cpp.
|
noexcept |
Check whether an entity is a direct child of this one.
| identifier | The identifier to look for. |
Definition at line 54 of file hierarchy.cpp.

|
noexcept |
Check whether the entity has a parent.
Definition at line 43 of file hierarchy.cpp.
| bool guillaume::components::Hierarchy::removeChild | ( | ecs::Entity::Identifier | identifier | ) |
Remove an entity from the direct children.
The order of the remaining children is kept. Marks the component changed when the child is removed.
| identifier | The child identifier. |
Definition at line 71 of file hierarchy.cpp.

| Hierarchy & guillaume::components::Hierarchy::setLayer | ( | std::int32_t | layer | ) |
Store the depth of the entity in the tree.
Called by ecs::Entity::setParent for the entity and each of its descendants. Marks the component changed only when the layer differs.
| layer | The depth: 0 for a root entity. |
Definition at line 88 of file hierarchy.cpp.

| Hierarchy & guillaume::components::Hierarchy::setParentIdentifier | ( | ecs::Entity::Identifier | identifier | ) |
Store the identifier of the parent entity.
Called by ecs::Entity::setParent. Marks the component changed only when the identifier differs.
| identifier | The parent identifier, or ecs::Entity::InvalidIdentifier to make the entity a root. |
Definition at line 34 of file hierarchy.cpp.
