Skip to main content

SystemTypeId.ixx File

Unique type identifier for system types. More...

Included Headers

#include <functional> #include <helios.core.types> #include <helios.core.data.TypeIndexer>

Namespaces Index

namespacehelios
namespaceengine

Main engine module aggregating core infrastructure and game systems. More...

namespaceruntime

Runtime infrastructure for game execution and lifecycle orchestration. More...

namespaceworld

World state management, resource registry, and per-frame update context. More...

namespacetypes

Classes Index

classSystemTypeId

Unique type identifier for system types. More...

structhelios_engine_common_tag_SystemTypes

Tag type for the TypeIndexer domain. More...

structhash<helios::engine::runtime::world::types::SystemTypeId>

Hash specialization for SystemTypeId. More...

Description

Unique type identifier for system types.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file SystemTypeId.ixx
3 * @brief Unique type identifier for system types.
4 */
5module;
6
7#include <functional>
8
9export module helios.engine.runtime.world.types.SystemTypeId;
10
11import helios.core.data.TypeIndexer;
12import helios.core.types;
13
15
16 /**
17 * @brief Unique type identifier for system types.
18 *
19 * @details SystemTypeId assigns a unique, monotonically increasing
20 * integer ID to each system type at compile time. Used by
21 * SystemRegistry as an index for O(1) type-based system lookup.
22 *
23 * @see SystemRegistry
24 * @see TypeIndexer
25 * @see ResourceTypeId
26 */
28
29 /**
30 * @brief Tag type for the TypeIndexer domain.
31 */
32 struct helios_engine_common_tag_SystemTypes{};
33
34 using SystemType = helios_engine_common_tag_SystemTypes;
35
36 /**
37 * @brief The underlying ID value.
38 */
39 size_t id_{0};
40
41
42 public:
43
44
45 /**
46 * @brief Constructs a SystemTypeId with a specific value.
47 *
48 * @param id The type ID value.
49 */
50 explicit SystemTypeId(const size_t id) : id_(id) {}
51
52
53 /**
54 * @brief Constructs an uninitialized SystemTypeId.
55 *
56 * @param no_init_t Tag to indicate no initialization.
57 */
59
60
61 /**
62 * @brief Returns the underlying ID value.
63 *
64 * @return The numeric type ID, suitable for use as an array index.
65 */
66 [[nodiscard]] size_t value() const noexcept {
67 return id_;
68 }
69
70
71 /**
72 * @brief Returns the SystemTypeId for a specific type.
73 *
74 * @details Uses TypeIndexer to generate a unique ID per type.
75 * The ID is generated once and cached.
76 *
77 * @tparam T The resource type.
78 *
79 * @return The unique SystemTypeId for type T.
80 */
81 template <typename T>
82 [[nodiscard]] static SystemTypeId id() {
84 return SystemTypeId(tid);
85 }
86
87 friend constexpr bool operator==(SystemTypeId, SystemTypeId) noexcept = default;
88 };
89
90
91}
92
93
94/**
95 * @brief Hash specialization for SystemTypeId.
96 */
97template<>
98struct std::hash<helios::engine::runtime::world::types::SystemTypeId> {
99 std::size_t operator()(const helios::engine::runtime::world::types::SystemTypeId& id) const noexcept {
100 return id.value();
101 }
102
103};

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.