Skip to main content

CommandTypeId.ixx File

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

namespacemessaging

Communication infrastructure for commands and events. More...

namespacecommand

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

namespacetypes

Classes Index

classCommandTypeId

Unique type identifier for command types. More...

structhelios_engine_common_tag_CommandTypes

Tag type for the TypeIndexer domain. More...

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

Hash specialization for CommandTypeId. More...

Description

Unique type identifier for command types.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file CommandTypeId.ixx
3 * @brief Unique type identifier for command types.
4 */
5module;
6
7#include <functional>
8
9export module helios.engine.runtime.messaging.command.types.CommandTypeId;
10
11import helios.core.data.TypeIndexer;
12import helios.core.types;
13
15
16 /**
17 * @brief Unique type identifier for command types.
18 *
19 * @details CommandTypeId assigns a unique, monotonically increasing
20 * integer ID to each command type at compile time. The ID is generated
21 * once per type via TypeIndexer and cached in a function-local static.
22 *
23 * Suitable for use as an array index or hash key.
24 *
25 * @see TypeIndexer
26 * @see ResourceTypeId
27 * @see ComponentTypeId
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 CommandTypeId with a specific value.
49 *
50 * @param id The type ID value.
51 */
52 explicit CommandTypeId(const size_t id) : id_(id) {}
53
54
55 /**
56 * @brief Constructs an uninitialized CommandTypeId.
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 CommandTypeId 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 CommandTypeId for type T.
82 */
83 template <typename T>
84 [[nodiscard]] static CommandTypeId id() {
86 return CommandTypeId(tid);
87 }
88
89 friend constexpr bool operator==(CommandTypeId, CommandTypeId) noexcept = default;
90 };
91
92
93}
94
95
96/**
97 * @brief Hash specialization for CommandTypeId.
98 */
99template<>
100struct std::hash<helios::engine::runtime::messaging::command::types::CommandTypeId> {
102 return id.value();
103 }
104
105};

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.