Skip to main content

ComponentTypeId Class Template

Unique type identifier for component types, scoped per domain. More...

Declaration

template <typename THandle> class helios::ecs::types::ComponentTypeId<THandle> { ... }

Friends Index

template <typename THandle>
constexpr booloperator==

Public Constructors Index

template <typename THandle>
ComponentTypeId (const size_t id)

Constructs a ComponentTypeId with a specific ID value. More...

template <typename THandle>
ComponentTypeId (helios::ecs::types::no_init_t)

Constructs an uninitialized ComponentTypeId. More...

Public Member Functions Index

template <typename THandle>
size_tvalue () const noexcept

Returns the underlying ID value. More...

Private Member Attributes Index

template <typename THandle>
size_tid_ {0}

The underlying ID value. More...

Public Static Functions Index

template <typename T>
static auto id () -> ComponentTypeId< THandle >

Gets the ComponentTypeId for a specific component type. More...

Description

Unique type identifier for component types, scoped per domain.

ComponentTypeId assigns a unique, monotonically increasing integer ID to each component type at compile time. This ID is used as an index into the component storage vector within EntityManager, enabling O(1) access.

Definition at line 53 of file ComponentTypeId.ixx.

Friends

operator==

friend constexpr bool ComponentTypeId, ComponentTypeId
constexpr noexcept default

Definition at line 106 of file ComponentTypeId.ixx.

Public Constructors

ComponentTypeId()

template <typename THandle>
helios::ecs::types::ComponentTypeId< THandle >::ComponentTypeId (const size_t id)
inline explicit

Constructs a ComponentTypeId with a specific ID value.

This constructor initializes a ComponentTypeId object with a given ID, representing a unique identifier for a component type. The ID is used internally for indexing and retrieving components from the storage system.

Parameters
id

The unique identifier assigned to the component type. This ID must be a valid non-negative value.

Definition at line 72 of file ComponentTypeId.ixx.

72 explicit ComponentTypeId(const size_t id) : id_(id) {}

ComponentTypeId()

template <typename THandle>
helios::ecs::types::ComponentTypeId< THandle >::ComponentTypeId (helios::ecs::types::no_init_t)
inline explicit

Constructs an uninitialized ComponentTypeId.

Parameters
<a href="/docs/api/helios-ecs/structs/helios/ecs/types/no-init-t">no_init_t</a>

Tag to indicate no initialization.

Definition at line 79 of file ComponentTypeId.ixx.

Public Member Functions

value()

template <typename THandle>
size_t helios::ecs::types::ComponentTypeId< THandle >::value ()
inline noexcept

Returns the underlying ID value.

Returns

The numeric type ID, suitable for use as an array index.

Definition at line 86 of file ComponentTypeId.ixx.

86 [[nodiscard]] size_t value() const noexcept {
87 return id_;
88 }

Referenced by helios::ecs::EntityManager< THandle, TEntityRegistry, TCapacity >::has, helios::ecs::ComponentOpsRegistry< THandle >::ops, helios::ecs::EntityManager< THandle, TEntityRegistry, TCapacity >::raw and helios::ecs::ComponentOpsRegistry< THandle >::setOps.

Private Member Attributes

id_

template <typename THandle>
size_t helios::ecs::types::ComponentTypeId< THandle >::id_ {0}

The underlying ID value.

Definition at line 58 of file ComponentTypeId.ixx.

58 size_t id_{0};

Public Static Functions

id()

template <typename T>
ComponentTypeId< THandle > helios::ecs::types::ComponentTypeId< THandle >::id ()
inline static

Gets the ComponentTypeId for a specific component type.

Uses TypeIndexer to generate a unique, monotonically increasing ID for each component type. The ID is generated once per type and cached.

Template Parameters
T

The component type. Must be a concrete type (not abstract).

Returns

The unique ComponentTypeId for type T.

Definition at line 101 of file ComponentTypeId.ixx.

101 [[nodiscard]] static ComponentTypeId<THandle> id() {
102 static const size_t tid = helios::ecs::TypeIndexer<THandle>::template typeIndex<T>();
103 return ComponentTypeId(tid);
104 }

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.