Skip to main content

HierarchyComponent.ixx File

Component for parent-child entity relationships. More...

Included Headers

#include <optional> #include <span> #include <vector> #include <helios.ecs.types.EntityHandle>

Namespaces Index

namespacehelios
namespaceecs
namespacecomponents

Classes Index

classHierarchyComponent<THandle>

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

Description

Component for parent-child entity relationships.

File Listing

The file content with the documentation metadata removed is:

1
5module;
6
7#include <optional>
8#include <span>
9#include <vector>
10
11export module helios.ecs.components.HierarchyComponent;
12
13import helios.ecs.types.EntityHandle;
14
15export namespace helios::ecs::components {
16
27 template<typename THandle>
29
33 std::vector<THandle> children_;
34
38 std::optional<THandle> parent_;
39
43 bool isDirty_ = false;
44
48 bool isEnabled_ = true;
49
50 public:
51
57 void addChild(const THandle child) {
58 children_.push_back(child);
59 }
60
66 void setParent(const THandle parent) {
67 parent_ = parent;
68 }
69
75 [[nodiscard]] std::optional<THandle> parent() const noexcept {
76 return parent_;
77 }
78
84 [[nodiscard]] std::span<const THandle> children() noexcept {
85 return children_;
86 }
87
91 void markDirty() {
92 isDirty_ = true;
93 }
94
98 void clearDirty() {
99 isDirty_ = false;
100 }
101
107 [[nodiscard]] bool isDirty() const noexcept {
108 return isDirty_;
109 }
110
111 };
112
113
114}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.