Rationalised etl::send_message functions

This commit is contained in:
John Wellbelove 2022-08-07 17:21:10 +01:00
parent 00b970f7c9
commit e10cd6dab3
4 changed files with 40 additions and 37 deletions

View File

@ -370,6 +370,26 @@ namespace etl
destination.receive(message);
}
//***************************************************************************
/// Send a message to a router with a particular id.
//***************************************************************************
static inline void send_message(etl::imessage_router& destination,
etl::message_router_id_t id,
const etl::imessage& message)
{
destination.receive(id, message);
}
//***************************************************************************
/// Send a shared message to a router with a particular id.
//***************************************************************************
static inline void send_message(etl::imessage_router& destination,
etl::message_router_id_t id,
etl::shared_message message)
{
destination.receive(id, message);
}
//*************************************************************************************************
// For C++17 and above.
//*************************************************************************************************

View File

@ -330,24 +330,6 @@ namespace etl
subscription_node head;
};
//***************************************************************************
/// Send a message to a broker.
//***************************************************************************
static inline void send_message(etl::message_broker& broker,
const etl::imessage& message)
{
broker.receive(message);
}
//***************************************************************************
/// Send a shared message to a broker.
//***************************************************************************
static inline void send_message(etl::message_broker& broker,
etl::shared_message message)
{
broker.receive(message);
}
}
#endif

View File

@ -424,25 +424,6 @@ namespace etl
etl::vector<etl::imessage_router*, MAX_ROUTERS_> router_list;
};
//***************************************************************************
/// Send a message to a bus.
//***************************************************************************
static inline void send_message(etl::imessage_bus& bus,
const etl::imessage& message)
{
bus.receive(message);
}
//***************************************************************************
/// Send a message to a bus.
//***************************************************************************
static inline void send_message(etl::imessage_bus& bus,
etl::message_router_id_t id,
const etl::imessage& message)
{
bus.receive(id, message);
}
}
#endif

View File

@ -358,6 +358,26 @@ namespace etl
destination.receive(message);
}
//***************************************************************************
/// Send a message to a router with a particular id.
//***************************************************************************
static inline void send_message(etl::imessage_router& destination,
etl::message_router_id_t id,
const etl::imessage& message)
{
destination.receive(id, message);
}
//***************************************************************************
/// Send a shared message to a router with a particular id.
//***************************************************************************
static inline void send_message(etl::imessage_router& destination,
etl::message_router_id_t id,
etl::shared_message message)
{
destination.receive(id, message);
}
//*************************************************************************************************
// For C++17 and above.
//*************************************************************************************************