Skip to main content

StateTypeId.ixx File

Included Headers

#include <functional> #include <cstddef> #include <helios.ecs.types> #include <helios.ecs.TypeIndexer>

Namespaces Index

namespacehelios
namespaceengine
namespacestate
namespacetypes

Classes Index

classStateTypeId
structhelios_engine_common_tag_StateTypes

Tag type for the TypeIndexer domain. More...

structhash<helios::engine::state::types::StateTypeId>

std::hash specialization for StateTypeId. More...

File Listing

The file content with the documentation metadata removed is:

1
2module;
3
4#include <functional>
5#include <cstddef>
6
7export module helios.engine.state.types.StateTypeId;
8
9import helios.ecs.TypeIndexer;
10import helios.ecs.types;
11
12export namespace helios::engine::state::types {
13
14
15 class StateTypeId {
16
20 struct helios_engine_common_tag_StateTypes{};
21
22 using StateType = helios_engine_common_tag_StateTypes;
23
27 size_t id_{0};
28
34 explicit StateTypeId(const size_t id) : id_(id) {}
35
36 public:
37
43 explicit StateTypeId(helios::ecs::types::no_init_t) {}
44
51 return id_;
52 }
53
64 template <typename T>
65 [[nodiscard]] static StateTypeId id() {
66 static const size_t tid = helios::ecs::TypeIndexer<StateType>::typeIndex<T>();
67 return StateTypeId(tid);
68 }
69
70 friend constexpr bool operator==(StateTypeId, StateTypeId) noexcept = default;
71 };
72
73
74}
75
76
82template<>
83struct std::hash<helios::engine::state::types::StateTypeId> {
84 std::size_t operator()(const helios::engine::state::types::StateTypeId& id) const noexcept {
85 return id.value();
86 }
87
88};

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.