Go to the documentation of this file.
    9 #ifndef EAGINE_MESSAGE_BUS_SERVICE_TOPOLOGY_HPP 
   10 #define EAGINE_MESSAGE_BUS_SERVICE_TOPOLOGY_HPP 
   12 #include "../serialize.hpp" 
   13 #include "../subscriber.hpp" 
   17 template <
typename Base = subscriber>
 
   18 class network_topology : 
public Base {
 
   19     using This = network_topology;
 
   27           this, 
EAGINE_MSG_MAP(eagiMsgBus, topoRutrCn, This, _handle_router));
 
   29           this, 
EAGINE_MSG_MAP(eagiMsgBus, topoBrdgCn, This, _handle_bridge));
 
   31           this, 
EAGINE_MSG_MAP(eagiMsgBus, topoEndpt, This, _handle_endpoint));
 
   35     void discover_topology() {
 
   38         const auto msg_id{EAGINE_MSGBUS_ID(topoQuery)};
 
   39         this->
bus().post(msg_id, message);
 
   42     virtual void router_appeared(
const router_topology_info& info) = 0;
 
   43     virtual void bridge_appeared(
const bridge_topology_info& info) = 0;
 
   44     virtual void endpoint_appeared(
const endpoint_topology_info& info) = 0;
 
   47     auto _handle_router(
const message_context&, stored_message& message)
 
   49         router_topology_info 
info{};
 
   51             router_appeared(info);
 
   56     auto _handle_bridge(
const message_context&, stored_message& message)
 
   58         bridge_topology_info 
info{};
 
   60             bridge_appeared(info);
 
   65     auto _handle_endpoint(
const message_context&, stored_message& message)
 
   67         endpoint_topology_info 
info{};
 
   69             endpoint_appeared(info);
 
   77 #endif // EAGINE_MESSAGE_BUS_SERVICE_TOPOLOGY_HPP 
  
#define EAGINE_MSG_MAP(CLASS_ID, METHOD_ID, CLASS, METHOD)
Constructs an instance of static message handler map.
Definition: handler_map.hpp:72
 
@ info
Informational log entries.
 
static constexpr auto broadcast_endpoint_id() noexcept -> identifier_t
Returns the special broadcase message bus endpoint id.
Definition: message.hpp:42
 
Message bus code is placed in this namespace.
Definition: eagine.hpp:58
 
auto default_deserialize(T &value, memory::const_block blk) -> deserialization_result< memory::const_block >
Uses the default backend to deserialize a value from a memory block.
Definition: serialize.hpp:235
 
@ message
Message protocol.
 
auto bus() noexcept -> auto &
Returns a reference to the associated endpoint.
Definition: subscriber.hpp:38