mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
Squashed commit of the following:
commit 97a6e6a03557359442123d439cef9bdf6dea2d1b
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Sun Feb 7 11:02:49 2021 +0000
Squashed commit of the following:
commit 04ba91bcccc8e12867962bc3746665f430672a23
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Sat Feb 6 10:43:34 2021 +0000
Updated shared message unit test
commit fababc5cf748073464b4294a50c201cb0aa4fa13
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Fri Feb 5 09:41:52 2021 +0000
Updated FSM generator
commit ff287bcf0a833ca70933354b42b8b036b422ff81
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Fri Feb 5 09:35:56 2021 +0000
Updated message router generator
commit 52724e1e62b55dad81e2f80dd656026d828b3214
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Thu Feb 4 13:06:50 2021 +0000
Updated unit tests
commit 0d89105262aa050577ccc17ddc6eece9f4fc5d18
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Tue Feb 2 20:09:35 2021 +0000
Interim commit
commit ce8385ff24826103c7a55267ccf3f8a31f517e0b
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Tue Feb 2 18:13:29 2021 +0000
Squashed commit of the following:
commit 007b56d03513887636b84fc246e57d6c4f8b777e
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Tue Feb 2 18:09:51 2021 +0000
Squashed commit of the following:
commit 6107c4538be149137209d85e5f41031291bc7150
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Tue Feb 2 12:15:31 2021 +0000
Added move constructor and move assignment to etl::shared_message
commit c9a5716012db9b614ea67660ebf64dcb790ce571
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Sun Jan 31 12:36:29 2021 +0000
Squashed commit of the following:
commit e5f4eb6fb38c337c82fcc250f17a8f21eb788975
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Sun Jan 31 12:34:49 2021 +0000
Squashed commit of the following:
commit 23c5f1d3f9b13ff9e46ce3de96aefeb655d5ed97
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Sun Jan 31 12:32:35 2021 +0000
Fixed rollover error for etl::queue_spsc_atomic
Added 'required_alignment' parameter to 'allocate' for etl::imemeory_block_allocator.
Updated QueuedMessageRouter example
commit e5f4eb6fb38c337c82fcc250f17a8f21eb788975
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Sun Jan 31 12:34:49 2021 +0000
Squashed commit of the following:
commit 23c5f1d3f9b13ff9e46ce3de96aefeb655d5ed97
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Sun Jan 31 12:32:35 2021 +0000
Fixed rollover error for etl::queue_spsc_atomic
Added 'required_alignment' parameter to 'allocate' for etl::imemeory_block_allocator.
Updated QueuedMessageRouter example
commit c9a5716012db9b614ea67660ebf64dcb790ce571
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Sun Jan 31 12:36:29 2021 +0000
Squashed commit of the following:
commit e5f4eb6fb38c337c82fcc250f17a8f21eb788975
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Sun Jan 31 12:34:49 2021 +0000
Squashed commit of the following:
commit 23c5f1d3f9b13ff9e46ce3de96aefeb655d5ed97
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Sun Jan 31 12:32:35 2021 +0000
Fixed rollover error for etl::queue_spsc_atomic
Added 'required_alignment' parameter to 'allocate' for etl::imemeory_block_allocator.
Updated QueuedMessageRouter example
commit 007b56d03513887636b84fc246e57d6c4f8b777e
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Tue Feb 2 18:09:51 2021 +0000
Squashed commit of the following:
commit 6107c4538be149137209d85e5f41031291bc7150
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Tue Feb 2 12:15:31 2021 +0000
Added move constructor and move assignment to etl::shared_message
commit c9a5716012db9b614ea67660ebf64dcb790ce571
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Sun Jan 31 12:36:29 2021 +0000
Squashed commit of the following:
commit e5f4eb6fb38c337c82fcc250f17a8f21eb788975
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Sun Jan 31 12:34:49 2021 +0000
Squashed commit of the following:
commit 23c5f1d3f9b13ff9e46ce3de96aefeb655d5ed97
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Sun Jan 31 12:32:35 2021 +0000
Fixed rollover error for etl::queue_spsc_atomic
Added 'required_alignment' parameter to 'allocate' for etl::imemeory_block_allocator.
Updated QueuedMessageRouter example
commit e5f4eb6fb38c337c82fcc250f17a8f21eb788975
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Sun Jan 31 12:34:49 2021 +0000
Squashed commit of the following:
commit 23c5f1d3f9b13ff9e46ce3de96aefeb655d5ed97
Author: John Wellbelove <github@wellbelove.co.uk>
Date: Sun Jan 31 12:32:35 2021 +0000
Fixed rollover error for etl::queue_spsc_atomic
Added 'required_alignment' parameter to 'allocate' for etl::imemeory_block_allocator.
Updated QueuedMessageRouter example
This commit is contained in:
parent
ce8385ff24
commit
a676076d84
@ -283,12 +283,12 @@ namespace etl
|
||||
#define ETL_ASSERT(b, e) {if(!(b)) {etl::error_handler::error((e));}} // If the condition fails, calls the error handler
|
||||
#define ETL_ALWAYS_ASSERT(e) {etl::error_handler::error((e));} // Calls the error handler
|
||||
#else
|
||||
#if defined(NDEBUG)
|
||||
#define ETL_ASSERT(b, e) // Does nothing.
|
||||
#define ETL_ALWAYS_ASSERT(e) // Does nothing.
|
||||
#else
|
||||
#if defined(ETL_DEBUG)
|
||||
#define ETL_ASSERT(b, e) assert((b)) // If the condition fails, asserts.
|
||||
#define ETL_ALWAYS_ASSERT(e) assert(false) // Asserts.
|
||||
#else
|
||||
#define ETL_ASSERT(b, e) // Does nothing.
|
||||
#define ETL_ALWAYS_ASSERT(e) // Does nothing.
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -191,7 +191,7 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
virtual fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message) = 0;
|
||||
virtual fsm_state_id_t process_event(const etl::imessage& message) = 0;
|
||||
|
||||
virtual fsm_state_id_t on_enter_state() { return state_id; } // By default, do nothing.
|
||||
virtual void on_exit_state() {} // By default, do nothing.
|
||||
@ -283,9 +283,9 @@ namespace etl
|
||||
//*******************************************
|
||||
/// Top level message handler for the FSM.
|
||||
//*******************************************
|
||||
void receive(etl::imessage_router& source, const etl::imessage& message) ETL_OVERRIDE
|
||||
void receive(const etl::imessage& message) ETL_OVERRIDE
|
||||
{
|
||||
etl::fsm_state_id_t next_state_id = p_state->process_event(source, message);
|
||||
etl::fsm_state_id_t next_state_id = p_state->process_event(message);
|
||||
ETL_ASSERT(next_state_id < number_of_states, ETL_ERROR(etl::fsm_state_id_exception));
|
||||
|
||||
etl::ifsm_state* p_next_state = state_list[next_state_id];
|
||||
@ -427,30 +427,30 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
etl::fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message)
|
||||
etl::fsm_state_id_t process_event(const etl::imessage& message)
|
||||
{
|
||||
etl::fsm_state_id_t new_state_id;
|
||||
etl::message_id_t event_id = message.get_message_id();
|
||||
|
||||
switch (event_id)
|
||||
{
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T6&>(message)); break;
|
||||
case T7::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T7&>(message)); break;
|
||||
case T8::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T8&>(message)); break;
|
||||
case T9::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T9&>(message)); break;
|
||||
case T10::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T10&>(message)); break;
|
||||
case T11::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T11&>(message)); break;
|
||||
case T12::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T12&>(message)); break;
|
||||
case T13::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T13&>(message)); break;
|
||||
case T14::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T14&>(message)); break;
|
||||
case T15::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T15&>(message)); break;
|
||||
case T16::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T16&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(source, message); break;
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T6&>(message)); break;
|
||||
case T7::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T7&>(message)); break;
|
||||
case T8::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T8&>(message)); break;
|
||||
case T9::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T9&>(message)); break;
|
||||
case T10::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T10&>(message)); break;
|
||||
case T11::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T11&>(message)); break;
|
||||
case T12::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T12&>(message)); break;
|
||||
case T13::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T13&>(message)); break;
|
||||
case T14::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T14&>(message)); break;
|
||||
case T15::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T15&>(message)); break;
|
||||
case T16::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T16&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(message); break;
|
||||
}
|
||||
|
||||
return new_state_id;
|
||||
@ -492,29 +492,29 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
etl::fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message)
|
||||
etl::fsm_state_id_t process_event(const etl::imessage& message)
|
||||
{
|
||||
etl::fsm_state_id_t new_state_id;
|
||||
etl::message_id_t event_id = message.get_message_id();
|
||||
|
||||
switch (event_id)
|
||||
{
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T6&>(message)); break;
|
||||
case T7::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T7&>(message)); break;
|
||||
case T8::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T8&>(message)); break;
|
||||
case T9::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T9&>(message)); break;
|
||||
case T10::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T10&>(message)); break;
|
||||
case T11::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T11&>(message)); break;
|
||||
case T12::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T12&>(message)); break;
|
||||
case T13::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T13&>(message)); break;
|
||||
case T14::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T14&>(message)); break;
|
||||
case T15::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T15&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(source, message); break;
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T6&>(message)); break;
|
||||
case T7::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T7&>(message)); break;
|
||||
case T8::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T8&>(message)); break;
|
||||
case T9::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T9&>(message)); break;
|
||||
case T10::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T10&>(message)); break;
|
||||
case T11::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T11&>(message)); break;
|
||||
case T12::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T12&>(message)); break;
|
||||
case T13::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T13&>(message)); break;
|
||||
case T14::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T14&>(message)); break;
|
||||
case T15::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T15&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(message); break;
|
||||
}
|
||||
|
||||
return new_state_id;
|
||||
@ -556,28 +556,28 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
etl::fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message)
|
||||
etl::fsm_state_id_t process_event(const etl::imessage& message)
|
||||
{
|
||||
etl::fsm_state_id_t new_state_id;
|
||||
etl::message_id_t event_id = message.get_message_id();
|
||||
|
||||
switch (event_id)
|
||||
{
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T6&>(message)); break;
|
||||
case T7::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T7&>(message)); break;
|
||||
case T8::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T8&>(message)); break;
|
||||
case T9::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T9&>(message)); break;
|
||||
case T10::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T10&>(message)); break;
|
||||
case T11::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T11&>(message)); break;
|
||||
case T12::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T12&>(message)); break;
|
||||
case T13::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T13&>(message)); break;
|
||||
case T14::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T14&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(source, message); break;
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T6&>(message)); break;
|
||||
case T7::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T7&>(message)); break;
|
||||
case T8::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T8&>(message)); break;
|
||||
case T9::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T9&>(message)); break;
|
||||
case T10::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T10&>(message)); break;
|
||||
case T11::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T11&>(message)); break;
|
||||
case T12::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T12&>(message)); break;
|
||||
case T13::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T13&>(message)); break;
|
||||
case T14::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T14&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(message); break;
|
||||
}
|
||||
|
||||
return new_state_id;
|
||||
@ -619,27 +619,27 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
etl::fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message)
|
||||
etl::fsm_state_id_t process_event(const etl::imessage& message)
|
||||
{
|
||||
etl::fsm_state_id_t new_state_id;
|
||||
etl::message_id_t event_id = message.get_message_id();
|
||||
|
||||
switch (event_id)
|
||||
{
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T6&>(message)); break;
|
||||
case T7::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T7&>(message)); break;
|
||||
case T8::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T8&>(message)); break;
|
||||
case T9::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T9&>(message)); break;
|
||||
case T10::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T10&>(message)); break;
|
||||
case T11::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T11&>(message)); break;
|
||||
case T12::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T12&>(message)); break;
|
||||
case T13::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T13&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(source, message); break;
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T6&>(message)); break;
|
||||
case T7::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T7&>(message)); break;
|
||||
case T8::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T8&>(message)); break;
|
||||
case T9::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T9&>(message)); break;
|
||||
case T10::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T10&>(message)); break;
|
||||
case T11::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T11&>(message)); break;
|
||||
case T12::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T12&>(message)); break;
|
||||
case T13::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T13&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(message); break;
|
||||
}
|
||||
|
||||
return new_state_id;
|
||||
@ -680,26 +680,26 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
etl::fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message)
|
||||
etl::fsm_state_id_t process_event(const etl::imessage& message)
|
||||
{
|
||||
etl::fsm_state_id_t new_state_id;
|
||||
etl::message_id_t event_id = message.get_message_id();
|
||||
|
||||
switch (event_id)
|
||||
{
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T6&>(message)); break;
|
||||
case T7::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T7&>(message)); break;
|
||||
case T8::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T8&>(message)); break;
|
||||
case T9::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T9&>(message)); break;
|
||||
case T10::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T10&>(message)); break;
|
||||
case T11::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T11&>(message)); break;
|
||||
case T12::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T12&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(source, message); break;
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T6&>(message)); break;
|
||||
case T7::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T7&>(message)); break;
|
||||
case T8::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T8&>(message)); break;
|
||||
case T9::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T9&>(message)); break;
|
||||
case T10::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T10&>(message)); break;
|
||||
case T11::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T11&>(message)); break;
|
||||
case T12::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T12&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(message); break;
|
||||
}
|
||||
|
||||
return new_state_id;
|
||||
@ -740,25 +740,25 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
etl::fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message)
|
||||
etl::fsm_state_id_t process_event(const etl::imessage& message)
|
||||
{
|
||||
etl::fsm_state_id_t new_state_id;
|
||||
etl::message_id_t event_id = message.get_message_id();
|
||||
|
||||
switch (event_id)
|
||||
{
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T6&>(message)); break;
|
||||
case T7::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T7&>(message)); break;
|
||||
case T8::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T8&>(message)); break;
|
||||
case T9::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T9&>(message)); break;
|
||||
case T10::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T10&>(message)); break;
|
||||
case T11::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T11&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(source, message); break;
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T6&>(message)); break;
|
||||
case T7::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T7&>(message)); break;
|
||||
case T8::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T8&>(message)); break;
|
||||
case T9::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T9&>(message)); break;
|
||||
case T10::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T10&>(message)); break;
|
||||
case T11::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T11&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(message); break;
|
||||
}
|
||||
|
||||
return new_state_id;
|
||||
@ -799,24 +799,24 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
etl::fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message)
|
||||
etl::fsm_state_id_t process_event(const etl::imessage& message)
|
||||
{
|
||||
etl::fsm_state_id_t new_state_id;
|
||||
etl::message_id_t event_id = message.get_message_id();
|
||||
|
||||
switch (event_id)
|
||||
{
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T6&>(message)); break;
|
||||
case T7::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T7&>(message)); break;
|
||||
case T8::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T8&>(message)); break;
|
||||
case T9::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T9&>(message)); break;
|
||||
case T10::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T10&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(source, message); break;
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T6&>(message)); break;
|
||||
case T7::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T7&>(message)); break;
|
||||
case T8::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T8&>(message)); break;
|
||||
case T9::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T9&>(message)); break;
|
||||
case T10::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T10&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(message); break;
|
||||
}
|
||||
|
||||
return new_state_id;
|
||||
@ -857,23 +857,23 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
etl::fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message)
|
||||
etl::fsm_state_id_t process_event(const etl::imessage& message)
|
||||
{
|
||||
etl::fsm_state_id_t new_state_id;
|
||||
etl::message_id_t event_id = message.get_message_id();
|
||||
|
||||
switch (event_id)
|
||||
{
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T6&>(message)); break;
|
||||
case T7::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T7&>(message)); break;
|
||||
case T8::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T8&>(message)); break;
|
||||
case T9::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T9&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(source, message); break;
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T6&>(message)); break;
|
||||
case T7::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T7&>(message)); break;
|
||||
case T8::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T8&>(message)); break;
|
||||
case T9::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T9&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(message); break;
|
||||
}
|
||||
|
||||
return new_state_id;
|
||||
@ -913,22 +913,22 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
etl::fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message)
|
||||
etl::fsm_state_id_t process_event(const etl::imessage& message)
|
||||
{
|
||||
etl::fsm_state_id_t new_state_id;
|
||||
etl::message_id_t event_id = message.get_message_id();
|
||||
|
||||
switch (event_id)
|
||||
{
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T6&>(message)); break;
|
||||
case T7::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T7&>(message)); break;
|
||||
case T8::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T8&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(source, message); break;
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T6&>(message)); break;
|
||||
case T7::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T7&>(message)); break;
|
||||
case T8::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T8&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(message); break;
|
||||
}
|
||||
|
||||
return new_state_id;
|
||||
@ -968,21 +968,21 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
etl::fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message)
|
||||
etl::fsm_state_id_t process_event(const etl::imessage& message)
|
||||
{
|
||||
etl::fsm_state_id_t new_state_id;
|
||||
etl::message_id_t event_id = message.get_message_id();
|
||||
|
||||
switch (event_id)
|
||||
{
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T6&>(message)); break;
|
||||
case T7::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T7&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(source, message); break;
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T6&>(message)); break;
|
||||
case T7::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T7&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(message); break;
|
||||
}
|
||||
|
||||
return new_state_id;
|
||||
@ -1022,20 +1022,20 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
etl::fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message)
|
||||
etl::fsm_state_id_t process_event(const etl::imessage& message)
|
||||
{
|
||||
etl::fsm_state_id_t new_state_id;
|
||||
etl::message_id_t event_id = message.get_message_id();
|
||||
|
||||
switch (event_id)
|
||||
{
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T6&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(source, message); break;
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T5&>(message)); break;
|
||||
case T6::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T6&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(message); break;
|
||||
}
|
||||
|
||||
return new_state_id;
|
||||
@ -1075,19 +1075,19 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
etl::fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message)
|
||||
etl::fsm_state_id_t process_event(const etl::imessage& message)
|
||||
{
|
||||
etl::fsm_state_id_t new_state_id;
|
||||
etl::message_id_t event_id = message.get_message_id();
|
||||
|
||||
switch (event_id)
|
||||
{
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T5&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(source, message); break;
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T4&>(message)); break;
|
||||
case T5::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T5&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(message); break;
|
||||
}
|
||||
|
||||
return new_state_id;
|
||||
@ -1126,18 +1126,18 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
etl::fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message)
|
||||
etl::fsm_state_id_t process_event(const etl::imessage& message)
|
||||
{
|
||||
etl::fsm_state_id_t new_state_id;
|
||||
etl::message_id_t event_id = message.get_message_id();
|
||||
|
||||
switch (event_id)
|
||||
{
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T4&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(source, message); break;
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T3&>(message)); break;
|
||||
case T4::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T4&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(message); break;
|
||||
}
|
||||
|
||||
return new_state_id;
|
||||
@ -1176,17 +1176,17 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
etl::fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message)
|
||||
etl::fsm_state_id_t process_event(const etl::imessage& message)
|
||||
{
|
||||
etl::fsm_state_id_t new_state_id;
|
||||
etl::message_id_t event_id = message.get_message_id();
|
||||
|
||||
switch (event_id)
|
||||
{
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T3&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(source, message); break;
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T2&>(message)); break;
|
||||
case T3::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T3&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(message); break;
|
||||
}
|
||||
|
||||
return new_state_id;
|
||||
@ -1225,16 +1225,16 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
etl::fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message)
|
||||
etl::fsm_state_id_t process_event(const etl::imessage& message)
|
||||
{
|
||||
etl::fsm_state_id_t new_state_id;
|
||||
etl::message_id_t event_id = message.get_message_id();
|
||||
|
||||
switch (event_id)
|
||||
{
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T2&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(source, message); break;
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T1&>(message)); break;
|
||||
case T2::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T2&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(message); break;
|
||||
}
|
||||
|
||||
return new_state_id;
|
||||
@ -1273,15 +1273,15 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
etl::fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message)
|
||||
etl::fsm_state_id_t process_event(const etl::imessage& message)
|
||||
{
|
||||
etl::fsm_state_id_t new_state_id;
|
||||
etl::message_id_t event_id = message.get_message_id();
|
||||
|
||||
switch (event_id)
|
||||
{
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T1&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(source, message); break;
|
||||
case T1::ID: new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T1&>(message)); break;
|
||||
default: new_state_id = static_cast<TDerived*>(this)->on_event_unknown(message); break;
|
||||
}
|
||||
|
||||
return new_state_id;
|
||||
@ -1318,9 +1318,9 @@ namespace etl
|
||||
}
|
||||
private:
|
||||
|
||||
etl::fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message)
|
||||
etl::fsm_state_id_t process_event(const etl::imessage& message)
|
||||
{
|
||||
return static_cast<TDerived*>(this)->on_event_unknown(source, message);
|
||||
return static_cast<TDerived*>(this)->on_event_unknown(message);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -203,7 +203,7 @@ namespace etl
|
||||
|
||||
private:
|
||||
|
||||
virtual fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message) = 0;
|
||||
virtual fsm_state_id_t process_event(const etl::imessage& message) = 0;
|
||||
|
||||
virtual fsm_state_id_t on_enter_state() { return state_id; } // By default, do nothing.
|
||||
virtual void on_exit_state() {} // By default, do nothing.
|
||||
@ -295,9 +295,9 @@ namespace etl
|
||||
//*******************************************
|
||||
/// Top level message handler for the FSM.
|
||||
//*******************************************
|
||||
void receive(etl::imessage_router& source, const etl::imessage& message) ETL_OVERRIDE
|
||||
void receive(const etl::imessage& message) ETL_OVERRIDE
|
||||
{
|
||||
etl::fsm_state_id_t next_state_id = p_state->process_event(source, message);
|
||||
etl::fsm_state_id_t next_state_id = p_state->process_event(message);
|
||||
ETL_ASSERT(next_state_id < number_of_states, ETL_ERROR(etl::fsm_state_id_exception));
|
||||
|
||||
etl::ifsm_state* p_next_state = state_list[next_state_id];
|
||||
@ -447,7 +447,7 @@ namespace etl
|
||||
cog.outl("")
|
||||
cog.outl("private:")
|
||||
cog.outl("")
|
||||
cog.outl(" etl::fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message)")
|
||||
cog.outl(" etl::fsm_state_id_t process_event(const etl::imessage& message)")
|
||||
cog.outl(" {")
|
||||
cog.outl(" etl::fsm_state_id_t new_state_id;")
|
||||
cog.outl(" etl::message_id_t event_id = message.get_message_id();")
|
||||
@ -456,10 +456,10 @@ namespace etl
|
||||
cog.outl(" {")
|
||||
for n in range(1, int(Handlers) + 1):
|
||||
cog.out(" case T%d::ID:" % n)
|
||||
cog.out(" new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T%d&>(message));" % n)
|
||||
cog.out(" new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T%d&>(message));" % n)
|
||||
cog.outl(" break;")
|
||||
cog.out(" default:")
|
||||
cog.out(" new_state_id = static_cast<TDerived*>(this)->on_event_unknown(source, message);")
|
||||
cog.out(" new_state_id = static_cast<TDerived*>(this)->on_event_unknown(message);")
|
||||
cog.outl(" break;")
|
||||
cog.outl(" }")
|
||||
cog.outl("")
|
||||
@ -524,7 +524,7 @@ namespace etl
|
||||
cog.outl("")
|
||||
cog.outl("private:")
|
||||
cog.outl("")
|
||||
cog.outl(" etl::fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message)")
|
||||
cog.outl(" etl::fsm_state_id_t process_event(const etl::imessage& message)")
|
||||
cog.outl(" {")
|
||||
cog.outl(" etl::fsm_state_id_t new_state_id;")
|
||||
cog.outl(" etl::message_id_t event_id = message.get_message_id();")
|
||||
@ -533,10 +533,10 @@ namespace etl
|
||||
cog.outl(" {")
|
||||
for n in range(1, n + 1):
|
||||
cog.out(" case T%d::ID:" % n)
|
||||
cog.out(" new_state_id = static_cast<TDerived*>(this)->on_event(source, static_cast<const T%d&>(message));" % n)
|
||||
cog.out(" new_state_id = static_cast<TDerived*>(this)->on_event(static_cast<const T%d&>(message));" % n)
|
||||
cog.outl(" break;")
|
||||
cog.out(" default:")
|
||||
cog.out(" new_state_id = static_cast<TDerived*>(this)->on_event_unknown(source, message);")
|
||||
cog.out(" new_state_id = static_cast<TDerived*>(this)->on_event_unknown(message);")
|
||||
cog.outl(" break;")
|
||||
cog.outl(" }")
|
||||
cog.outl("")
|
||||
@ -583,9 +583,9 @@ namespace etl
|
||||
cog.outl(" }")
|
||||
cog.outl("private:")
|
||||
cog.outl("")
|
||||
cog.outl(" etl::fsm_state_id_t process_event(etl::imessage_router& source, const etl::imessage& message)")
|
||||
cog.outl(" etl::fsm_state_id_t process_event(const etl::imessage& message)")
|
||||
cog.outl(" {")
|
||||
cog.outl(" return static_cast<TDerived*>(this)->on_event_unknown(source, message);")
|
||||
cog.outl(" return static_cast<TDerived*>(this)->on_event_unknown(message);")
|
||||
cog.outl(" }")
|
||||
cog.outl("};")
|
||||
]]]*/
|
||||
|
||||
@ -124,60 +124,36 @@ namespace etl
|
||||
public:
|
||||
|
||||
virtual ~imessage_router() {}
|
||||
virtual void receive(etl::imessage_router& source, const etl::imessage& message) = 0;
|
||||
virtual void receive(const etl::imessage& message) = 0;
|
||||
virtual bool accepts(etl::message_id_t id) const = 0;
|
||||
virtual bool is_null_router() const = 0;
|
||||
virtual bool is_producer() const = 0;
|
||||
virtual bool is_consumer() const = 0;
|
||||
|
||||
//********************************************
|
||||
virtual void receive(etl::imessage_router& source, etl::message_router_id_t destination_router_id, const etl::imessage& message)
|
||||
virtual void receive(etl::message_router_id_t destination_router_id, const etl::imessage& message)
|
||||
{
|
||||
if ((destination_router_id == get_message_router_id()) || (destination_router_id == imessage_router::ALL_MESSAGE_ROUTERS))
|
||||
{
|
||||
receive(source, message);
|
||||
receive(message);
|
||||
}
|
||||
}
|
||||
|
||||
//********************************************
|
||||
void receive(etl::message_router_id_t destination_router_id, const etl::imessage& message)
|
||||
virtual void receive(etl::shared_message shared_msg)
|
||||
{
|
||||
receive(etl::get_null_message_router(), destination_router_id, message);
|
||||
receive(shared_msg.get_message());
|
||||
}
|
||||
|
||||
//********************************************
|
||||
void receive(const etl::imessage& message)
|
||||
{
|
||||
receive(etl::get_null_message_router(), message);
|
||||
}
|
||||
|
||||
//********************************************
|
||||
virtual void receive(etl::imessage_router& source, etl::shared_message shared_msg)
|
||||
{
|
||||
receive(source, shared_msg.get_message());
|
||||
}
|
||||
|
||||
//********************************************
|
||||
virtual void receive(etl::imessage_router& source, etl::message_router_id_t destination_router_id, etl::shared_message shared_msg)
|
||||
virtual void receive(etl::message_router_id_t destination_router_id, etl::shared_message shared_msg)
|
||||
{
|
||||
if ((destination_router_id == get_message_router_id()) || (destination_router_id == imessage_router::ALL_MESSAGE_ROUTERS))
|
||||
{
|
||||
receive(source, shared_msg);
|
||||
receive(shared_msg);
|
||||
}
|
||||
}
|
||||
|
||||
//********************************************
|
||||
void receive(etl::message_router_id_t destination_router_id, etl::shared_message shared_msg)
|
||||
{
|
||||
receive(etl::get_null_message_router(), destination_router_id, shared_msg);
|
||||
}
|
||||
|
||||
//********************************************
|
||||
void receive(etl::shared_message shared_msg)
|
||||
{
|
||||
receive(etl::get_null_message_router(), shared_msg);
|
||||
}
|
||||
|
||||
//********************************************
|
||||
bool accepts(const etl::imessage& msg) const
|
||||
{
|
||||
@ -234,7 +210,7 @@ namespace etl
|
||||
//********************************************
|
||||
using etl::imessage_router::receive;
|
||||
|
||||
void receive(etl::imessage_router&, const etl::imessage&) ETL_OVERRIDE
|
||||
void receive(const etl::imessage&) ETL_OVERRIDE
|
||||
{
|
||||
}
|
||||
|
||||
@ -294,7 +270,7 @@ namespace etl
|
||||
//********************************************
|
||||
using etl::imessage_router::receive;
|
||||
|
||||
void receive(etl::imessage_router&, const etl::imessage&) ETL_OVERRIDE
|
||||
void receive(const etl::imessage&) ETL_OVERRIDE
|
||||
{
|
||||
}
|
||||
|
||||
@ -324,9 +300,9 @@ namespace etl
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
/// Send a message to a router.
|
||||
/// Sets the 'sender' to etl::null_message_router type.
|
||||
//***************************************************************************
|
||||
inline static void send_message(etl::imessage_router& destination,
|
||||
const etl::imessage& message)
|
||||
@ -334,16 +310,6 @@ namespace etl
|
||||
destination.receive(message);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
/// Send a message to a router.
|
||||
//***************************************************************************
|
||||
inline static void send_message(etl::imessage_router& source,
|
||||
etl::imessage_router& destination,
|
||||
const etl::imessage& message)
|
||||
{
|
||||
destination.receive(source, message);
|
||||
}
|
||||
|
||||
/*[[[cog
|
||||
import cog
|
||||
################################################
|
||||
@ -388,7 +354,7 @@ namespace etl
|
||||
cog.outl(" //**********************************************")
|
||||
cog.outl(" using etl::imessage_router::receive;")
|
||||
cog.outl("")
|
||||
cog.outl(" void receive(etl::imessage_router& source, const etl::imessage& msg) ETL_OVERRIDE")
|
||||
cog.outl(" void receive(const etl::imessage& msg) ETL_OVERRIDE")
|
||||
cog.outl(" {")
|
||||
cog.outl(" const etl::message_id_t id = msg.get_message_id();")
|
||||
cog.outl("")
|
||||
@ -396,17 +362,17 @@ namespace etl
|
||||
cog.outl(" {")
|
||||
for n in range(1, int(Handlers) + 1):
|
||||
cog.out(" case T%d::ID:" % n)
|
||||
cog.out(" static_cast<TDerived*>(this)->on_receive(source, static_cast<const T%d&>(msg));" % n)
|
||||
cog.out(" static_cast<TDerived*>(this)->on_receive(static_cast<const T%d&>(msg));" % n)
|
||||
cog.outl(" break;")
|
||||
cog.outl(" default:")
|
||||
cog.outl(" {")
|
||||
cog.outl(" if (has_successor())")
|
||||
cog.outl(" {")
|
||||
cog.outl(" get_successor().receive(source, msg);")
|
||||
cog.outl(" get_successor().receive(msg);")
|
||||
cog.outl(" }")
|
||||
cog.outl(" else")
|
||||
cog.outl(" {")
|
||||
cog.outl(" static_cast<TDerived*>(this)->on_receive_unknown(source, msg);")
|
||||
cog.outl(" static_cast<TDerived*>(this)->on_receive_unknown(msg);")
|
||||
cog.outl(" }")
|
||||
cog.outl(" break;")
|
||||
cog.outl(" }")
|
||||
@ -508,7 +474,7 @@ namespace etl
|
||||
cog.outl(" //**********************************************")
|
||||
cog.outl(" using etl::imessage_router::receive;")
|
||||
cog.outl("")
|
||||
cog.outl(" void receive(etl::imessage_router& source, const etl::imessage& msg) ETL_OVERRIDE")
|
||||
cog.outl(" void receive(const etl::imessage& msg) ETL_OVERRIDE")
|
||||
cog.outl(" {")
|
||||
cog.outl(" const size_t id = msg.get_message_id();")
|
||||
cog.outl("")
|
||||
@ -516,17 +482,17 @@ namespace etl
|
||||
cog.outl(" {")
|
||||
for t in range(1, n + 1):
|
||||
cog.out(" case T%d::ID:" % t)
|
||||
cog.out(" static_cast<TDerived*>(this)->on_receive(source, static_cast<const T%d&>(msg));" % t)
|
||||
cog.out(" static_cast<TDerived*>(this)->on_receive(static_cast<const T%d&>(msg));" % t)
|
||||
cog.outl(" break;")
|
||||
cog.outl(" default:")
|
||||
cog.outl(" {")
|
||||
cog.outl(" if (has_successor())")
|
||||
cog.outl(" {")
|
||||
cog.outl(" get_successor().receive(source, msg);")
|
||||
cog.outl(" get_successor().receive(msg);")
|
||||
cog.outl(" }")
|
||||
cog.outl(" else")
|
||||
cog.outl(" {")
|
||||
cog.outl(" static_cast<TDerived*>(this)->on_receive_unknown(source, msg);")
|
||||
cog.outl(" static_cast<TDerived*>(this)->on_receive_unknown(msg);")
|
||||
cog.outl(" }")
|
||||
cog.outl(" break;")
|
||||
cog.outl(" }")
|
||||
|
||||
@ -148,22 +148,19 @@ namespace etl
|
||||
}
|
||||
|
||||
//*******************************************
|
||||
virtual void receive(etl::imessage_router& source,
|
||||
const etl::imessage& message) ETL_OVERRIDE
|
||||
virtual void receive(const etl::imessage& message) ETL_OVERRIDE
|
||||
{
|
||||
receive(source, etl::imessage_router::ALL_MESSAGE_ROUTERS, message);
|
||||
receive(etl::imessage_router::ALL_MESSAGE_ROUTERS, message);
|
||||
}
|
||||
|
||||
//*******************************************
|
||||
virtual void receive(etl::imessage_router& source,
|
||||
etl::shared_message shared_msg) ETL_OVERRIDE
|
||||
virtual void receive(etl::shared_message shared_msg) ETL_OVERRIDE
|
||||
{
|
||||
receive(source, etl::imessage_router::ALL_MESSAGE_ROUTERS, shared_msg);
|
||||
receive(etl::imessage_router::ALL_MESSAGE_ROUTERS, shared_msg);
|
||||
}
|
||||
|
||||
//********************************************
|
||||
virtual void receive(etl::imessage_router& source,
|
||||
etl::message_router_id_t destination_router_id,
|
||||
virtual void receive(etl::message_router_id_t destination_router_id,
|
||||
etl::shared_message shared_msg) ETL_OVERRIDE
|
||||
{
|
||||
switch (destination_router_id)
|
||||
@ -181,7 +178,7 @@ namespace etl
|
||||
|
||||
if (router.accepts(shared_msg.get_message().get_message_id()))
|
||||
{
|
||||
router.receive(source, shared_msg);
|
||||
router.receive(shared_msg);
|
||||
}
|
||||
|
||||
++irouter;
|
||||
@ -207,7 +204,7 @@ namespace etl
|
||||
{
|
||||
if ((*(range.first))->accepts(shared_msg.get_message().get_message_id()))
|
||||
{
|
||||
(*(range.first))->receive(source, shared_msg);
|
||||
(*(range.first))->receive(shared_msg);
|
||||
}
|
||||
|
||||
++range.first;
|
||||
@ -223,7 +220,7 @@ namespace etl
|
||||
while (irouter != router_list.end())
|
||||
{
|
||||
// So pass it on.
|
||||
(*irouter)->receive(source, destination_router_id, shared_msg);
|
||||
(*irouter)->receive(destination_router_id, shared_msg);
|
||||
|
||||
++irouter;
|
||||
}
|
||||
@ -234,8 +231,7 @@ namespace etl
|
||||
}
|
||||
|
||||
//*******************************************
|
||||
virtual void receive(etl::imessage_router& source,
|
||||
etl::message_router_id_t destination_router_id,
|
||||
virtual void receive(etl::message_router_id_t destination_router_id,
|
||||
const etl::imessage& message) ETL_OVERRIDE
|
||||
{
|
||||
switch (destination_router_id)
|
||||
@ -253,7 +249,7 @@ namespace etl
|
||||
|
||||
if (router.accepts(message.get_message_id()))
|
||||
{
|
||||
router.receive(source, message);
|
||||
router.receive(message);
|
||||
}
|
||||
|
||||
++irouter;
|
||||
@ -279,7 +275,7 @@ namespace etl
|
||||
{
|
||||
if ((*(range.first))->accepts(message.get_message_id()))
|
||||
{
|
||||
(*(range.first))->receive(source, message);
|
||||
(*(range.first))->receive(message);
|
||||
}
|
||||
|
||||
++range.first;
|
||||
@ -288,14 +284,14 @@ namespace etl
|
||||
// Do any message buses.
|
||||
// These are always at the end of the list.
|
||||
irouter = etl::lower_bound(router_list.begin(),
|
||||
router_list.end(),
|
||||
etl::imessage_bus::MESSAGE_BUS,
|
||||
compare_router_id());
|
||||
router_list.end(),
|
||||
etl::imessage_bus::MESSAGE_BUS,
|
||||
compare_router_id());
|
||||
|
||||
while (irouter != router_list.end())
|
||||
{
|
||||
// So pass it on.
|
||||
(*irouter)->receive(source, destination_router_id, message);
|
||||
(*irouter)->receive(destination_router_id, message);
|
||||
|
||||
++irouter;
|
||||
}
|
||||
@ -425,7 +421,7 @@ namespace etl
|
||||
etl::imessage_bus& bus,
|
||||
const etl::imessage& message)
|
||||
{
|
||||
bus.receive(source, message);
|
||||
bus.receive(message);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
@ -436,7 +432,7 @@ namespace etl
|
||||
etl::message_router_id_t id,
|
||||
const etl::imessage& message)
|
||||
{
|
||||
bus.receive(source, id, message);
|
||||
bus.receive(id, message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -112,60 +112,36 @@ namespace etl
|
||||
public:
|
||||
|
||||
virtual ~imessage_router() {}
|
||||
virtual void receive(etl::imessage_router& source, const etl::imessage& message) = 0;
|
||||
virtual void receive(const etl::imessage& message) = 0;
|
||||
virtual bool accepts(etl::message_id_t id) const = 0;
|
||||
virtual bool is_null_router() const = 0;
|
||||
virtual bool is_producer() const = 0;
|
||||
virtual bool is_consumer() const = 0;
|
||||
|
||||
//********************************************
|
||||
virtual void receive(etl::imessage_router& source, etl::message_router_id_t destination_router_id, const etl::imessage& message)
|
||||
virtual void receive(etl::message_router_id_t destination_router_id, const etl::imessage& message)
|
||||
{
|
||||
if ((destination_router_id == get_message_router_id()) || (destination_router_id == imessage_router::ALL_MESSAGE_ROUTERS))
|
||||
{
|
||||
receive(source, message);
|
||||
receive(message);
|
||||
}
|
||||
}
|
||||
|
||||
//********************************************
|
||||
void receive(etl::message_router_id_t destination_router_id, const etl::imessage& message)
|
||||
virtual void receive(etl::shared_message shared_msg)
|
||||
{
|
||||
receive(etl::get_null_message_router(), destination_router_id, message);
|
||||
receive(shared_msg.get_message());
|
||||
}
|
||||
|
||||
//********************************************
|
||||
void receive(const etl::imessage& message)
|
||||
{
|
||||
receive(etl::get_null_message_router(), message);
|
||||
}
|
||||
|
||||
//********************************************
|
||||
virtual void receive(etl::imessage_router& source, etl::shared_message shared_msg)
|
||||
{
|
||||
receive(source, shared_msg.get_message());
|
||||
}
|
||||
|
||||
//********************************************
|
||||
virtual void receive(etl::imessage_router& source, etl::message_router_id_t destination_router_id, etl::shared_message shared_msg)
|
||||
virtual void receive(etl::message_router_id_t destination_router_id, etl::shared_message shared_msg)
|
||||
{
|
||||
if ((destination_router_id == get_message_router_id()) || (destination_router_id == imessage_router::ALL_MESSAGE_ROUTERS))
|
||||
{
|
||||
receive(source, shared_msg);
|
||||
receive(shared_msg);
|
||||
}
|
||||
}
|
||||
|
||||
//********************************************
|
||||
void receive(etl::message_router_id_t destination_router_id, etl::shared_message shared_msg)
|
||||
{
|
||||
receive(etl::get_null_message_router(), destination_router_id, shared_msg);
|
||||
}
|
||||
|
||||
//********************************************
|
||||
void receive(etl::shared_message shared_msg)
|
||||
{
|
||||
receive(etl::get_null_message_router(), shared_msg);
|
||||
}
|
||||
|
||||
//********************************************
|
||||
bool accepts(const etl::imessage& msg) const
|
||||
{
|
||||
@ -222,7 +198,7 @@ namespace etl
|
||||
//********************************************
|
||||
using etl::imessage_router::receive;
|
||||
|
||||
void receive(etl::imessage_router&, const etl::imessage&) ETL_OVERRIDE
|
||||
void receive(const etl::imessage&) ETL_OVERRIDE
|
||||
{
|
||||
}
|
||||
|
||||
@ -282,7 +258,7 @@ namespace etl
|
||||
//********************************************
|
||||
using etl::imessage_router::receive;
|
||||
|
||||
void receive(etl::imessage_router&, const etl::imessage&) ETL_OVERRIDE
|
||||
void receive(const etl::imessage&) ETL_OVERRIDE
|
||||
{
|
||||
}
|
||||
|
||||
@ -312,9 +288,9 @@ namespace etl
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
/// Send a message to a router.
|
||||
/// Sets the 'sender' to etl::null_message_router type.
|
||||
//***************************************************************************
|
||||
inline static void send_message(etl::imessage_router& destination,
|
||||
const etl::imessage& message)
|
||||
@ -322,16 +298,6 @@ namespace etl
|
||||
destination.receive(message);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
/// Send a message to a router.
|
||||
//***************************************************************************
|
||||
inline static void send_message(etl::imessage_router& source,
|
||||
etl::imessage_router& destination,
|
||||
const etl::imessage& message)
|
||||
{
|
||||
destination.receive(source, message);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
// The definition for all 16 message types.
|
||||
//***************************************************************************
|
||||
@ -363,37 +329,37 @@ namespace etl
|
||||
//**********************************************
|
||||
using etl::imessage_router::receive;
|
||||
|
||||
void receive(etl::imessage_router& source, const etl::imessage& msg) ETL_OVERRIDE
|
||||
void receive(const etl::imessage& msg) ETL_OVERRIDE
|
||||
{
|
||||
const etl::message_id_t id = msg.get_message_id();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T6&>(msg)); break;
|
||||
case T7::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T7&>(msg)); break;
|
||||
case T8::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T8&>(msg)); break;
|
||||
case T9::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T9&>(msg)); break;
|
||||
case T10::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T10&>(msg)); break;
|
||||
case T11::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T11&>(msg)); break;
|
||||
case T12::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T12&>(msg)); break;
|
||||
case T13::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T13&>(msg)); break;
|
||||
case T14::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T14&>(msg)); break;
|
||||
case T15::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T15&>(msg)); break;
|
||||
case T16::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T16&>(msg)); break;
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T6&>(msg)); break;
|
||||
case T7::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T7&>(msg)); break;
|
||||
case T8::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T8&>(msg)); break;
|
||||
case T9::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T9&>(msg)); break;
|
||||
case T10::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T10&>(msg)); break;
|
||||
case T11::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T11&>(msg)); break;
|
||||
case T12::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T12&>(msg)); break;
|
||||
case T13::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T13&>(msg)); break;
|
||||
case T14::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T14&>(msg)); break;
|
||||
case T15::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T15&>(msg)); break;
|
||||
case T16::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T16&>(msg)); break;
|
||||
default:
|
||||
{
|
||||
if (has_successor())
|
||||
{
|
||||
get_successor().receive(source, msg);
|
||||
get_successor().receive(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(source, msg);
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(msg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -466,36 +432,36 @@ namespace etl
|
||||
//**********************************************
|
||||
using etl::imessage_router::receive;
|
||||
|
||||
void receive(etl::imessage_router& source, const etl::imessage& msg) ETL_OVERRIDE
|
||||
void receive(const etl::imessage& msg) ETL_OVERRIDE
|
||||
{
|
||||
const size_t id = msg.get_message_id();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T6&>(msg)); break;
|
||||
case T7::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T7&>(msg)); break;
|
||||
case T8::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T8&>(msg)); break;
|
||||
case T9::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T9&>(msg)); break;
|
||||
case T10::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T10&>(msg)); break;
|
||||
case T11::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T11&>(msg)); break;
|
||||
case T12::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T12&>(msg)); break;
|
||||
case T13::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T13&>(msg)); break;
|
||||
case T14::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T14&>(msg)); break;
|
||||
case T15::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T15&>(msg)); break;
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T6&>(msg)); break;
|
||||
case T7::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T7&>(msg)); break;
|
||||
case T8::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T8&>(msg)); break;
|
||||
case T9::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T9&>(msg)); break;
|
||||
case T10::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T10&>(msg)); break;
|
||||
case T11::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T11&>(msg)); break;
|
||||
case T12::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T12&>(msg)); break;
|
||||
case T13::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T13&>(msg)); break;
|
||||
case T14::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T14&>(msg)); break;
|
||||
case T15::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T15&>(msg)); break;
|
||||
default:
|
||||
{
|
||||
if (has_successor())
|
||||
{
|
||||
get_successor().receive(source, msg);
|
||||
get_successor().receive(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(source, msg);
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(msg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -568,35 +534,35 @@ namespace etl
|
||||
//**********************************************
|
||||
using etl::imessage_router::receive;
|
||||
|
||||
void receive(etl::imessage_router& source, const etl::imessage& msg) ETL_OVERRIDE
|
||||
void receive(const etl::imessage& msg) ETL_OVERRIDE
|
||||
{
|
||||
const size_t id = msg.get_message_id();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T6&>(msg)); break;
|
||||
case T7::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T7&>(msg)); break;
|
||||
case T8::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T8&>(msg)); break;
|
||||
case T9::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T9&>(msg)); break;
|
||||
case T10::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T10&>(msg)); break;
|
||||
case T11::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T11&>(msg)); break;
|
||||
case T12::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T12&>(msg)); break;
|
||||
case T13::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T13&>(msg)); break;
|
||||
case T14::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T14&>(msg)); break;
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T6&>(msg)); break;
|
||||
case T7::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T7&>(msg)); break;
|
||||
case T8::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T8&>(msg)); break;
|
||||
case T9::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T9&>(msg)); break;
|
||||
case T10::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T10&>(msg)); break;
|
||||
case T11::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T11&>(msg)); break;
|
||||
case T12::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T12&>(msg)); break;
|
||||
case T13::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T13&>(msg)); break;
|
||||
case T14::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T14&>(msg)); break;
|
||||
default:
|
||||
{
|
||||
if (has_successor())
|
||||
{
|
||||
get_successor().receive(source, msg);
|
||||
get_successor().receive(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(source, msg);
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(msg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -669,34 +635,34 @@ namespace etl
|
||||
//**********************************************
|
||||
using etl::imessage_router::receive;
|
||||
|
||||
void receive(etl::imessage_router& source, const etl::imessage& msg) ETL_OVERRIDE
|
||||
void receive(const etl::imessage& msg) ETL_OVERRIDE
|
||||
{
|
||||
const size_t id = msg.get_message_id();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T6&>(msg)); break;
|
||||
case T7::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T7&>(msg)); break;
|
||||
case T8::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T8&>(msg)); break;
|
||||
case T9::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T9&>(msg)); break;
|
||||
case T10::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T10&>(msg)); break;
|
||||
case T11::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T11&>(msg)); break;
|
||||
case T12::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T12&>(msg)); break;
|
||||
case T13::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T13&>(msg)); break;
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T6&>(msg)); break;
|
||||
case T7::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T7&>(msg)); break;
|
||||
case T8::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T8&>(msg)); break;
|
||||
case T9::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T9&>(msg)); break;
|
||||
case T10::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T10&>(msg)); break;
|
||||
case T11::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T11&>(msg)); break;
|
||||
case T12::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T12&>(msg)); break;
|
||||
case T13::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T13&>(msg)); break;
|
||||
default:
|
||||
{
|
||||
if (has_successor())
|
||||
{
|
||||
get_successor().receive(source, msg);
|
||||
get_successor().receive(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(source, msg);
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(msg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -768,33 +734,33 @@ namespace etl
|
||||
//**********************************************
|
||||
using etl::imessage_router::receive;
|
||||
|
||||
void receive(etl::imessage_router& source, const etl::imessage& msg) ETL_OVERRIDE
|
||||
void receive(const etl::imessage& msg) ETL_OVERRIDE
|
||||
{
|
||||
const size_t id = msg.get_message_id();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T6&>(msg)); break;
|
||||
case T7::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T7&>(msg)); break;
|
||||
case T8::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T8&>(msg)); break;
|
||||
case T9::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T9&>(msg)); break;
|
||||
case T10::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T10&>(msg)); break;
|
||||
case T11::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T11&>(msg)); break;
|
||||
case T12::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T12&>(msg)); break;
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T6&>(msg)); break;
|
||||
case T7::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T7&>(msg)); break;
|
||||
case T8::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T8&>(msg)); break;
|
||||
case T9::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T9&>(msg)); break;
|
||||
case T10::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T10&>(msg)); break;
|
||||
case T11::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T11&>(msg)); break;
|
||||
case T12::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T12&>(msg)); break;
|
||||
default:
|
||||
{
|
||||
if (has_successor())
|
||||
{
|
||||
get_successor().receive(source, msg);
|
||||
get_successor().receive(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(source, msg);
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(msg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -866,32 +832,32 @@ namespace etl
|
||||
//**********************************************
|
||||
using etl::imessage_router::receive;
|
||||
|
||||
void receive(etl::imessage_router& source, const etl::imessage& msg) ETL_OVERRIDE
|
||||
void receive(const etl::imessage& msg) ETL_OVERRIDE
|
||||
{
|
||||
const size_t id = msg.get_message_id();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T6&>(msg)); break;
|
||||
case T7::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T7&>(msg)); break;
|
||||
case T8::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T8&>(msg)); break;
|
||||
case T9::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T9&>(msg)); break;
|
||||
case T10::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T10&>(msg)); break;
|
||||
case T11::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T11&>(msg)); break;
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T6&>(msg)); break;
|
||||
case T7::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T7&>(msg)); break;
|
||||
case T8::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T8&>(msg)); break;
|
||||
case T9::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T9&>(msg)); break;
|
||||
case T10::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T10&>(msg)); break;
|
||||
case T11::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T11&>(msg)); break;
|
||||
default:
|
||||
{
|
||||
if (has_successor())
|
||||
{
|
||||
get_successor().receive(source, msg);
|
||||
get_successor().receive(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(source, msg);
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(msg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -963,31 +929,31 @@ namespace etl
|
||||
//**********************************************
|
||||
using etl::imessage_router::receive;
|
||||
|
||||
void receive(etl::imessage_router& source, const etl::imessage& msg) ETL_OVERRIDE
|
||||
void receive(const etl::imessage& msg) ETL_OVERRIDE
|
||||
{
|
||||
const size_t id = msg.get_message_id();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T6&>(msg)); break;
|
||||
case T7::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T7&>(msg)); break;
|
||||
case T8::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T8&>(msg)); break;
|
||||
case T9::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T9&>(msg)); break;
|
||||
case T10::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T10&>(msg)); break;
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T6&>(msg)); break;
|
||||
case T7::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T7&>(msg)); break;
|
||||
case T8::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T8&>(msg)); break;
|
||||
case T9::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T9&>(msg)); break;
|
||||
case T10::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T10&>(msg)); break;
|
||||
default:
|
||||
{
|
||||
if (has_successor())
|
||||
{
|
||||
get_successor().receive(source, msg);
|
||||
get_successor().receive(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(source, msg);
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(msg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1059,30 +1025,30 @@ namespace etl
|
||||
//**********************************************
|
||||
using etl::imessage_router::receive;
|
||||
|
||||
void receive(etl::imessage_router& source, const etl::imessage& msg) ETL_OVERRIDE
|
||||
void receive(const etl::imessage& msg) ETL_OVERRIDE
|
||||
{
|
||||
const size_t id = msg.get_message_id();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T6&>(msg)); break;
|
||||
case T7::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T7&>(msg)); break;
|
||||
case T8::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T8&>(msg)); break;
|
||||
case T9::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T9&>(msg)); break;
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T6&>(msg)); break;
|
||||
case T7::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T7&>(msg)); break;
|
||||
case T8::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T8&>(msg)); break;
|
||||
case T9::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T9&>(msg)); break;
|
||||
default:
|
||||
{
|
||||
if (has_successor())
|
||||
{
|
||||
get_successor().receive(source, msg);
|
||||
get_successor().receive(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(source, msg);
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(msg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1153,29 +1119,29 @@ namespace etl
|
||||
//**********************************************
|
||||
using etl::imessage_router::receive;
|
||||
|
||||
void receive(etl::imessage_router& source, const etl::imessage& msg) ETL_OVERRIDE
|
||||
void receive(const etl::imessage& msg) ETL_OVERRIDE
|
||||
{
|
||||
const size_t id = msg.get_message_id();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T6&>(msg)); break;
|
||||
case T7::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T7&>(msg)); break;
|
||||
case T8::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T8&>(msg)); break;
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T6&>(msg)); break;
|
||||
case T7::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T7&>(msg)); break;
|
||||
case T8::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T8&>(msg)); break;
|
||||
default:
|
||||
{
|
||||
if (has_successor())
|
||||
{
|
||||
get_successor().receive(source, msg);
|
||||
get_successor().receive(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(source, msg);
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(msg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1246,28 +1212,28 @@ namespace etl
|
||||
//**********************************************
|
||||
using etl::imessage_router::receive;
|
||||
|
||||
void receive(etl::imessage_router& source, const etl::imessage& msg) ETL_OVERRIDE
|
||||
void receive(const etl::imessage& msg) ETL_OVERRIDE
|
||||
{
|
||||
const size_t id = msg.get_message_id();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T6&>(msg)); break;
|
||||
case T7::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T7&>(msg)); break;
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T6&>(msg)); break;
|
||||
case T7::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T7&>(msg)); break;
|
||||
default:
|
||||
{
|
||||
if (has_successor())
|
||||
{
|
||||
get_successor().receive(source, msg);
|
||||
get_successor().receive(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(source, msg);
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(msg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1337,27 +1303,27 @@ namespace etl
|
||||
//**********************************************
|
||||
using etl::imessage_router::receive;
|
||||
|
||||
void receive(etl::imessage_router& source, const etl::imessage& msg) ETL_OVERRIDE
|
||||
void receive(const etl::imessage& msg) ETL_OVERRIDE
|
||||
{
|
||||
const size_t id = msg.get_message_id();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T6&>(msg)); break;
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T5&>(msg)); break;
|
||||
case T6::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T6&>(msg)); break;
|
||||
default:
|
||||
{
|
||||
if (has_successor())
|
||||
{
|
||||
get_successor().receive(source, msg);
|
||||
get_successor().receive(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(source, msg);
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(msg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1427,26 +1393,26 @@ namespace etl
|
||||
//**********************************************
|
||||
using etl::imessage_router::receive;
|
||||
|
||||
void receive(etl::imessage_router& source, const etl::imessage& msg) ETL_OVERRIDE
|
||||
void receive(const etl::imessage& msg) ETL_OVERRIDE
|
||||
{
|
||||
const size_t id = msg.get_message_id();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T5&>(msg)); break;
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T4&>(msg)); break;
|
||||
case T5::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T5&>(msg)); break;
|
||||
default:
|
||||
{
|
||||
if (has_successor())
|
||||
{
|
||||
get_successor().receive(source, msg);
|
||||
get_successor().receive(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(source, msg);
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(msg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1515,25 +1481,25 @@ namespace etl
|
||||
//**********************************************
|
||||
using etl::imessage_router::receive;
|
||||
|
||||
void receive(etl::imessage_router& source, const etl::imessage& msg) ETL_OVERRIDE
|
||||
void receive(const etl::imessage& msg) ETL_OVERRIDE
|
||||
{
|
||||
const size_t id = msg.get_message_id();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T4&>(msg)); break;
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T3&>(msg)); break;
|
||||
case T4::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T4&>(msg)); break;
|
||||
default:
|
||||
{
|
||||
if (has_successor())
|
||||
{
|
||||
get_successor().receive(source, msg);
|
||||
get_successor().receive(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(source, msg);
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(msg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1602,24 +1568,24 @@ namespace etl
|
||||
//**********************************************
|
||||
using etl::imessage_router::receive;
|
||||
|
||||
void receive(etl::imessage_router& source, const etl::imessage& msg) ETL_OVERRIDE
|
||||
void receive(const etl::imessage& msg) ETL_OVERRIDE
|
||||
{
|
||||
const size_t id = msg.get_message_id();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T3&>(msg)); break;
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T2&>(msg)); break;
|
||||
case T3::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T3&>(msg)); break;
|
||||
default:
|
||||
{
|
||||
if (has_successor())
|
||||
{
|
||||
get_successor().receive(source, msg);
|
||||
get_successor().receive(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(source, msg);
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(msg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1688,23 +1654,23 @@ namespace etl
|
||||
//**********************************************
|
||||
using etl::imessage_router::receive;
|
||||
|
||||
void receive(etl::imessage_router& source, const etl::imessage& msg) ETL_OVERRIDE
|
||||
void receive(const etl::imessage& msg) ETL_OVERRIDE
|
||||
{
|
||||
const size_t id = msg.get_message_id();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T2&>(msg)); break;
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T1&>(msg)); break;
|
||||
case T2::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T2&>(msg)); break;
|
||||
default:
|
||||
{
|
||||
if (has_successor())
|
||||
{
|
||||
get_successor().receive(source, msg);
|
||||
get_successor().receive(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(source, msg);
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(msg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1773,22 +1739,22 @@ namespace etl
|
||||
//**********************************************
|
||||
using etl::imessage_router::receive;
|
||||
|
||||
void receive(etl::imessage_router& source, const etl::imessage& msg) ETL_OVERRIDE
|
||||
void receive(const etl::imessage& msg) ETL_OVERRIDE
|
||||
{
|
||||
const size_t id = msg.get_message_id();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(source, static_cast<const T1&>(msg)); break;
|
||||
case T1::ID: static_cast<TDerived*>(this)->on_receive(static_cast<const T1&>(msg)); break;
|
||||
default:
|
||||
{
|
||||
if (has_successor())
|
||||
{
|
||||
get_successor().receive(source, msg);
|
||||
get_successor().receive(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(source, msg);
|
||||
static_cast<TDerived*>(this)->on_receive_unknown(msg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -473,8 +473,7 @@ namespace etl
|
||||
|
||||
if (timer.p_router != ETL_NULLPTR)
|
||||
{
|
||||
static etl::null_message_router nmr;
|
||||
timer.p_router->receive(nmr, timer.destination_router_id, *(timer.p_message));
|
||||
timer.p_router->receive(timer.destination_router_id, *(timer.p_message));
|
||||
}
|
||||
|
||||
has_active = !active_list.empty();
|
||||
|
||||
@ -37,9 +37,9 @@ SOFTWARE.
|
||||
/// Definitions of the ETL version
|
||||
///\ingroup utilities
|
||||
|
||||
#define ETL_VERSION_MAJOR 19
|
||||
#define ETL_VERSION_MINOR 5
|
||||
#define ETL_VERSION_PATCH 3
|
||||
#define ETL_VERSION_MAJOR 20
|
||||
#define ETL_VERSION_MINOR 0
|
||||
#define ETL_VERSION_PATCH 0
|
||||
#define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) "." ETL_STRINGIFY(ETL_VERSION_MINOR) "." ETL_STRINGIFY(ETL_VERSION_PATCH)
|
||||
#define ETL_VERSION_W ETL_STRINGIFY(ETL_VERSION_MAJOR) L"." ETL_STRINGIFY(ETL_VERSION_MINOR) L"." ETL_STRINGIFY(ETL_VERSION_PATCH)
|
||||
#define ETL_VERSION_U16 ETL_STRINGIFY(ETL_VERSION_MAJOR) u"." ETL_STRINGIFY(ETL_VERSION_MINOR) u"." ETL_STRINGIFY(ETL_VERSION_PATCH)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ETL Embedded Template Library",
|
||||
"version": "19.5.3",
|
||||
"version": "20.0.0",
|
||||
"author s": {
|
||||
"name": "John Wellbelove",
|
||||
"email": "john.wellbelove@etlcpp.com"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name=Embedded Template Library ETL
|
||||
version=19.5.3
|
||||
version=20.0.0
|
||||
author= John Wellbelove <john.wellbelove@etlcpp.com>
|
||||
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
|
||||
license=MIT
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
===============================================================================
|
||||
20.0.0
|
||||
Removed source 'etl::imessage_router&' parameter from the message framework 'receive'
|
||||
and 'on_receive' member functions.
|
||||
|
||||
===============================================================================
|
||||
19.5.3
|
||||
Added move constructor and move assignment operator to etl::shared_message.
|
||||
|
||||
@ -207,21 +207,21 @@ namespace
|
||||
public:
|
||||
|
||||
//***********************************
|
||||
etl::fsm_state_id_t on_event(etl::imessage_router&, const Start&)
|
||||
etl::fsm_state_id_t on_event(const Start&)
|
||||
{
|
||||
++get_fsm_context().startCount;
|
||||
return StateId::RUNNING;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
etl::fsm_state_id_t on_event(etl::imessage_router&, const Recursive&)
|
||||
etl::fsm_state_id_t on_event(const Recursive&)
|
||||
{
|
||||
get_fsm_context().queue_recursive_message(Start());
|
||||
return StateId::IDLE;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
etl::fsm_state_id_t on_event_unknown(etl::imessage_router&, const etl::imessage&)
|
||||
etl::fsm_state_id_t on_event_unknown(const etl::imessage&)
|
||||
{
|
||||
++get_fsm_context().unknownCount;
|
||||
return STATE_ID;
|
||||
@ -243,7 +243,7 @@ namespace
|
||||
public:
|
||||
|
||||
//***********************************
|
||||
etl::fsm_state_id_t on_event(etl::imessage_router&, const Stop& event)
|
||||
etl::fsm_state_id_t on_event(const Stop& event)
|
||||
{
|
||||
++get_fsm_context().stopCount;
|
||||
|
||||
@ -258,7 +258,7 @@ namespace
|
||||
}
|
||||
|
||||
//***********************************
|
||||
etl::fsm_state_id_t on_event(etl::imessage_router&, const SetSpeed& event)
|
||||
etl::fsm_state_id_t on_event(const SetSpeed& event)
|
||||
{
|
||||
++get_fsm_context().setSpeedCount;
|
||||
get_fsm_context().SetSpeedValue(event.speed);
|
||||
@ -266,7 +266,7 @@ namespace
|
||||
}
|
||||
|
||||
//***********************************
|
||||
etl::fsm_state_id_t on_event_unknown(etl::imessage_router&, const etl::imessage&)
|
||||
etl::fsm_state_id_t on_event_unknown(const etl::imessage&)
|
||||
{
|
||||
++get_fsm_context().unknownCount;
|
||||
return STATE_ID;
|
||||
@ -289,14 +289,14 @@ namespace
|
||||
public:
|
||||
|
||||
//***********************************
|
||||
etl::fsm_state_id_t on_event(etl::imessage_router&, const Stopped&)
|
||||
etl::fsm_state_id_t on_event(const Stopped&)
|
||||
{
|
||||
++get_fsm_context().stoppedCount;
|
||||
return StateId::IDLE;
|
||||
}
|
||||
|
||||
//***********************************
|
||||
etl::fsm_state_id_t on_event_unknown(etl::imessage_router&, const etl::imessage&)
|
||||
etl::fsm_state_id_t on_event_unknown(const etl::imessage&)
|
||||
{
|
||||
++get_fsm_context().unknownCount;
|
||||
return STATE_ID;
|
||||
@ -311,7 +311,7 @@ namespace
|
||||
public:
|
||||
|
||||
//***********************************
|
||||
etl::fsm_state_id_t on_event_unknown(etl::imessage_router&, const etl::imessage&)
|
||||
etl::fsm_state_id_t on_event_unknown(const etl::imessage&)
|
||||
{
|
||||
++get_fsm_context().unknownCount;
|
||||
return STATE_ID;
|
||||
@ -365,9 +365,9 @@ namespace
|
||||
CHECK_EQUAL(0, motorControl.unknownCount);
|
||||
|
||||
// Send unhandled events.
|
||||
motorControl.receive(nmr, Stop());
|
||||
motorControl.receive(nmr, Stopped());
|
||||
motorControl.receive(nmr, SetSpeed(10));
|
||||
motorControl.receive(Stop());
|
||||
motorControl.receive(Stopped());
|
||||
motorControl.receive(SetSpeed(10));
|
||||
|
||||
CHECK_EQUAL(StateId::IDLE, motorControl.get_state_id());
|
||||
CHECK_EQUAL(StateId::IDLE, motorControl.get_state().get_state_id());
|
||||
@ -381,7 +381,7 @@ namespace
|
||||
CHECK_EQUAL(3, motorControl.unknownCount);
|
||||
|
||||
// Send Start event.
|
||||
motorControl.receive(nmr, Start());
|
||||
motorControl.receive(Start());
|
||||
|
||||
// Now in Running state.
|
||||
|
||||
@ -397,8 +397,8 @@ namespace
|
||||
CHECK_EQUAL(3, motorControl.unknownCount);
|
||||
|
||||
// Send unhandled events.
|
||||
motorControl.receive(nmr, Start());
|
||||
motorControl.receive(nmr, Stopped());
|
||||
motorControl.receive(Start());
|
||||
motorControl.receive(Stopped());
|
||||
|
||||
CHECK_EQUAL(StateId::RUNNING, int(motorControl.get_state_id()));
|
||||
CHECK_EQUAL(StateId::RUNNING, int(motorControl.get_state().get_state_id()));
|
||||
@ -412,7 +412,7 @@ namespace
|
||||
CHECK_EQUAL(5, motorControl.unknownCount);
|
||||
|
||||
// Send SetSpeed event.
|
||||
motorControl.receive(nmr, SetSpeed(100));
|
||||
motorControl.receive(SetSpeed(100));
|
||||
|
||||
// Still in Running state.
|
||||
|
||||
@ -428,7 +428,7 @@ namespace
|
||||
CHECK_EQUAL(5, motorControl.unknownCount);
|
||||
|
||||
// Send Stop event.
|
||||
motorControl.receive(nmr, Stop());
|
||||
motorControl.receive(Stop());
|
||||
|
||||
// Now in WindingDown state.
|
||||
|
||||
@ -444,9 +444,9 @@ namespace
|
||||
CHECK_EQUAL(5, motorControl.unknownCount);
|
||||
|
||||
// Send unhandled events.
|
||||
motorControl.receive(nmr, Start());
|
||||
motorControl.receive(nmr, Stop());
|
||||
motorControl.receive(nmr, SetSpeed(100));
|
||||
motorControl.receive(Start());
|
||||
motorControl.receive(Stop());
|
||||
motorControl.receive(SetSpeed(100));
|
||||
|
||||
CHECK_EQUAL(StateId::WINDING_DOWN, int(motorControl.get_state_id()));
|
||||
CHECK_EQUAL(StateId::WINDING_DOWN, int(motorControl.get_state().get_state_id()));
|
||||
@ -460,7 +460,7 @@ namespace
|
||||
CHECK_EQUAL(8, motorControl.unknownCount);
|
||||
|
||||
// Send Stopped event.
|
||||
motorControl.receive(nmr, Stopped());
|
||||
motorControl.receive(Stopped());
|
||||
|
||||
// Now in Locked state via Idle state.
|
||||
CHECK_EQUAL(StateId::LOCKED, int(motorControl.get_state_id()));
|
||||
@ -493,7 +493,7 @@ namespace
|
||||
// Now in Idle state.
|
||||
|
||||
// Send Start event.
|
||||
motorControl.receive(nmr, Start());
|
||||
motorControl.receive(Start());
|
||||
|
||||
// Now in Running state.
|
||||
|
||||
@ -509,7 +509,7 @@ namespace
|
||||
CHECK_EQUAL(0, motorControl.unknownCount);
|
||||
|
||||
// Send emergency Stop event.
|
||||
motorControl.receive(nmr, Stop(true));
|
||||
motorControl.receive(Stop(true));
|
||||
|
||||
// Now in Locked state via Idle state.
|
||||
CHECK_EQUAL(StateId::LOCKED, int(motorControl.get_state_id()));
|
||||
@ -540,12 +540,12 @@ namespace
|
||||
|
||||
// Now in Idle state.
|
||||
// Send Start event.
|
||||
motorControl.receive(nmr, Recursive());
|
||||
motorControl.receive(Recursive());
|
||||
|
||||
CHECK_EQUAL(1U, motorControl.messageQueue.size());
|
||||
|
||||
// Send the queued message.
|
||||
motorControl.receive(nmr, motorControl.messageQueue.front().get());
|
||||
motorControl.receive(motorControl.messageQueue.front().get());
|
||||
motorControl.messageQueue.pop();
|
||||
|
||||
// Now in Running state.
|
||||
|
||||
@ -60,37 +60,57 @@ namespace
|
||||
|
||||
struct Message1 : public etl::message<MESSAGE1>
|
||||
{
|
||||
Message1(etl::imessage_router& callback_)
|
||||
: callback(callback_)
|
||||
{
|
||||
}
|
||||
|
||||
etl::imessage_router& callback;
|
||||
};
|
||||
|
||||
struct Message2 : public etl::message<MESSAGE2>
|
||||
{
|
||||
Message2(etl::imessage_router& callback_)
|
||||
: callback(callback_)
|
||||
{
|
||||
}
|
||||
|
||||
etl::imessage_router& callback;
|
||||
};
|
||||
|
||||
struct Message3 : public etl::message<MESSAGE3>
|
||||
{
|
||||
Message3(etl::imessage_router& callback_)
|
||||
: callback(callback_)
|
||||
{
|
||||
}
|
||||
|
||||
etl::imessage_router& callback;
|
||||
int value[10];
|
||||
};
|
||||
|
||||
struct Message4 : public etl::message<MESSAGE4>
|
||||
{
|
||||
Message4(etl::imessage_router& callback_)
|
||||
: callback(callback_)
|
||||
{
|
||||
}
|
||||
|
||||
etl::imessage_router& callback;
|
||||
};
|
||||
|
||||
struct Message5 : public etl::message<MESSAGE5>
|
||||
struct Response : public etl::message<MESSAGE5>
|
||||
{
|
||||
};
|
||||
|
||||
Message1 message1;
|
||||
Message2 message2;
|
||||
Message3 message3;
|
||||
Message4 message4;
|
||||
Message5 message5;
|
||||
Response response;
|
||||
|
||||
int call_order;
|
||||
|
||||
//***************************************************************************
|
||||
// Router that handles messages 1, 2, 3, 4, 5.
|
||||
//***************************************************************************
|
||||
class RouterA : public etl::message_router<RouterA, Message1, Message2, Message3, Message4, Message5>
|
||||
class RouterA : public etl::message_router<RouterA, Message1, Message2, Message3, Message4, Response>
|
||||
{
|
||||
public:
|
||||
|
||||
@ -106,38 +126,38 @@ namespace
|
||||
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router& sender, const Message1&)
|
||||
void on_receive(const Message1& msg)
|
||||
{
|
||||
++message1_count;
|
||||
etl::send_message(sender, message5);
|
||||
etl::send_message(msg.callback, response);
|
||||
|
||||
order = call_order++;
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router& sender, const Message2&)
|
||||
void on_receive(const Message2& msg)
|
||||
{
|
||||
++message2_count;
|
||||
etl::send_message(sender, message5);
|
||||
etl::send_message(msg.callback, response);
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router& sender, const Message3&)
|
||||
void on_receive(const Message3& msg)
|
||||
{
|
||||
++message3_count;
|
||||
etl::send_message(sender, message5);
|
||||
etl::send_message(msg.callback, response);
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router& sender, const Message4&)
|
||||
void on_receive(const Message4& msg)
|
||||
{
|
||||
++message4_count;
|
||||
etl::send_message(sender, message5);
|
||||
etl::send_message(msg.callback, response);
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router&, const Message5&)
|
||||
void on_receive(const Response&)
|
||||
{
|
||||
++message5_count;
|
||||
}
|
||||
|
||||
void on_receive_unknown(etl::imessage_router&, const etl::imessage&)
|
||||
void on_receive_unknown(const etl::imessage&)
|
||||
{
|
||||
++message_unknown_count;
|
||||
}
|
||||
@ -154,7 +174,7 @@ namespace
|
||||
//***************************************************************************
|
||||
// Router that handles messages 1, 2, 4 and 5 and returns nothing.
|
||||
//***************************************************************************
|
||||
class RouterB : public etl::message_router<RouterB, Message1, Message2, Message4, Message5>
|
||||
class RouterB : public etl::message_router<RouterB, Message1, Message2, Message4, Response>
|
||||
{
|
||||
public:
|
||||
|
||||
@ -169,33 +189,33 @@ namespace
|
||||
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router& sender, const Message1&)
|
||||
void on_receive(const Message1& msg)
|
||||
{
|
||||
++message1_count;
|
||||
etl::send_message(sender, message5);
|
||||
etl::send_message(msg.callback, response);
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router& sender, const Message2&)
|
||||
void on_receive(const Message2& msg)
|
||||
{
|
||||
++message2_count;
|
||||
etl::send_message(sender, message5);
|
||||
etl::send_message(msg.callback, response);
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router& sender, const Message4&)
|
||||
void on_receive(const Message4& msg)
|
||||
{
|
||||
++message4_count;
|
||||
etl::send_message(sender, message5);
|
||||
etl::send_message(msg.callback, response);
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router&, const Message5&)
|
||||
void on_receive(const Response&)
|
||||
{
|
||||
++message5_count;
|
||||
}
|
||||
|
||||
void on_receive_unknown(etl::imessage_router& sender, const etl::imessage&)
|
||||
void on_receive_unknown(const etl::imessage& msg)
|
||||
{
|
||||
++message_unknown_count;
|
||||
etl::send_message(sender, message5);
|
||||
//etl::send_message(msg.callback, response);
|
||||
}
|
||||
|
||||
int message1_count;
|
||||
@ -279,12 +299,17 @@ namespace
|
||||
|
||||
RouterA router1(ROUTER1);
|
||||
RouterB router2(ROUTER2);
|
||||
RouterA sender(ROUTER3);
|
||||
RouterA callback(ROUTER3);
|
||||
|
||||
bus1.subscribe(router1);
|
||||
bus1.subscribe(router2);
|
||||
|
||||
bus1.receive(sender, message1);
|
||||
Message1 message1(callback);
|
||||
Message2 message2(callback);
|
||||
Message3 message3(callback);
|
||||
Message4 message4(callback);
|
||||
|
||||
bus1.receive(message1);
|
||||
|
||||
CHECK_EQUAL(1, router1.message1_count);
|
||||
CHECK_EQUAL(0, router1.message2_count);
|
||||
@ -299,9 +324,9 @@ namespace
|
||||
CHECK_EQUAL(0, router2.message5_count);
|
||||
CHECK_EQUAL(0, router2.message_unknown_count);
|
||||
|
||||
CHECK_EQUAL(2, sender.message5_count);
|
||||
CHECK_EQUAL(2, callback.message5_count);
|
||||
|
||||
bus1.receive(sender, message2);
|
||||
bus1.receive(message2);
|
||||
|
||||
CHECK_EQUAL(1, router1.message1_count);
|
||||
CHECK_EQUAL(1, router1.message2_count);
|
||||
@ -316,9 +341,9 @@ namespace
|
||||
CHECK_EQUAL(0, router2.message5_count);
|
||||
CHECK_EQUAL(0, router2.message_unknown_count);
|
||||
|
||||
CHECK_EQUAL(4, sender.message5_count);
|
||||
CHECK_EQUAL(4, callback.message5_count);
|
||||
|
||||
bus1.receive(sender, message3);
|
||||
bus1.receive(message3);
|
||||
|
||||
CHECK_EQUAL(1, router1.message1_count);
|
||||
CHECK_EQUAL(1, router1.message2_count);
|
||||
@ -333,10 +358,10 @@ namespace
|
||||
CHECK_EQUAL(0, router2.message5_count);
|
||||
CHECK_EQUAL(0, router2.message_unknown_count);
|
||||
|
||||
CHECK_EQUAL(5, sender.message5_count);
|
||||
CHECK_EQUAL(5, callback.message5_count);
|
||||
|
||||
// Use global function.
|
||||
etl::send_message(sender, bus1, message4);
|
||||
etl::send_message(bus1, message4);
|
||||
|
||||
CHECK_EQUAL(1, router1.message1_count);
|
||||
CHECK_EQUAL(1, router1.message2_count);
|
||||
@ -351,7 +376,7 @@ namespace
|
||||
CHECK_EQUAL(0, router2.message5_count);
|
||||
CHECK_EQUAL(0, router2.message_unknown_count);
|
||||
|
||||
CHECK_EQUAL(7, sender.message5_count);
|
||||
CHECK_EQUAL(7, callback.message5_count);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
@ -361,15 +386,20 @@ namespace
|
||||
|
||||
RouterA router1(ROUTER1);
|
||||
RouterB router2(ROUTER2);
|
||||
RouterA sender(ROUTER3);
|
||||
RouterA callback(ROUTER3);
|
||||
|
||||
bus1.subscribe(router1);
|
||||
bus1.subscribe(router2);
|
||||
|
||||
Message1 message1(callback);
|
||||
Message2 message2(callback);
|
||||
Message3 message3(callback);
|
||||
Message4 message4(callback);
|
||||
|
||||
// Reference to router sub-type
|
||||
etl::imessage_router& irouter = bus1;
|
||||
|
||||
irouter.receive(sender, message1);
|
||||
irouter.receive(message1);
|
||||
|
||||
CHECK_EQUAL(1, router1.message1_count);
|
||||
CHECK_EQUAL(0, router1.message2_count);
|
||||
@ -384,9 +414,9 @@ namespace
|
||||
CHECK_EQUAL(0, router2.message5_count);
|
||||
CHECK_EQUAL(0, router2.message_unknown_count);
|
||||
|
||||
CHECK_EQUAL(2, sender.message5_count);
|
||||
CHECK_EQUAL(2, callback.message5_count);
|
||||
|
||||
irouter.receive(sender, message2);
|
||||
irouter.receive(message2);
|
||||
|
||||
CHECK_EQUAL(1, router1.message1_count);
|
||||
CHECK_EQUAL(1, router1.message2_count);
|
||||
@ -401,9 +431,9 @@ namespace
|
||||
CHECK_EQUAL(0, router2.message5_count);
|
||||
CHECK_EQUAL(0, router2.message_unknown_count);
|
||||
|
||||
CHECK_EQUAL(4, sender.message5_count);
|
||||
CHECK_EQUAL(4, callback.message5_count);
|
||||
|
||||
irouter.receive(sender, message3);
|
||||
irouter.receive(message3);
|
||||
|
||||
CHECK_EQUAL(1, router1.message1_count);
|
||||
CHECK_EQUAL(1, router1.message2_count);
|
||||
@ -418,10 +448,10 @@ namespace
|
||||
CHECK_EQUAL(0, router2.message5_count);
|
||||
CHECK_EQUAL(0, router2.message_unknown_count);
|
||||
|
||||
CHECK_EQUAL(5, sender.message5_count);
|
||||
CHECK_EQUAL(5, callback.message5_count);
|
||||
|
||||
// Use global function.
|
||||
etl::send_message(sender, irouter, message4);
|
||||
etl::send_message(irouter, message4);
|
||||
|
||||
CHECK_EQUAL(1, router1.message1_count);
|
||||
CHECK_EQUAL(1, router1.message2_count);
|
||||
@ -436,7 +466,7 @@ namespace
|
||||
CHECK_EQUAL(0, router2.message5_count);
|
||||
CHECK_EQUAL(0, router2.message_unknown_count);
|
||||
|
||||
CHECK_EQUAL(7, sender.message5_count);
|
||||
CHECK_EQUAL(7, callback.message5_count);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
@ -446,12 +476,17 @@ namespace
|
||||
|
||||
RouterA router1(ROUTER1);
|
||||
RouterB router2(ROUTER2);
|
||||
RouterA sender(ROUTER3);
|
||||
RouterA callback(ROUTER3);
|
||||
|
||||
bus1.subscribe(router1);
|
||||
bus1.subscribe(router2);
|
||||
|
||||
bus1.receive(sender, ROUTER1, message1);
|
||||
Message1 message1(callback);
|
||||
Message2 message2(callback);
|
||||
Message3 message3(callback);
|
||||
Message4 message4(callback);
|
||||
|
||||
bus1.receive(ROUTER1, message1);
|
||||
|
||||
CHECK_EQUAL(1, router1.message1_count);
|
||||
CHECK_EQUAL(0, router1.message2_count);
|
||||
@ -466,9 +501,9 @@ namespace
|
||||
CHECK_EQUAL(0, router2.message5_count);
|
||||
CHECK_EQUAL(0, router2.message_unknown_count);
|
||||
|
||||
CHECK_EQUAL(1, sender.message5_count);
|
||||
CHECK_EQUAL(1, callback.message5_count);
|
||||
|
||||
bus1.receive(sender, ROUTER2, message2);
|
||||
bus1.receive(ROUTER2, message2);
|
||||
|
||||
CHECK_EQUAL(1, router1.message1_count);
|
||||
CHECK_EQUAL(0, router1.message2_count);
|
||||
@ -483,9 +518,9 @@ namespace
|
||||
CHECK_EQUAL(0, router2.message5_count);
|
||||
CHECK_EQUAL(0, router2.message_unknown_count);
|
||||
|
||||
CHECK_EQUAL(2, sender.message5_count);
|
||||
CHECK_EQUAL(2, callback.message5_count);
|
||||
|
||||
bus1.receive(sender, ROUTER1, message3);
|
||||
bus1.receive(ROUTER1, message3);
|
||||
|
||||
CHECK_EQUAL(1, router1.message1_count);
|
||||
CHECK_EQUAL(0, router1.message2_count);
|
||||
@ -500,10 +535,10 @@ namespace
|
||||
CHECK_EQUAL(0, router2.message5_count);
|
||||
CHECK_EQUAL(0, router2.message_unknown_count);
|
||||
|
||||
CHECK_EQUAL(3, sender.message5_count);
|
||||
CHECK_EQUAL(3, callback.message5_count);
|
||||
|
||||
// Use global function.
|
||||
etl::send_message(sender, bus1, ROUTER2, message4);
|
||||
etl::send_message(bus1, ROUTER2, message4);
|
||||
|
||||
CHECK_EQUAL(1, router1.message1_count);
|
||||
CHECK_EQUAL(0, router1.message2_count);
|
||||
@ -518,10 +553,10 @@ namespace
|
||||
CHECK_EQUAL(0, router2.message5_count);
|
||||
CHECK_EQUAL(0, router2.message_unknown_count);
|
||||
|
||||
CHECK_EQUAL(4, sender.message5_count);
|
||||
CHECK_EQUAL(4, callback.message5_count);
|
||||
|
||||
// Send to a router not subscribed to the bus.
|
||||
bus1.receive(sender, ROUTER5, message1);
|
||||
bus1.receive(ROUTER5, message1);
|
||||
|
||||
CHECK_EQUAL(1, router1.message1_count);
|
||||
CHECK_EQUAL(0, router1.message2_count);
|
||||
@ -536,7 +571,7 @@ namespace
|
||||
CHECK_EQUAL(0, router2.message5_count);
|
||||
CHECK_EQUAL(0, router2.message_unknown_count);
|
||||
|
||||
CHECK_EQUAL(4, sender.message5_count);
|
||||
CHECK_EQUAL(4, callback.message5_count);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
@ -547,13 +582,17 @@ namespace
|
||||
RouterA router1(ROUTER1);
|
||||
RouterB router2(ROUTER1);
|
||||
RouterB router3(ROUTER2);
|
||||
RouterA sender(ROUTER3);
|
||||
RouterA callback(ROUTER3);
|
||||
|
||||
bus1.subscribe(router1);
|
||||
bus1.subscribe(router2);
|
||||
bus1.subscribe(router3);
|
||||
|
||||
bus1.receive(sender, ROUTER1, message1);
|
||||
Message1 message1(callback);
|
||||
Message2 message2(callback);
|
||||
Message3 message3(callback);
|
||||
|
||||
bus1.receive(ROUTER1, message1);
|
||||
|
||||
CHECK_EQUAL(1, router1.message1_count);
|
||||
CHECK_EQUAL(0, router1.message2_count);
|
||||
@ -574,7 +613,7 @@ namespace
|
||||
CHECK_EQUAL(0, router3.message5_count);
|
||||
CHECK_EQUAL(0, router3.message_unknown_count);
|
||||
|
||||
CHECK_EQUAL(2, sender.message5_count);
|
||||
CHECK_EQUAL(2, callback.message5_count);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
@ -588,7 +627,7 @@ namespace
|
||||
RouterA router3(ROUTER3);
|
||||
RouterA router4(ROUTER4);
|
||||
|
||||
RouterA sender(ROUTER5);
|
||||
RouterA callback(ROUTER5);
|
||||
|
||||
bus1.subscribe(router1);
|
||||
bus1.subscribe(router2);
|
||||
@ -597,8 +636,13 @@ namespace
|
||||
bus2.subscribe(router3);
|
||||
bus2.subscribe(router4);
|
||||
|
||||
Message1 message1(callback);
|
||||
Message2 message2(callback);
|
||||
Message3 message3(callback);
|
||||
Message4 message4(callback);
|
||||
|
||||
// Broadcast to bus1
|
||||
bus1.receive(sender, message1);
|
||||
bus1.receive(message1);
|
||||
|
||||
CHECK_EQUAL(1, router1.message1_count);
|
||||
CHECK_EQUAL(0, router1.message2_count);
|
||||
@ -625,10 +669,10 @@ namespace
|
||||
CHECK_EQUAL(0, router4.message5_count);
|
||||
CHECK_EQUAL(0, router4.message_unknown_count);
|
||||
|
||||
CHECK_EQUAL(4, sender.message5_count);
|
||||
CHECK_EQUAL(4, callback.message5_count);
|
||||
|
||||
// Addressed to ROUTER2
|
||||
bus1.receive(sender, ROUTER2, message1);
|
||||
bus1.receive(ROUTER2, message1);
|
||||
|
||||
CHECK_EQUAL(1, router1.message1_count);
|
||||
CHECK_EQUAL(0, router1.message2_count);
|
||||
@ -655,10 +699,10 @@ namespace
|
||||
CHECK_EQUAL(0, router4.message5_count);
|
||||
CHECK_EQUAL(0, router4.message_unknown_count);
|
||||
|
||||
CHECK_EQUAL(5, sender.message5_count);
|
||||
CHECK_EQUAL(5, callback.message5_count);
|
||||
|
||||
// Addressed to ROUTER3 via bus2
|
||||
bus1.receive(sender, ROUTER3, message1);
|
||||
bus1.receive(ROUTER3, message1);
|
||||
|
||||
CHECK_EQUAL(1, router1.message1_count);
|
||||
CHECK_EQUAL(0, router1.message2_count);
|
||||
@ -685,7 +729,7 @@ namespace
|
||||
CHECK_EQUAL(0, router4.message5_count);
|
||||
CHECK_EQUAL(0, router4.message_unknown_count);
|
||||
|
||||
CHECK_EQUAL(6, sender.message5_count);
|
||||
CHECK_EQUAL(6, callback.message5_count);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
@ -701,7 +745,7 @@ namespace
|
||||
RouterA router4a(ROUTER4);
|
||||
RouterA router4b(ROUTER4);
|
||||
|
||||
RouterA sender(ROUTER5);
|
||||
RouterA callback(ROUTER5);
|
||||
|
||||
bus1.subscribe(router1);
|
||||
bus1.subscribe(bus3);
|
||||
@ -712,9 +756,11 @@ namespace
|
||||
bus3.subscribe(router4b);
|
||||
bus3.subscribe(router4a);
|
||||
|
||||
Message1 message1(callback);
|
||||
|
||||
call_order = 0;
|
||||
|
||||
bus1.receive(sender, message1);
|
||||
bus1.receive(message1);
|
||||
|
||||
CHECK_EQUAL(0, router1.order);
|
||||
CHECK_EQUAL(1, router2.order);
|
||||
|
||||
@ -56,29 +56,49 @@ namespace
|
||||
|
||||
struct Message1 : public etl::message<MESSAGE1>
|
||||
{
|
||||
Message1(etl::imessage_router& callback_)
|
||||
: callback(callback_)
|
||||
{
|
||||
}
|
||||
|
||||
etl::imessage_router& callback;
|
||||
};
|
||||
|
||||
struct Message2 : public etl::message<MESSAGE2>
|
||||
{
|
||||
Message2(etl::imessage_router& callback_)
|
||||
: callback(callback_)
|
||||
{
|
||||
}
|
||||
|
||||
etl::imessage_router& callback;
|
||||
};
|
||||
|
||||
struct Message3 : public etl::message<MESSAGE3>
|
||||
{
|
||||
Message3(etl::imessage_router& callback_)
|
||||
: callback(callback_)
|
||||
{
|
||||
}
|
||||
|
||||
etl::imessage_router& callback;
|
||||
int value[10];
|
||||
};
|
||||
|
||||
struct Message4 : public etl::message<MESSAGE4>
|
||||
{
|
||||
Message4(etl::imessage_router& callback_)
|
||||
: callback(callback_)
|
||||
{
|
||||
}
|
||||
|
||||
etl::imessage_router& callback;
|
||||
};
|
||||
|
||||
struct Message5 : public etl::message<MESSAGE5>
|
||||
{
|
||||
};
|
||||
|
||||
Message1 message1;
|
||||
Message2 message2;
|
||||
Message3 message3;
|
||||
Message4 message4;
|
||||
Message5 message5;
|
||||
|
||||
//***************************************************************************
|
||||
@ -100,36 +120,36 @@ namespace
|
||||
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router& sender, const Message1&)
|
||||
void on_receive(const Message1& msg)
|
||||
{
|
||||
++message1_count;
|
||||
etl::send_message(sender, message5);
|
||||
etl::send_message(msg.callback, message5);
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router& sender, const Message2&)
|
||||
void on_receive(const Message2& msg)
|
||||
{
|
||||
++message2_count;
|
||||
etl::send_message(sender, message5);
|
||||
etl::send_message(msg.callback, message5);
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router& sender, const Message3&)
|
||||
void on_receive(const Message3& msg)
|
||||
{
|
||||
++message3_count;
|
||||
etl::send_message(sender, message5);
|
||||
etl::send_message(msg.callback, message5);
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router& sender, const Message4&)
|
||||
void on_receive(const Message4& msg)
|
||||
{
|
||||
++message4_count;
|
||||
etl::send_message(sender, message5);
|
||||
etl::send_message(msg.callback, message5);
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router&, const Message5&)
|
||||
void on_receive(const Message5&)
|
||||
{
|
||||
++callback_count;
|
||||
}
|
||||
|
||||
void on_receive_unknown(etl::imessage_router&, const etl::imessage&)
|
||||
void on_receive_unknown(const etl::imessage&)
|
||||
{
|
||||
++message_unknown_count;
|
||||
}
|
||||
@ -161,38 +181,36 @@ namespace
|
||||
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router& sender, const Message1&)
|
||||
void on_receive(const Message1& msg)
|
||||
{
|
||||
++message1_count;
|
||||
sender_id = sender.get_message_router_id();
|
||||
etl::send_message(sender, message5);
|
||||
sender_id = msg.callback.get_message_router_id();
|
||||
etl::send_message(msg.callback, message5);
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router& sender, const Message2&)
|
||||
void on_receive(const Message2& msg)
|
||||
{
|
||||
++message2_count;
|
||||
sender_id = sender.get_message_router_id();
|
||||
etl::send_message(sender, message5);
|
||||
sender_id = msg.callback.get_message_router_id();
|
||||
etl::send_message(msg.callback, message5);
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router& sender, const Message4&)
|
||||
void on_receive(const Message4& msg)
|
||||
{
|
||||
++message4_count;
|
||||
sender_id = sender.get_message_router_id();
|
||||
etl::send_message(sender, message5);
|
||||
sender_id = msg.callback.get_message_router_id();
|
||||
etl::send_message(msg.callback, message5);
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router& sender, const Message5&)
|
||||
void on_receive(const Message5& msg)
|
||||
{
|
||||
sender_id = sender.get_message_router_id();
|
||||
++callback_count;
|
||||
}
|
||||
|
||||
void on_receive_unknown(etl::imessage_router& sender, const etl::imessage&)
|
||||
void on_receive_unknown(const etl::imessage&)
|
||||
{
|
||||
++message_unknown_count;
|
||||
sender_id = 0;
|
||||
etl::send_message(sender, message5);
|
||||
}
|
||||
|
||||
int message1_count;
|
||||
@ -215,11 +233,16 @@ namespace
|
||||
|
||||
p_router = &r1;
|
||||
|
||||
Message1 message1(r2);
|
||||
Message2 message2(r2);
|
||||
Message3 message3(r2);
|
||||
Message4 message4(r2);
|
||||
|
||||
// CHECK(!r1.is_null_router());
|
||||
CHECK(r1.is_producer());
|
||||
CHECK(r1.is_consumer());
|
||||
|
||||
p_router->receive(r2, message1);
|
||||
p_router->receive(message1);
|
||||
CHECK_EQUAL(1, r1.message1_count);
|
||||
CHECK_EQUAL(0, r1.message2_count);
|
||||
CHECK_EQUAL(0, r1.message3_count);
|
||||
@ -227,7 +250,7 @@ namespace
|
||||
CHECK_EQUAL(0, r1.message_unknown_count);
|
||||
CHECK_EQUAL(1, r2.callback_count);
|
||||
|
||||
p_router->receive(r2, message2);
|
||||
p_router->receive(message2);
|
||||
CHECK_EQUAL(1, r1.message1_count);
|
||||
CHECK_EQUAL(1, r1.message2_count);
|
||||
CHECK_EQUAL(0, r1.message3_count);
|
||||
@ -235,7 +258,7 @@ namespace
|
||||
CHECK_EQUAL(0, r1.message_unknown_count);
|
||||
CHECK_EQUAL(2, r2.callback_count);
|
||||
|
||||
p_router->receive(r2, message3);
|
||||
p_router->receive(message3);
|
||||
CHECK_EQUAL(1, r1.message1_count);
|
||||
CHECK_EQUAL(1, r1.message2_count);
|
||||
CHECK_EQUAL(1, r1.message3_count);
|
||||
@ -243,43 +266,13 @@ namespace
|
||||
CHECK_EQUAL(0, r1.message_unknown_count);
|
||||
CHECK_EQUAL(3, r2.callback_count);
|
||||
|
||||
p_router->receive(r2, message4);
|
||||
p_router->receive(message4);
|
||||
CHECK_EQUAL(1, r1.message1_count);
|
||||
CHECK_EQUAL(1, r1.message2_count);
|
||||
CHECK_EQUAL(1, r1.message3_count);
|
||||
CHECK_EQUAL(1, r1.message4_count);
|
||||
CHECK_EQUAL(0, r1.message_unknown_count);
|
||||
CHECK_EQUAL(4, r2.callback_count);
|
||||
|
||||
p_router = &r2;
|
||||
|
||||
p_router->receive(r1, message1);
|
||||
CHECK_EQUAL(1, r2.message1_count);
|
||||
CHECK_EQUAL(0, r2.message2_count);
|
||||
CHECK_EQUAL(0, r2.message4_count);
|
||||
CHECK_EQUAL(0, r2.message_unknown_count);
|
||||
CHECK_EQUAL(1, r1.callback_count);
|
||||
|
||||
p_router->receive(r1, message2);
|
||||
CHECK_EQUAL(1, r2.message1_count);
|
||||
CHECK_EQUAL(1, r2.message2_count);
|
||||
CHECK_EQUAL(0, r2.message4_count);
|
||||
CHECK_EQUAL(0, r2.message_unknown_count);
|
||||
CHECK_EQUAL(2, r1.callback_count);
|
||||
|
||||
p_router->receive(r1, message3);
|
||||
CHECK_EQUAL(1, r2.message1_count);
|
||||
CHECK_EQUAL(1, r2.message2_count);
|
||||
CHECK_EQUAL(0, r2.message4_count);
|
||||
CHECK_EQUAL(1, r2.message_unknown_count);
|
||||
CHECK_EQUAL(3, r1.callback_count);
|
||||
|
||||
p_router->receive(r1, message4);
|
||||
CHECK_EQUAL(1, r2.message1_count);
|
||||
CHECK_EQUAL(1, r2.message2_count);
|
||||
CHECK_EQUAL(1, r2.message4_count);
|
||||
CHECK_EQUAL(1, r2.message_unknown_count);
|
||||
CHECK_EQUAL(4, r1.callback_count);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
@ -288,55 +281,60 @@ namespace
|
||||
Router2 router;
|
||||
etl::null_message_router null_router;
|
||||
|
||||
Message1 message1(null_router);
|
||||
Message2 message2(null_router);
|
||||
Message3 message3(null_router);
|
||||
Message4 message4(null_router);
|
||||
|
||||
// CHECK(null_router.is_null_router());
|
||||
CHECK(!null_router.is_producer());
|
||||
CHECK(!null_router.is_consumer());
|
||||
|
||||
// Send from the null router.
|
||||
etl::send_message(null_router, router, message1);
|
||||
etl::send_message(router, message1);
|
||||
CHECK_EQUAL(1, router.message1_count);
|
||||
CHECK_EQUAL(0, router.message2_count);
|
||||
CHECK_EQUAL(0, router.message4_count);
|
||||
CHECK_EQUAL(0, router.message_unknown_count);
|
||||
|
||||
etl::send_message(null_router, router, message2);
|
||||
etl::send_message(router, message2);
|
||||
CHECK_EQUAL(1, router.message1_count);
|
||||
CHECK_EQUAL(1, router.message2_count);
|
||||
CHECK_EQUAL(0, router.message4_count);
|
||||
CHECK_EQUAL(0, router.message_unknown_count);
|
||||
|
||||
etl::send_message(null_router, router, message3);
|
||||
etl::send_message(router, message3);
|
||||
CHECK_EQUAL(1, router.message1_count);
|
||||
CHECK_EQUAL(1, router.message2_count);
|
||||
CHECK_EQUAL(0, router.message4_count);
|
||||
CHECK_EQUAL(1, router.message_unknown_count);
|
||||
|
||||
etl::send_message(null_router, router, message4);
|
||||
etl::send_message(router, message4);
|
||||
CHECK_EQUAL(1, router.message1_count);
|
||||
CHECK_EQUAL(1, router.message2_count);
|
||||
CHECK_EQUAL(1, router.message4_count);
|
||||
CHECK_EQUAL(1, router.message_unknown_count);
|
||||
|
||||
// Send to the null router.
|
||||
etl::send_message(router, null_router, message1);
|
||||
etl::send_message(null_router, message1);
|
||||
CHECK_EQUAL(1, router.message1_count);
|
||||
CHECK_EQUAL(1, router.message2_count);
|
||||
CHECK_EQUAL(1, router.message4_count);
|
||||
CHECK_EQUAL(1, router.message_unknown_count);
|
||||
|
||||
etl::send_message(router, null_router, message2);
|
||||
etl::send_message(null_router, message2);
|
||||
CHECK_EQUAL(1, router.message1_count);
|
||||
CHECK_EQUAL(1, router.message2_count);
|
||||
CHECK_EQUAL(1, router.message4_count);
|
||||
CHECK_EQUAL(1, router.message_unknown_count);
|
||||
|
||||
etl::send_message(router, null_router, message3);
|
||||
etl::send_message(null_router, message3);
|
||||
CHECK_EQUAL(1, router.message1_count);
|
||||
CHECK_EQUAL(1, router.message2_count);
|
||||
CHECK_EQUAL(1, router.message4_count);
|
||||
CHECK_EQUAL(1, router.message_unknown_count);
|
||||
|
||||
etl::send_message(router, null_router, message4);
|
||||
etl::send_message(null_router, message4);
|
||||
CHECK_EQUAL(1, router.message1_count);
|
||||
CHECK_EQUAL(1, router.message2_count);
|
||||
CHECK_EQUAL(1, router.message4_count);
|
||||
@ -349,6 +347,11 @@ namespace
|
||||
Router2 router;
|
||||
etl::message_producer producer(ROUTER3);
|
||||
|
||||
Message1 message1(producer);
|
||||
Message2 message2(producer);
|
||||
Message3 message3(producer);
|
||||
Message4 message4(producer);
|
||||
|
||||
// CHECK(!producer.is_null_router());
|
||||
CHECK(producer.is_producer());
|
||||
CHECK(!producer.is_consumer());
|
||||
@ -356,28 +359,28 @@ namespace
|
||||
CHECK_EQUAL(0, router.sender_id);
|
||||
|
||||
// Send from the producer.
|
||||
etl::send_message(producer, router, message1);
|
||||
etl::send_message(router, message1);
|
||||
CHECK_EQUAL(1, router.message1_count);
|
||||
CHECK_EQUAL(0, router.message2_count);
|
||||
CHECK_EQUAL(0, router.message4_count);
|
||||
CHECK_EQUAL(0, router.message_unknown_count);
|
||||
CHECK_EQUAL(ROUTER3, router.sender_id);
|
||||
|
||||
etl::send_message(producer, router, message2);
|
||||
etl::send_message(router, message2);
|
||||
CHECK_EQUAL(1, router.message1_count);
|
||||
CHECK_EQUAL(1, router.message2_count);
|
||||
CHECK_EQUAL(0, router.message4_count);
|
||||
CHECK_EQUAL(0, router.message_unknown_count);
|
||||
CHECK_EQUAL(ROUTER3, router.sender_id);
|
||||
|
||||
etl::send_message(producer, router, message3);
|
||||
etl::send_message(router, message3);
|
||||
CHECK_EQUAL(1, router.message1_count);
|
||||
CHECK_EQUAL(1, router.message2_count);
|
||||
CHECK_EQUAL(0, router.message4_count);
|
||||
CHECK_EQUAL(1, router.message_unknown_count);
|
||||
CHECK_EQUAL(0, router.sender_id);
|
||||
|
||||
etl::send_message(producer, router, message4);
|
||||
etl::send_message(router, message4);
|
||||
CHECK_EQUAL(1, router.message1_count);
|
||||
CHECK_EQUAL(1, router.message2_count);
|
||||
CHECK_EQUAL(1, router.message4_count);
|
||||
@ -385,25 +388,25 @@ namespace
|
||||
CHECK_EQUAL(ROUTER3, router.sender_id);
|
||||
|
||||
// Send to the producer.
|
||||
etl::send_message(router, producer, message1);
|
||||
etl::send_message(producer, message1);
|
||||
CHECK_EQUAL(1, router.message1_count);
|
||||
CHECK_EQUAL(1, router.message2_count);
|
||||
CHECK_EQUAL(1, router.message4_count);
|
||||
CHECK_EQUAL(1, router.message_unknown_count);
|
||||
|
||||
etl::send_message(router, producer, message2);
|
||||
etl::send_message(producer, message2);
|
||||
CHECK_EQUAL(1, router.message1_count);
|
||||
CHECK_EQUAL(1, router.message2_count);
|
||||
CHECK_EQUAL(1, router.message4_count);
|
||||
CHECK_EQUAL(1, router.message_unknown_count);
|
||||
|
||||
etl::send_message(router, producer, message3);
|
||||
etl::send_message(producer, message3);
|
||||
CHECK_EQUAL(1, router.message1_count);
|
||||
CHECK_EQUAL(1, router.message2_count);
|
||||
CHECK_EQUAL(1, router.message4_count);
|
||||
CHECK_EQUAL(1, router.message_unknown_count);
|
||||
|
||||
etl::send_message(router, producer, message4);
|
||||
etl::send_message(producer, message4);
|
||||
CHECK_EQUAL(1, router.message1_count);
|
||||
CHECK_EQUAL(1, router.message2_count);
|
||||
CHECK_EQUAL(1, router.message4_count);
|
||||
@ -415,6 +418,13 @@ namespace
|
||||
{
|
||||
Router2 r2;
|
||||
|
||||
etl::null_message_router null_router;
|
||||
|
||||
Message1 message1(null_router);
|
||||
Message2 message2(null_router);
|
||||
Message3 message3(null_router);
|
||||
Message4 message4(null_router);
|
||||
|
||||
CHECK(r2.accepts(message1));
|
||||
CHECK(r2.accepts(message1.get_message_id()));
|
||||
|
||||
@ -444,6 +454,11 @@ namespace
|
||||
|
||||
etl::imessage* im;
|
||||
|
||||
Message1 message1(r1);
|
||||
Message2 message2(r1);
|
||||
Message3 message3(r1);
|
||||
Message4 message4(r1);
|
||||
|
||||
// Queue some messages in the message packet queue.
|
||||
im = &message1;
|
||||
queue.emplace(*im);
|
||||
@ -462,7 +477,7 @@ namespace
|
||||
queue.emplace(*im);
|
||||
|
||||
etl::imessage& imr1 = queue.front().get();
|
||||
r2.receive(r1, imr1);
|
||||
r2.receive(imr1);
|
||||
CHECK_EQUAL(1, r2.message1_count);
|
||||
CHECK_EQUAL(0, r2.message2_count);
|
||||
CHECK_EQUAL(0, r2.message4_count);
|
||||
@ -471,7 +486,7 @@ namespace
|
||||
queue.pop();
|
||||
|
||||
etl::imessage& imr2 = queue.front().get();
|
||||
r2.receive(r1, imr2);
|
||||
r2.receive(imr2);
|
||||
CHECK_EQUAL(1, r2.message1_count);
|
||||
CHECK_EQUAL(1, r2.message2_count);
|
||||
CHECK_EQUAL(0, r2.message4_count);
|
||||
@ -480,7 +495,7 @@ namespace
|
||||
queue.pop();
|
||||
|
||||
const etl::imessage& imr3 = queue.front().get();
|
||||
r2.receive(r1, imr3);
|
||||
r2.receive(imr3);
|
||||
CHECK_EQUAL(1, r2.message1_count);
|
||||
CHECK_EQUAL(1, r2.message2_count);
|
||||
CHECK_EQUAL(1, r2.message4_count);
|
||||
@ -490,7 +505,7 @@ namespace
|
||||
|
||||
const Queue& crqueue = queue;
|
||||
const etl::imessage& imr4 = crqueue.front().get();
|
||||
r2.receive(r1, imr4);
|
||||
r2.receive(imr4);
|
||||
CHECK_EQUAL(1, r2.message1_count);
|
||||
CHECK_EQUAL(1, r2.message2_count);
|
||||
CHECK_EQUAL(2, r2.message4_count);
|
||||
@ -505,6 +520,13 @@ namespace
|
||||
Router1 r1;
|
||||
Router2 r2;
|
||||
|
||||
etl::null_message_router null_router;
|
||||
|
||||
Message1 message1(r2);
|
||||
Message2 message2(r2);
|
||||
Message3 message3(r2);
|
||||
Message4 message4(r2);
|
||||
|
||||
r2.set_successor(r1);
|
||||
|
||||
etl::send_message(r2, message1);
|
||||
|
||||
@ -92,22 +92,22 @@ namespace
|
||||
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router&, const Message1&)
|
||||
void on_receive(const Message1&)
|
||||
{
|
||||
message1.push_back(ticks);
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router&, const Message2&)
|
||||
void on_receive(const Message2&)
|
||||
{
|
||||
message2.push_back(ticks);
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router&, const Message3&)
|
||||
void on_receive(const Message3&)
|
||||
{
|
||||
message3.push_back(ticks);
|
||||
}
|
||||
|
||||
void on_receive_unknown(etl::imessage_router&, const etl::imessage&)
|
||||
void on_receive_unknown(const etl::imessage&)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -80,17 +80,17 @@ namespace
|
||||
{
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router& source, const Message1& message)
|
||||
void on_receive(const Message1& message)
|
||||
{
|
||||
++count_message1;
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router& source, const Message2& message)
|
||||
void on_receive(const Message2& message)
|
||||
{
|
||||
++count_message2;
|
||||
}
|
||||
|
||||
void on_receive_unknown(etl::imessage_router& source, const etl::imessage& message)
|
||||
void on_receive_unknown(const etl::imessage& message)
|
||||
{
|
||||
|
||||
}
|
||||
@ -118,12 +118,12 @@ namespace
|
||||
{
|
||||
}
|
||||
|
||||
void on_receive(etl::imessage_router& source, const Message1& message)
|
||||
void on_receive(const Message1& message)
|
||||
{
|
||||
++count_message1;
|
||||
}
|
||||
|
||||
void on_receive_unknown(etl::imessage_router& source, const etl::imessage& message)
|
||||
void on_receive_unknown(const etl::imessage& message)
|
||||
{
|
||||
++count_unknown_message;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user