EntityHandle Struct
A versioned handle for referencing entities in an EntityPool. More...
Declaration
Public Operators Index
| bool | operator== (const EntityHandle &) const =default |
|
Compares two handles for equality. More... | |
| constexpr bool | operator< (const EntityHandle &entityHandle) const noexcept |
|
Compares two handles by entity ID (less-than). More... | |
| constexpr bool | operator> (const EntityHandle &entityHandle) const noexcept |
|
Compares two handles by entity ID (greater-than). More... | |
Public Member Functions Index
| bool | isValid () const noexcept |
|
Checks if this handle is potentially valid. More... | |
Public Member Attributes Index
| helios::engine::ecs::types::EntityId | entityId |
|
The unique identifier for the entity within the pool. More... | |
| helios::engine::common::types::VersionId | versionId |
|
The version number for stale handle detection. More... | |
Description
A versioned handle for referencing entities in an EntityPool.
`EntityHandle` combines an entity ID with a version number to provide safe references to pooled entities. The version ensures that handles to removed entities are detected as stale.
- See Also
EntityPool
Definition at line 27 of file EntityHandle.ixx.
Public Operators
operator<()
| inline constexpr noexcept |
Compares two handles by entity ID (less-than).
- Parameters
-
entityHandle The handle to compare against.
- Returns
True if this handle's entity ID is less than the other.
Definition at line 53 of file EntityHandle.ixx.
Reference entityId.
operator==()
| default |
Compares two handles for equality.
Definition at line 44 of file EntityHandle.ixx.
operator>()
| inline constexpr noexcept |
Compares two handles by entity ID (greater-than).
- Parameters
-
entityHandle The handle to compare against.
- Returns
True if this handle's entity ID is greater than the other.
Definition at line 64 of file EntityHandle.ixx.
Reference entityId.
Public Member Functions
isValid()
| inline nodiscard noexcept |
Checks if this handle is potentially valid.
- Returns
True if the version is at least 1 (initial version).
Definition at line 73 of file EntityHandle.ixx.
Reference versionId.
Referenced by helios::engine::runtime::pooling::GameObjectPool::addInactive, helios::engine::runtime::pooling::GameObjectPool::release, helios::engine::runtime::pooling::GameObjectPool::releaseAndRemove and helios::engine::builder::gameObject::builders::configs::ChaseConfig::target.
Public Member Attributes
entityId
|
The unique identifier for the entity within the pool.
Definition at line 32 of file EntityHandle.ixx.
Referenced by helios::engine::runtime::pooling::GameObjectPool::acquire, helios::engine::runtime::pooling::GameObjectPool::addInactive, helios::engine::ecs::EntityRegistry::destroy, operator<, operator>, helios::engine::runtime::pooling::GameObjectPool::release and helios::engine::runtime::pooling::GameObjectPool::releaseAndRemove.
versionId
|
The version number for stale handle detection.
Incremented when an entity is removed from the pool.
Definition at line 39 of file EntityHandle.ixx.
Referenced by helios::engine::runtime::pooling::GameObjectPool::acquire, isValid, helios::engine::runtime::pooling::GameObjectPool::release and helios::engine::runtime::pooling::GameObjectPool::releaseAndRemove.
The documentation for this struct was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.