Go to the documentation of this file.
9 #ifndef EAGINE_MESSAGE_BUS_SERVICE_ABILITY_HPP
10 #define EAGINE_MESSAGE_BUS_SERVICE_ABILITY_HPP
12 #include "../serialize.hpp"
13 #include "../subscriber.hpp"
17 template <
typename Base = subscriber>
18 class ability_provider :
public Base {
19 using This = ability_provider;
31 virtual auto can_handle(message_id) ->
bool = 0;
34 auto _handle_query(
const message_context& msg_ctx, stored_message& message)
39 msg_ctx.bus().respond_to(
49 template <
typename Base = subscriber>
50 class ability_tester :
public Base {
52 using This = ability_tester;
64 void find_handler(message_id msg_id) {
65 std::array<byte, 32> temp{};
67 EAGINE_ASSERT(serialized);
73 virtual void on_handler_found(
identifier_t target_id, message_id) = 0;
76 auto _handle_response(
const message_context&, stored_message& message)
80 on_handler_found(
message.source_id, msg_id);
88 #endif // EAGINE_MESSAGE_BUS_SERVICE_ABILITY_HPP
#define EAGINE_MSG_MAP(CLASS_ID, METHOD_ID, CLASS, METHOD)
Constructs an instance of static message handler map.
Definition: handler_map.hpp:72
#define EAGINE_MSG_ID(API, NAME)
Macro for instantiating objects of static_message_id.
Definition: message_id.hpp:148
static constexpr auto cover(T *addr, S size) noexcept -> span_if_mutable< T >
Creates a span starting at the specified pointer and specified length.
Definition: span.hpp:465
static constexpr auto extract(api_result_value< Result, api_result_validity::never > &) noexcept -> Result &
Overload of extract for api_result_value.
Definition: c_api_wrap.hpp:270
auto default_serialize(T &value, memory::block blk) -> serialization_result< memory::const_block >
Uses the default backend to serialize a value into a memory block.
Definition: serialize.hpp:191
Message bus code is placed in this namespace.
Definition: eagine.hpp:58
@ message
Message protocol.
std::uint64_t identifier_t
The underlying integer type for eagine::identifier.
Definition: identifier_t.hpp:19
auto bus() noexcept -> auto &
Returns a reference to the associated endpoint.
Definition: subscriber.hpp:38
auto default_deserialize_message_type(message_id &msg_id, memory::const_block blk)
Default-deserializes the specified message id from a memory block.
Definition: serialize.hpp:266
@ message_id
The message type id has been verified.