29#ifndef ETL_MESSAGE_BROKER_INCLUDED
30#define ETL_MESSAGE_BROKER_INCLUDED
34#include "message_types.h"
36#include "message_router.h"
51 class subscription_node
64 void set_next(subscription_node*
sub)
70 subscription_node* get_next()
const
78 set_next(ETL_NULLPTR);
82 void append(subscription_node*
sub)
84 if (
sub != ETL_NULLPTR)
86 sub->set_next(get_next());
91 subscription_node* p_next;
131 using etl::imessage_router::receive;
182 initialise_insertion_point(&
router, ETL_NULLPTR);
188 receive(etl::imessage_router::ALL_MESSAGE_ROUTERS,
msg);
193 receive(etl::imessage_router::ALL_MESSAGE_ROUTERS,
shared_msg);
197 virtual void receive(etl::message_router_id_t destination_router_id,
205 subscription*
sub =
static_cast<subscription*
>(head.get_next());
207 while (
sub != ETL_NULLPTR)
217 if (destination_router_id == etl::imessage_router::ALL_MESSAGE_ROUTERS ||
218 destination_router_id ==
router->get_message_router_id())
224 sub =
sub->next_subscription();
236 virtual void receive(etl::message_router_id_t destination_router_id,
244 subscription*
sub =
static_cast<subscription*
>(head.get_next());
246 while (
sub != ETL_NULLPTR)
256 if (destination_router_id == etl::imessage_router::ALL_MESSAGE_ROUTERS ||
257 destination_router_id ==
router->get_message_router_id())
263 sub =
sub->next_subscription();
274 using imessage_router::accepts;
287 while (
sub != ETL_NULLPTR)
303 sub =
sub->next_subscription();
328 ETL_DEPRECATED
virtual bool is_null_router()
const ETL_OVERRIDE
334 virtual bool is_producer()
const ETL_OVERRIDE
340 virtual bool is_consumer()
const ETL_OVERRIDE
348 return head.get_next() == ETL_NULLPTR;
358 subscription_node*
p_sub = head.get_next();
361 while (
p_sub != ETL_NULLPTR)
386 subscription_node head;
This is the base of all message routers.
Definition message_router_generator.h:121
Definition message_broker.h:100
Message broker.
Definition message_broker.h:47
void subscribe(etl::message_broker::subscription &new_sub)
Subscribe to the broker.
Definition message_broker.h:174
message_broker()
Constructor.
Definition message_broker.h:136
message_broker(etl::message_router_id_t id_)
Constructor.
Definition message_broker.h:154
virtual bool accepts(etl::message_id_t id) const ETL_OVERRIDE
Definition message_broker.h:280
message_broker(etl::message_router_id_t id_, etl::imessage_router &successor_)
Constructor.
Definition message_broker.h:164
message_broker(etl::imessage_router &successor_)
Constructor.
Definition message_broker.h:145
Router id is out of the legal range.
Definition message_router_generator.h:101
Definition shared_message.h:49
Span - Fixed Extent.
Definition span.h:110
bool has_successor() const
Does this have a successor?
Definition successor.h:184
successor_type & get_successor() const
Definition successor.h:174
#define ETL_ASSERT(b, e)
Definition error_handler.h:356
bitset_ext
Definition absolute.h:38
uint_least8_t message_id_t
Allow alternative type for message id.
Definition message_types.h:40
ETL_NODISCARD ETL_CONSTEXPR14 T round_half_even_unscaled(T value) ETL_NOEXCEPT
Definition scaled_rounding.h:314