Go to the documentation of this file.
9 #ifndef EAGINE_MESSAGE_ID_HPP
10 #define EAGINE_MESSAGE_ID_HPP
17 template <
identifier_t ClassId,
identifier_t MethodId>
25 struct message_id : std::tuple<identifier_t, identifier_t> {
26 using base = std::tuple<identifier_t, identifier_t>;
39 : base{c.value(), m.value()} {}
42 constexpr
message_id(std::tuple<identifier, identifier> t) noexcept
43 :
message_id{std::get<0>(t), std::get<1>(t)} {}
46 template <
identifier_t ClassId,
identifier_t MethodId>
48 : base{ClassId, MethodId} {}
52 return std::get<0>(*
this);
62 return std::get<1>(*
this);
102 template <
identifier_t ClassId,
identifier_t MethodId>
103 struct static_message_id {
104 using type = static_message_id;
129 template <
identifier_t ClassId,
identifier_t MethodId>
140 #define EAGINE_MSG_TYPE(API, NAME) \
141 ::eagine::static_message_id<EAGINE_ID_V(API), EAGINE_ID_V(NAME)>
148 #define EAGINE_MSG_ID(API, NAME) \
149 EAGINE_MSG_TYPE(API, NAME) {}
153 #endif // EAGINE_MESSAGE_ID_HPP
Template with two identifier parameters representing class/method pair.
Definition: message_id.hpp:18
constexpr auto has_class(identifier id) const noexcept
Checks if the class identifier matches the argument.
Definition: message_id.hpp:85
constexpr message_id(const static_message_id< ClassId, MethodId > &) noexcept
Construction from static_message_id value.
Definition: message_id.hpp:47
static constexpr auto method() noexcept -> identifier
Returns the method identifier.
Definition: message_id.hpp:122
Common code is placed in this namespace.
Definition: eagine.hpp:21
constexpr auto class_id() const noexcept -> identifier_t
Returns the class identifier value.
Definition: message_id.hpp:51
constexpr auto has_method(identifier id) const noexcept
Checks if the method identifier matches the argument.
Definition: message_id.hpp:91
static constexpr auto class_() noexcept -> identifier
Returns the class identifier.
Definition: message_id.hpp:112
constexpr message_id(std::tuple< identifier, identifier > t) noexcept
Construction from a tuple of two identifier objects.
Definition: message_id.hpp:42
constexpr message_id() noexcept
Default constructor.
Definition: message_id.hpp:30
constexpr message_id(identifier_t c, identifier_t m) noexcept
Construction from two identifier values.
Definition: message_id.hpp:34
constexpr auto id_tuple() const noexcept -> std::tuple< identifier, identifier >
Returns the class and method identifiers in a tuple. See class_ See method.
Definition: message_id.hpp:78
constexpr message_id(identifier c, identifier m) noexcept
Construction from two identifier objects.
Definition: message_id.hpp:38
constexpr auto is_valid() const noexcept
Checks if the stored identifier values are non-zero.
Definition: message_id.hpp:71
static constexpr auto method_id() noexcept -> identifier_t
Returns the method identifier value.
Definition: message_id.hpp:117
static constexpr auto class_id() noexcept -> identifier_t
Returns the class identifier value.
Definition: message_id.hpp:107
std::uint64_t identifier_t
The underlying integer type for eagine::identifier.
Definition: identifier_t.hpp:19
auto operator==(message_id l, static_message_id< ClassId, MethodId > r) noexcept
Equality comparison between message_id and static_message_id.
Definition: message_id.hpp:131
Class storing two identifier values representing class/method pair.
Definition: message_id.hpp:25
constexpr auto class_() const noexcept -> identifier
Returns the class identifier.
Definition: message_id.hpp:56
constexpr auto method() const noexcept -> identifier
Returns the method identifier.
Definition: message_id.hpp:66
constexpr auto method_id() const noexcept -> identifier_t
Returns the method identifier value.
Definition: message_id.hpp:61