OGLplus  (0.59.0) a C++ wrapper for rendering APIs

handler_map.hpp
Go to the documentation of this file.
1 
9 #ifndef EAGINE_MESSAGE_BUS_HANDLER_MAP_HPP
10 #define EAGINE_MESSAGE_BUS_HANDLER_MAP_HPP
11 
12 #include "../mem_func_const.hpp"
13 #include "../message_id.hpp"
14 #include "../span.hpp"
15 
16 namespace eagine::msgbus {
17 //------------------------------------------------------------------------------
25 template <typename MemFuncConst>
27  message_id _msg_id;
28 
30  constexpr message_handler_map(message_id msgid) noexcept
31  : _msg_id{std::move(msgid)} {}
32 
34  constexpr auto msg_id() const noexcept -> message_id {
35  return _msg_id;
36  }
37 
39  static constexpr auto method() noexcept -> MemFuncConst {
40  return {};
41  }
42 };
43 //------------------------------------------------------------------------------
51 template <typename MessageId, typename MemFuncConst>
53 
55  static constexpr auto msg_id() noexcept -> MessageId {
56  return {};
57  }
58 
60  static constexpr auto method() noexcept -> MemFuncConst {
61  return {};
62  }
63 };
64 //------------------------------------------------------------------------------
72 #define EAGINE_MSG_MAP(CLASS_ID, METHOD_ID, CLASS, METHOD) \
73  eagine::msgbus::static_message_handler_map< \
74  EAGINE_MSG_TYPE(CLASS_ID, METHOD_ID), \
75  EAGINE_MEM_FUNC_T(CLASS, METHOD)>()
76 //------------------------------------------------------------------------------
77 } // namespace eagine::msgbus
78 
79 #endif // EAGINE_MESSAGE_BUS_HANDLER_MAP_HPP
static constexpr auto method() noexcept -> MemFuncConst
Returns the member function constant.
Definition: handler_map.hpp:60
static constexpr auto msg_id() noexcept -> MessageId
Returns the message type id.
Definition: handler_map.hpp:55
constexpr auto msg_id() const noexcept -> message_id
Returns the message type id.
Definition: handler_map.hpp:34
static constexpr auto method() noexcept -> MemFuncConst
Returns the member function constant.
Definition: handler_map.hpp:39
Represents a mapping from a message type id to member function constant.
Definition: handler_map.hpp:26
Message bus code is placed in this namespace.
Definition: eagine.hpp:58
constexpr message_handler_map(message_id msgid) noexcept
Construction from message type id.
Definition: handler_map.hpp:30
Class storing two identifier values representing class/method pair.
Definition: message_id.hpp:25
Represents a mapping from a message type id to member function constant.
Definition: handler_map.hpp:52

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).