mirror of
https://github.com/ETLCPP/etl.git
synced 2026-11-09 22:59:47 +08:00
Added non-member etl::send_message for etl::shared_message
This commit is contained in:
parent
b77c7753d3
commit
a074b42b91
@ -414,7 +414,7 @@ namespace etl
|
||||
/// Send a message to a bus.
|
||||
//***************************************************************************
|
||||
static inline void send_message(etl::imessage_bus& bus,
|
||||
const etl::imessage& message)
|
||||
const etl::imessage& message)
|
||||
{
|
||||
bus.receive(message);
|
||||
}
|
||||
@ -423,8 +423,8 @@ namespace etl
|
||||
/// 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)
|
||||
etl::message_router_id_t id,
|
||||
const etl::imessage& message)
|
||||
{
|
||||
bus.receive(id, message);
|
||||
}
|
||||
|
||||
@ -319,6 +319,15 @@ namespace etl
|
||||
destination.receive(message);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
/// Send a shared message to a router.
|
||||
//***************************************************************************
|
||||
static inline void send_message(etl::imessage_router& destination,
|
||||
etl::shared_message message)
|
||||
{
|
||||
destination.receive(message);
|
||||
}
|
||||
|
||||
//*************************************************************************************************
|
||||
// For C++17 and above.
|
||||
//*************************************************************************************************
|
||||
|
||||
@ -230,7 +230,7 @@ namespace
|
||||
bus.receive(sm2);
|
||||
bus.receive(sm1);
|
||||
bus.receive(sm3);
|
||||
bus.receive(sm4); // sm4 is a copy of sm1
|
||||
etl::send_message(bus, sm4); // sm4 is a copy of sm1. Use non-member function.
|
||||
bus.receive(RouterId2, sm1); // Only send sm1 to Router2
|
||||
|
||||
CHECK(sm1.is_valid());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user