Engine → ECS → entity_handle.h
component_ref
| Type | Class |
| Namespace | conjure::ecs |
| Include File Path | engine/include/conjure/ecs/entity_handle.h |
| Source File Path | N/A |
| API ↗ | Entities and components |
Syntax
Constructors
| Access | Signature | Description |
|---|---|---|
| public | component_ref() noexcept = default; | A reference to nothing. |
| public | component_ref(
world &target,
entity owner) noexcept; | |
| public | component_ref(
const component_ref &) noexcept = default; |
Destructors
| Access | Signature | Description |
|---|---|---|
| public | ~component_ref() = default; |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mEntity | entity | {} | |
| private | mWorld | world * | nullptr |
Functions
Public
is_valid
is_valid[[nodiscard]] bool is_valid() const noexcept;True while the entity is alive and holds the component.
read
read[[nodiscard]] const ComponentType *read() const noexcept;The component for reading; nullptr when dead or missing. Never stamps.
set
set[[nodiscard]] core::result<void> set(
ComponentType value);Replaces the value. ENTITY_NOT_ALIVE / COMPONENT_NOT_PRESENT when the reference is invalid.
valid
valid[[deprecated("use is_valid()")]] [[nodiscard]] bool valid() const noexcept;The former name of is_valid(), kept for one wave; returns is_valid().
write
write[[nodiscard]] ComponentType *write() noexcept;The component for writing; stamps its chunk column. nullptr when dead or missing.
Operator Overloads
Public
operator=
operator=component_ref &operator=(
const component_ref &) noexcept = default;