Skip to main content

ResourceTypeId.ixx File

Unique type identifier for engine resources. 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

classResourceTypeId

Unique type identifier for engine resources. More...

structhelios_engine_common_tag_ResourceTypes

Tag type for the TypeIndexer domain. More...

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

Hash specialization for ResourceTypeId. More...

Description

Unique type identifier for engine resources.

File Listing

The file content with the documentation metadata removed is:

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

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.