3#include "ll/api/reflection/TypeName.h"
4#include "ll/api/utils/HashUtils.h"
8class EventId :
public hash_utils::HashedIdBase {
12 [[nodiscard]]
constexpr explicit EventId(std::string_view
id) noexcept
13 : HashedIdBase(hash_utils::doHash(
id)),
19 std::string_view name;
21 [[nodiscard]]
constexpr explicit EventIdView(std::string_view
id) noexcept
22 : HashedIdBase(hash_utils::doHash(
id)),
24 [[nodiscard]]
constexpr EventIdView(
EventId const&
id) noexcept : HashedIdBase(
id.hash), name(
id.name) {}
26[[nodiscard]]
constexpr EventId::EventId(
EventIdView const&
id) noexcept : HashedIdBase(
id.hash), name(
id.name) {}
28static constexpr inline EventIdView EmptyEventId{{}};
31constexpr EventIdView getEventId = []() -> EventIdView {
32 using self = std::remove_cvref_t<T>;
33 if constexpr (self::CustomEventId != EmptyEventId) {
34 return self::CustomEventId;
36 static_assert(std::is_final_v<self>,
"Only final classes can use getEventId");
37 return EventIdView{reflection::type_unprefix_name_v<self>};