Skip to main content

CommandBufferTypeId.ixx File

Unique type identifier for command buffers. 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...

namespacemessaging

Communication infrastructure for commands and events. More...

namespacecommand

Compile-time typed command buffering and handler routing. More...

namespacetypes

Classes Index

classCommandBufferTypeId

Unique type identifier for command buffer types. More...

structhelios_engine_common_tag_CommandTypes

Tag type for the TypeIndexer domain. More...

structhash<helios::engine::runtime::messaging::command::types::CommandBufferTypeId>

Hash specialization for CommandBufferTypeId. More...

Description

Unique type identifier for command buffers.

File Listing

The file content with the documentation metadata removed is:

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

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.