30#error THIS HEADER IS A GENERATOR. DO NOT INCLUDE.
51#ifndef ETL_MESSAGE_ROUTER_INCLUDED
52#define ETL_MESSAGE_ROUTER_INCLUDED
57#include "message_packet.h"
58#include "message_types.h"
79 message_router_exception(string_type reason_, string_type file_name_, numeric_type line_number_)
92 message_router_illegal_id(string_type file_name_, numeric_type line_number_)
93 : message_router_exception(ETL_ERROR_TEXT(
"message router:illegal id", ETL_MESSAGE_ROUTER_FILE_ID
"A"), file_name_, line_number_)
101 class imessage_router;
112 virtual ~imessage_router() {}
115 virtual bool is_null_router()
const = 0;
116 virtual bool is_producer()
const = 0;
117 virtual bool is_consumer()
const = 0;
120 virtual void receive(etl::message_router_id_t destination_router_id,
const etl::imessage& message)
122 if ((destination_router_id == get_message_router_id()) || (destination_router_id == imessage_router::ALL_MESSAGE_ROUTERS))
135 virtual void receive(etl::message_router_id_t destination_router_id,
etl::shared_message shared_msg)
137 if ((destination_router_id == get_message_router_id()) || (destination_router_id == imessage_router::ALL_MESSAGE_ROUTERS))
146 return accepts(msg.get_message_id());
150 etl::message_router_id_t get_message_router_id()
const
152 return message_router_id;
157 NULL_MESSAGE_ROUTER = 255,
159 ALL_MESSAGE_ROUTERS = 253,
160 MESSAGE_BROKER = 252,
161 MESSAGE_ROUTER = 251,
162 MAX_MESSAGE_ROUTER = 249
167 imessage_router(etl::message_router_id_t id_)
168 : message_router_id(id_)
172 imessage_router(etl::message_router_id_t id_, imessage_router& successor_)
174 , message_router_id(id_)
181 imessage_router(
const imessage_router&);
182 imessage_router& operator =(
const imessage_router&);
184 etl::message_router_id_t message_router_id;
190 class null_message_router :
public imessage_router
195 null_message_router()
196 : imessage_router(imessage_router::NULL_MESSAGE_ROUTER)
202 : imessage_router(imessage_router::NULL_MESSAGE_ROUTER,
successor)
207 using etl::imessage_router::receive;
218 using etl::imessage_router::accepts;
233 ETL_DEPRECATED
bool is_null_router() const ETL_OVERRIDE
239 bool is_producer() const ETL_OVERRIDE
245 bool is_consumer() const ETL_OVERRIDE
251 static null_message_router& instance()
253 static null_message_router nmr;
262 return etl::null_message_router::instance();
268 class message_producer :
public imessage_router
274 : imessage_router(
etl::imessage_router::MESSAGE_ROUTER)
280 : imessage_router(imessage_router::NULL_MESSAGE_ROUTER,
successor)
285 message_producer(etl::message_router_id_t id_)
286 : imessage_router(id_)
299 using etl::imessage_router::receive;
310 using etl::imessage_router::accepts;
325 ETL_DEPRECATED
bool is_null_router() const ETL_OVERRIDE
331 bool is_producer() const ETL_OVERRIDE
337 bool is_consumer() const ETL_OVERRIDE
349 destination.receive(message);
365 etl::message_router_id_t
id,
368 destination.receive(
id,
message);
375 etl::message_router_id_t
id,
378 destination.receive(
id, message);
384#if ETL_USING_CPP17 && !defined(ETL_MESSAGE_ROUTER_FORCE_CPP03_IMPLEMENTATION)
388 template <
typename TDerived,
typename... TMessageTypes>
389 class message_router :
public imessage_router
397 : imessage_router(
etl::imessage_router::MESSAGE_ROUTER)
403 : imessage_router(
etl::imessage_router::MESSAGE_ROUTER, successor_)
408 message_router(etl::message_router_id_t id_)
409 : imessage_router(id_)
416 : imessage_router(id_, successor_)
422 using etl::imessage_router::receive;
426 const bool was_handled = (receive_message_type<TMessageTypes>(msg) || ...);
436 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
441 template <typename TMessage, typename etl::enable_if<etl::is_base_of<imessage, TMessage>::value,
int>::type = 0>
442 void receive(
const TMessage& msg)
446 static_cast<TDerived*
>(
this)->on_receive(msg);
456 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
462 using imessage_router::accepts;
466 return (accepts_type<TMessageTypes>(
id) || ...);
470 ETL_DEPRECATED
bool is_null_router() const ETL_OVERRIDE
476 bool is_producer() const ETL_OVERRIDE
482 bool is_consumer() const ETL_OVERRIDE
490 template <
typename TMessage>
493 if (TMessage::ID == msg.get_message_id())
495 static_cast<TDerived*
>(
this)->on_receive(
static_cast<const TMessage&
>(msg));
505 template <
typename TMessage>
508 if (TMessage::ID ==
id)
532 template <
typename TDerived,
533 typename T1,
typename T2 = void,
typename T3 = void,
typename T4 = void,
534 typename T5 = void,
typename T6 = void,
typename T7 = void,
typename T8 = void,
535 typename T9 = void,
typename T10 = void,
typename T11 = void,
typename T12 = void,
536 typename T13 = void,
typename T14 = void,
typename T15 = void,
typename T16 =
void>
541 typedef etl::message_packet<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> message_packet;
570 using etl::imessage_router::receive;
578 case T1::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T1&
>(msg));
break;
579 case T2::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T2&
>(msg));
break;
580 case T3::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T3&
>(msg));
break;
581 case T4::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T4&
>(msg));
break;
582 case T5::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T5&
>(msg));
break;
583 case T6::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T6&
>(msg));
break;
584 case T7::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T7&
>(msg));
break;
585 case T8::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T8&
>(msg));
break;
586 case T9::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T9&
>(msg));
break;
587 case T10::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T10&
>(msg));
break;
588 case T11::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T11&
>(msg));
break;
589 case T12::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T12&
>(msg));
break;
590 case T13::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T13&
>(msg));
break;
591 case T14::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T14&
>(msg));
break;
592 case T15::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T15&
>(msg));
break;
593 case T16::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T16&
>(msg));
break;
602 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
609 template <
typename TMessage>
610 typename etl::enable_if<etl::is_base_of<imessage, TMessage>::value &&
etl::is_one_of<TMessage, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::value,
void>::type
611 receive(
const TMessage& msg)
613 static_cast<TDerived*
>(
this)->on_receive(msg);
616 template <
typename TMessage>
617 typename etl::enable_if<etl::is_base_of<imessage, TMessage>::value && !
etl::is_one_of<TMessage, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::value,
void>::type
618 receive(
const TMessage& msg)
626 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
631 using imessage_router::accepts;
637 case T1::ID:
case T2::ID:
case T3::ID:
case T4::ID:
case T5::ID:
case T6::ID:
case T7::ID:
case T8::ID:
638 case T9::ID:
case T10::ID:
case T11::ID:
case T12::ID:
case T13::ID:
case T14::ID:
case T15::ID:
case T16::ID:
655 ETL_DEPRECATED
bool is_null_router()
const ETL_OVERRIDE
661 bool is_producer()
const ETL_OVERRIDE
667 bool is_consumer()
const ETL_OVERRIDE
676 template <
typename TDerived,
677 typename T1,
typename T2,
typename T3,
typename T4,
678 typename T5,
typename T6,
typename T7,
typename T8,
679 typename T9,
typename T10,
typename T11,
typename T12,
680 typename T13,
typename T14,
typename T15>
681 class message_router<TDerived, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, void>
686 typedef etl::message_packet<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> message_packet;
715 using etl::imessage_router::receive;
719 const size_t id = msg.get_message_id();
723 case T1::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T1&
>(msg));
break;
724 case T2::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T2&
>(msg));
break;
725 case T3::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T3&
>(msg));
break;
726 case T4::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T4&
>(msg));
break;
727 case T5::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T5&
>(msg));
break;
728 case T6::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T6&
>(msg));
break;
729 case T7::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T7&
>(msg));
break;
730 case T8::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T8&
>(msg));
break;
731 case T9::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T9&
>(msg));
break;
732 case T10::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T10&
>(msg));
break;
733 case T11::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T11&
>(msg));
break;
734 case T12::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T12&
>(msg));
break;
735 case T13::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T13&
>(msg));
break;
736 case T14::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T14&
>(msg));
break;
737 case T15::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T15&
>(msg));
break;
746 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
753 template <
typename TMessage>
754 typename etl::enable_if<etl::is_base_of<imessage, TMessage>::value &&
etl::is_one_of<TMessage, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>::value,
void>::type
755 receive(
const TMessage& msg)
757 static_cast<TDerived*
>(
this)->on_receive(msg);
760 template <
typename TMessage>
761 typename etl::enable_if<etl::is_base_of<imessage, TMessage>::value && !
etl::is_one_of<TMessage, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>::value,
void>::type
762 receive(
const TMessage& msg)
770 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
776 using imessage_router::accepts;
782 case T1::ID:
case T2::ID:
case T3::ID:
case T4::ID:
case T5::ID:
case T6::ID:
case T7::ID:
case T8::ID:
783 case T9::ID:
case T10::ID:
case T11::ID:
case T12::ID:
case T13::ID:
case T14::ID:
case T15::ID:
800 ETL_DEPRECATED
bool is_null_router()
const ETL_OVERRIDE
806 bool is_producer()
const ETL_OVERRIDE
812 bool is_consumer()
const ETL_OVERRIDE
821 template <
typename TDerived,
822 typename T1,
typename T2,
typename T3,
typename T4,
823 typename T5,
typename T6,
typename T7,
typename T8,
824 typename T9,
typename T10,
typename T11,
typename T12,
825 typename T13,
typename T14>
826 class message_router<TDerived, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, void, void>
831 typedef etl::message_packet<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> message_packet;
860 using etl::imessage_router::receive;
864 const size_t id = msg.get_message_id();
868 case T1::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T1&
>(msg));
break;
869 case T2::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T2&
>(msg));
break;
870 case T3::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T3&
>(msg));
break;
871 case T4::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T4&
>(msg));
break;
872 case T5::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T5&
>(msg));
break;
873 case T6::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T6&
>(msg));
break;
874 case T7::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T7&
>(msg));
break;
875 case T8::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T8&
>(msg));
break;
876 case T9::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T9&
>(msg));
break;
877 case T10::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T10&
>(msg));
break;
878 case T11::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T11&
>(msg));
break;
879 case T12::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T12&
>(msg));
break;
880 case T13::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T13&
>(msg));
break;
881 case T14::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T14&
>(msg));
break;
890 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
897 template <
typename TMessage>
898 typename etl::enable_if<etl::is_base_of<imessage, TMessage>::value &&
etl::is_one_of<TMessage, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>::value,
void>::type
899 receive(
const TMessage& msg)
901 static_cast<TDerived*
>(
this)->on_receive(msg);
904 template <
typename TMessage>
905 typename etl::enable_if<etl::is_base_of<imessage, TMessage>::value && !
etl::is_one_of<TMessage, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>::value,
void>::type
906 receive(
const TMessage& msg)
914 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
920 using imessage_router::accepts;
926 case T1::ID:
case T2::ID:
case T3::ID:
case T4::ID:
case T5::ID:
case T6::ID:
case T7::ID:
case T8::ID:
927 case T9::ID:
case T10::ID:
case T11::ID:
case T12::ID:
case T13::ID:
case T14::ID:
944 ETL_DEPRECATED
bool is_null_router()
const ETL_OVERRIDE
950 bool is_producer()
const ETL_OVERRIDE
956 bool is_consumer()
const ETL_OVERRIDE
965 template <
typename TDerived,
966 typename T1,
typename T2,
typename T3,
typename T4,
967 typename T5,
typename T6,
typename T7,
typename T8,
968 typename T9,
typename T10,
typename T11,
typename T12,
970 class message_router<TDerived, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, void, void, void>
975 typedef etl::message_packet<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> message_packet;
1004 using etl::imessage_router::receive;
1008 const size_t id = msg.get_message_id();
1012 case T1::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T1&
>(msg));
break;
1013 case T2::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T2&
>(msg));
break;
1014 case T3::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T3&
>(msg));
break;
1015 case T4::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T4&
>(msg));
break;
1016 case T5::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T5&
>(msg));
break;
1017 case T6::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T6&
>(msg));
break;
1018 case T7::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T7&
>(msg));
break;
1019 case T8::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T8&
>(msg));
break;
1020 case T9::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T9&
>(msg));
break;
1021 case T10::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T10&
>(msg));
break;
1022 case T11::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T11&
>(msg));
break;
1023 case T12::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T12&
>(msg));
break;
1024 case T13::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T13&
>(msg));
break;
1033 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
1040 template <
typename TMessage>
1041 typename etl::enable_if<etl::is_base_of<imessage, TMessage>::value &&
etl::is_one_of<TMessage, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>::value,
void>::type
1042 receive(
const TMessage& msg)
1044 static_cast<TDerived*
>(
this)->on_receive(msg);
1047 template <
typename TMessage>
1048 typename etl::enable_if<etl::is_base_of<imessage, TMessage>::value && !
etl::is_one_of<TMessage, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>::value,
void>::type
1049 receive(
const TMessage& msg)
1057 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
1063 using imessage_router::accepts;
1069 case T1::ID:
case T2::ID:
case T3::ID:
case T4::ID:
case T5::ID:
case T6::ID:
case T7::ID:
case T8::ID:
1070 case T9::ID:
case T10::ID:
case T11::ID:
case T12::ID:
case T13::ID:
1087 ETL_DEPRECATED
bool is_null_router()
const ETL_OVERRIDE
1093 bool is_producer()
const ETL_OVERRIDE
1099 bool is_consumer()
const ETL_OVERRIDE
1108 template <
typename TDerived,
1109 typename T1,
typename T2,
typename T3,
typename T4,
1110 typename T5,
typename T6,
typename T7,
typename T8,
1111 typename T9,
typename T10,
typename T11,
typename T12>
1112 class message_router<TDerived, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, void, void, void, void>
1117 typedef etl::message_packet<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> message_packet;
1146 using etl::imessage_router::receive;
1150 const size_t id = msg.get_message_id();
1154 case T1::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T1&
>(msg));
break;
1155 case T2::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T2&
>(msg));
break;
1156 case T3::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T3&
>(msg));
break;
1157 case T4::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T4&
>(msg));
break;
1158 case T5::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T5&
>(msg));
break;
1159 case T6::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T6&
>(msg));
break;
1160 case T7::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T7&
>(msg));
break;
1161 case T8::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T8&
>(msg));
break;
1162 case T9::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T9&
>(msg));
break;
1163 case T10::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T10&
>(msg));
break;
1164 case T11::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T11&
>(msg));
break;
1165 case T12::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T12&
>(msg));
break;
1174 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
1181 template <
typename TMessage>
1182 typename etl::enable_if<etl::is_base_of<imessage, TMessage>::value &&
etl::is_one_of<TMessage, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>::value,
void>::type
1183 receive(
const TMessage& msg)
1185 static_cast<TDerived*
>(
this)->on_receive(msg);
1188 template <
typename TMessage>
1189 typename etl::enable_if<etl::is_base_of<imessage, TMessage>::value && !
etl::is_one_of<TMessage, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>::value,
void>::type
1190 receive(
const TMessage& msg)
1198 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
1204 using imessage_router::accepts;
1210 case T1::ID:
case T2::ID:
case T3::ID:
case T4::ID:
case T5::ID:
case T6::ID:
case T7::ID:
case T8::ID:
1211 case T9::ID:
case T10::ID:
case T11::ID:
case T12::ID:
1228 ETL_DEPRECATED
bool is_null_router()
const ETL_OVERRIDE
1234 bool is_producer()
const ETL_OVERRIDE
1240 bool is_consumer()
const ETL_OVERRIDE
1249 template <
typename TDerived,
1250 typename T1,
typename T2,
typename T3,
typename T4,
1251 typename T5,
typename T6,
typename T7,
typename T8,
1252 typename T9,
typename T10,
typename T11>
1253 class message_router<TDerived, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, void, void, void, void, void>
1258 typedef etl::message_packet<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> message_packet;
1287 using etl::imessage_router::receive;
1291 const size_t id = msg.get_message_id();
1295 case T1::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T1&
>(msg));
break;
1296 case T2::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T2&
>(msg));
break;
1297 case T3::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T3&
>(msg));
break;
1298 case T4::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T4&
>(msg));
break;
1299 case T5::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T5&
>(msg));
break;
1300 case T6::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T6&
>(msg));
break;
1301 case T7::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T7&
>(msg));
break;
1302 case T8::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T8&
>(msg));
break;
1303 case T9::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T9&
>(msg));
break;
1304 case T10::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T10&
>(msg));
break;
1305 case T11::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T11&
>(msg));
break;
1314 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
1321 template <
typename TMessage>
1322 typename etl::enable_if<etl::is_base_of<imessage, TMessage>::value &&
etl::is_one_of<TMessage, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>::value,
void>::type
1323 receive(
const TMessage& msg)
1325 static_cast<TDerived*
>(
this)->on_receive(msg);
1328 template <
typename TMessage>
1329 typename etl::enable_if<etl::is_base_of<imessage, TMessage>::value && !
etl::is_one_of<TMessage, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>::value,
void>::type
1330 receive(
const TMessage& msg)
1338 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
1344 using imessage_router::accepts;
1350 case T1::ID:
case T2::ID:
case T3::ID:
case T4::ID:
case T5::ID:
case T6::ID:
case T7::ID:
case T8::ID:
1351 case T9::ID:
case T10::ID:
case T11::ID:
1368 ETL_DEPRECATED
bool is_null_router()
const ETL_OVERRIDE
1374 bool is_producer()
const ETL_OVERRIDE
1380 bool is_consumer()
const ETL_OVERRIDE
1389 template <
typename TDerived,
1390 typename T1,
typename T2,
typename T3,
typename T4,
1391 typename T5,
typename T6,
typename T7,
typename T8,
1392 typename T9,
typename T10>
1393 class message_router<TDerived, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, void, void, void, void, void, void>
1427 using etl::imessage_router::receive;
1431 const size_t id = msg.get_message_id();
1435 case T1::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T1&
>(msg));
break;
1436 case T2::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T2&
>(msg));
break;
1437 case T3::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T3&
>(msg));
break;
1438 case T4::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T4&
>(msg));
break;
1439 case T5::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T5&
>(msg));
break;
1440 case T6::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T6&
>(msg));
break;
1441 case T7::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T7&
>(msg));
break;
1442 case T8::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T8&
>(msg));
break;
1443 case T9::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T9&
>(msg));
break;
1444 case T10::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T10&
>(msg));
break;
1453 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
1460 template <
typename TMessage>
1461 typename etl::enable_if<etl::is_base_of<imessage, TMessage>::value &&
etl::is_one_of<TMessage, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::value,
void>::type
1462 receive(
const TMessage& msg)
1464 static_cast<TDerived*
>(
this)->on_receive(msg);
1467 template <
typename TMessage>
1468 typename etl::enable_if<etl::is_base_of<imessage, TMessage>::value && !
etl::is_one_of<TMessage, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::value,
void>::type
1469 receive(
const TMessage& msg)
1477 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
1483 using imessage_router::accepts;
1489 case T1::ID:
case T2::ID:
case T3::ID:
case T4::ID:
case T5::ID:
case T6::ID:
case T7::ID:
case T8::ID:
1490 case T9::ID:
case T10::ID:
1507 ETL_DEPRECATED
bool is_null_router()
const ETL_OVERRIDE
1513 bool is_producer()
const ETL_OVERRIDE
1519 bool is_consumer()
const ETL_OVERRIDE
1528 template <
typename TDerived,
1529 typename T1,
typename T2,
typename T3,
typename T4,
1530 typename T5,
typename T6,
typename T7,
typename T8,
1532 class message_router<TDerived, T1, T2, T3, T4, T5, T6, T7, T8, T9, void, void, void, void, void, void, void>
1566 using etl::imessage_router::receive;
1570 const size_t id = msg.get_message_id();
1574 case T1::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T1&
>(msg));
break;
1575 case T2::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T2&
>(msg));
break;
1576 case T3::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T3&
>(msg));
break;
1577 case T4::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T4&
>(msg));
break;
1578 case T5::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T5&
>(msg));
break;
1579 case T6::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T6&
>(msg));
break;
1580 case T7::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T7&
>(msg));
break;
1581 case T8::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T8&
>(msg));
break;
1582 case T9::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T9&
>(msg));
break;
1591 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
1598 template <
typename TMessage>
1599 typename etl::enable_if<etl::is_base_of<imessage, TMessage>::value &&
etl::is_one_of<TMessage, T1, T2, T3, T4, T5, T6, T7, T8, T9>::value,
void>::type
1600 receive(
const TMessage& msg)
1602 static_cast<TDerived*
>(
this)->on_receive(msg);
1605 template <
typename TMessage>
1606 typename etl::enable_if<etl::is_base_of<imessage, TMessage>::value && !
etl::is_one_of<TMessage, T1, T2, T3, T4, T5, T6, T7, T8, T9>::value,
void>::type
1607 receive(
const TMessage& msg)
1615 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
1621 using imessage_router::accepts;
1627 case T1::ID:
case T2::ID:
case T3::ID:
case T4::ID:
case T5::ID:
case T6::ID:
case T7::ID:
case T8::ID:
1645 ETL_DEPRECATED
bool is_null_router()
const ETL_OVERRIDE
1651 bool is_producer()
const ETL_OVERRIDE
1657 bool is_consumer()
const ETL_OVERRIDE
1666 template <
typename TDerived,
1667 typename T1,
typename T2,
typename T3,
typename T4,
1668 typename T5,
typename T6,
typename T7,
typename T8>
1669 class message_router<TDerived, T1, T2, T3, T4, T5, T6, T7, T8, void, void, void, void, void, void, void, void>
1703 using etl::imessage_router::receive;
1707 const size_t id = msg.get_message_id();
1711 case T1::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T1&
>(msg));
break;
1712 case T2::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T2&
>(msg));
break;
1713 case T3::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T3&
>(msg));
break;
1714 case T4::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T4&
>(msg));
break;
1715 case T5::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T5&
>(msg));
break;
1716 case T6::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T6&
>(msg));
break;
1717 case T7::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T7&
>(msg));
break;
1718 case T8::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T8&
>(msg));
break;
1727 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
1734 template <
typename TMessage>
1735 typename etl::enable_if<etl::is_base_of<imessage, TMessage>::value &&
etl::is_one_of<TMessage, T1, T2, T3, T4, T5, T6, T7, T8>::value,
void>::type
1736 receive(
const TMessage& msg)
1738 static_cast<TDerived*
>(
this)->on_receive(msg);
1741 template <
typename TMessage>
1742 typename etl::enable_if<etl::is_base_of<imessage, TMessage>::value && !
etl::is_one_of<TMessage, T1, T2, T3, T4, T5, T6, T7, T8>::value,
void>::type
1743 receive(
const TMessage& msg)
1751 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
1757 using imessage_router::accepts;
1763 case T1::ID:
case T2::ID:
case T3::ID:
case T4::ID:
case T5::ID:
case T6::ID:
case T7::ID:
case T8::ID:
1781 ETL_DEPRECATED
bool is_null_router()
const ETL_OVERRIDE
1787 bool is_producer()
const ETL_OVERRIDE
1793 bool is_consumer()
const ETL_OVERRIDE
1802 template <
typename TDerived,
1803 typename T1,
typename T2,
typename T3,
typename T4,
1804 typename T5,
typename T6,
typename T7>
1805 class message_router<TDerived, T1, T2, T3, T4, T5, T6, T7, void, void, void, void, void, void, void, void, void>
1839 using etl::imessage_router::receive;
1843 const size_t id = msg.get_message_id();
1847 case T1::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T1&
>(msg));
break;
1848 case T2::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T2&
>(msg));
break;
1849 case T3::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T3&
>(msg));
break;
1850 case T4::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T4&
>(msg));
break;
1851 case T5::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T5&
>(msg));
break;
1852 case T6::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T6&
>(msg));
break;
1853 case T7::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T7&
>(msg));
break;
1862 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
1869 template <
typename TMessage>
1871 receive(
const TMessage& msg)
1873 static_cast<TDerived*
>(
this)->on_receive(msg);
1876 template <
typename TMessage>
1878 receive(
const TMessage& msg)
1886 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
1892 using imessage_router::accepts;
1898 case T1::ID:
case T2::ID:
case T3::ID:
case T4::ID:
case T5::ID:
case T6::ID:
case T7::ID:
1915 ETL_DEPRECATED
bool is_null_router()
const ETL_OVERRIDE
1921 bool is_producer()
const ETL_OVERRIDE
1927 bool is_consumer()
const ETL_OVERRIDE
1936 template <
typename TDerived,
1937 typename T1,
typename T2,
typename T3,
typename T4,
1938 typename T5,
typename T6>
1939 class message_router<TDerived, T1, T2, T3, T4, T5, T6, void, void, void, void, void, void, void, void, void, void>
1973 using etl::imessage_router::receive;
1977 const size_t id = msg.get_message_id();
1981 case T1::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T1&
>(msg));
break;
1982 case T2::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T2&
>(msg));
break;
1983 case T3::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T3&
>(msg));
break;
1984 case T4::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T4&
>(msg));
break;
1985 case T5::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T5&
>(msg));
break;
1986 case T6::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T6&
>(msg));
break;
1995 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
2002 template <
typename TMessage>
2004 receive(
const TMessage& msg)
2006 static_cast<TDerived*
>(
this)->on_receive(msg);
2009 template <
typename TMessage>
2011 receive(
const TMessage& msg)
2019 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
2025 using imessage_router::accepts;
2031 case T1::ID:
case T2::ID:
case T3::ID:
case T4::ID:
case T5::ID:
case T6::ID:
2048 ETL_DEPRECATED
bool is_null_router()
const ETL_OVERRIDE
2054 bool is_producer()
const ETL_OVERRIDE
2060 bool is_consumer()
const ETL_OVERRIDE
2069 template <
typename TDerived,
2070 typename T1,
typename T2,
typename T3,
typename T4,
2072 class message_router<TDerived, T1, T2, T3, T4, T5, void, void, void, void, void, void, void, void, void, void, void>
2106 using etl::imessage_router::receive;
2110 const size_t id = msg.get_message_id();
2114 case T1::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T1&
>(msg));
break;
2115 case T2::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T2&
>(msg));
break;
2116 case T3::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T3&
>(msg));
break;
2117 case T4::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T4&
>(msg));
break;
2118 case T5::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T5&
>(msg));
break;
2127 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
2134 template <
typename TMessage>
2136 receive(
const TMessage& msg)
2138 static_cast<TDerived*
>(
this)->on_receive(msg);
2141 template <
typename TMessage>
2143 receive(
const TMessage& msg)
2151 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
2157 using imessage_router::accepts;
2163 case T1::ID:
case T2::ID:
case T3::ID:
case T4::ID:
case T5::ID:
2180 ETL_DEPRECATED
bool is_null_router()
const ETL_OVERRIDE
2186 bool is_producer()
const ETL_OVERRIDE
2192 bool is_consumer()
const ETL_OVERRIDE
2201 template <
typename TDerived,
2202 typename T1,
typename T2,
typename T3,
typename T4>
2203 class message_router<TDerived, T1, T2, T3, T4, void, void, void, void, void, void, void, void, void, void, void, void>
2237 using etl::imessage_router::receive;
2241 const size_t id = msg.get_message_id();
2245 case T1::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T1&
>(msg));
break;
2246 case T2::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T2&
>(msg));
break;
2247 case T3::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T3&
>(msg));
break;
2248 case T4::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T4&
>(msg));
break;
2257 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
2264 template <
typename TMessage>
2266 receive(
const TMessage& msg)
2268 static_cast<TDerived*
>(
this)->on_receive(msg);
2271 template <
typename TMessage>
2273 receive(
const TMessage& msg)
2281 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
2287 using imessage_router::accepts;
2293 case T1::ID:
case T2::ID:
case T3::ID:
case T4::ID:
2310 ETL_DEPRECATED
bool is_null_router()
const ETL_OVERRIDE
2316 bool is_producer()
const ETL_OVERRIDE
2322 bool is_consumer()
const ETL_OVERRIDE
2331 template <
typename TDerived,
2332 typename T1,
typename T2,
typename T3>
2333 class message_router<TDerived, T1, T2, T3, void, void, void, void, void, void, void, void, void, void, void, void, void>
2367 using etl::imessage_router::receive;
2371 const size_t id = msg.get_message_id();
2375 case T1::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T1&
>(msg));
break;
2376 case T2::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T2&
>(msg));
break;
2377 case T3::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T3&
>(msg));
break;
2386 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
2393 template <
typename TMessage>
2395 receive(
const TMessage& msg)
2397 static_cast<TDerived*
>(
this)->on_receive(msg);
2400 template <
typename TMessage>
2402 receive(
const TMessage& msg)
2410 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
2416 using imessage_router::accepts;
2422 case T1::ID:
case T2::ID:
case T3::ID:
2439 ETL_DEPRECATED
bool is_null_router()
const ETL_OVERRIDE
2445 bool is_producer()
const ETL_OVERRIDE
2451 bool is_consumer()
const ETL_OVERRIDE
2460 template <
typename TDerived,
2461 typename T1,
typename T2>
2462 class message_router<TDerived, T1, T2, void, void, void, void, void, void, void, void, void, void, void, void, void, void>
2496 using etl::imessage_router::receive;
2500 const size_t id = msg.get_message_id();
2504 case T1::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T1&
>(msg));
break;
2505 case T2::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T2&
>(msg));
break;
2514 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
2521 template <
typename TMessage>
2523 receive(
const TMessage& msg)
2525 static_cast<TDerived*
>(
this)->on_receive(msg);
2528 template <
typename TMessage>
2530 receive(
const TMessage& msg)
2538 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
2544 using imessage_router::accepts;
2550 case T1::ID:
case T2::ID:
2567 ETL_DEPRECATED
bool is_null_router()
const ETL_OVERRIDE
2573 bool is_producer()
const ETL_OVERRIDE
2579 bool is_consumer()
const ETL_OVERRIDE
2588 template <
typename TDerived,
2590 class message_router<TDerived, T1, void, void, void, void, void, void, void, void, void, void, void, void, void, void, void>
2624 using etl::imessage_router::receive;
2628 const size_t id = msg.get_message_id();
2632 case T1::ID:
static_cast<TDerived*
>(
this)->on_receive(
static_cast<const T1&
>(msg));
break;
2641 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
2648 template <
typename TMessage>
2650 receive(
const TMessage& msg)
2652 static_cast<TDerived*
>(
this)->on_receive(msg);
2655 template <
typename TMessage>
2657 receive(
const TMessage& msg)
2665 static_cast<TDerived*
>(
this)->on_receive_unknown(msg);
2671 using imessage_router::accepts;
2694 ETL_DEPRECATED
bool is_null_router()
const ETL_OVERRIDE
2700 bool is_producer()
const ETL_OVERRIDE
2706 bool is_consumer()
const ETL_OVERRIDE
This is the base of all message routers.
Definition: message_router_generator.h:121
Definition: message_packet.h:335
Base exception class for message router.
Definition: message_router_generator.h:88
Router id is out of the legal range.
Definition: message_router_generator.h:101
Definition: message_router.h:538
Definition: shared_message.h:49
ETL_NODISCARD etl::imessage & get_message()
Get a reference to the contained message.
Definition: shared_message.h:159
Adds successor traits to a class.
Definition: successor.h:73
bool has_successor() const
Does this have a successor?
Definition: successor.h:184
successor_type & get_successor() const
Definition: successor.h:174
successor()
Default constructor.
Definition: successor.h:81
#define ETL_ASSERT(b, e)
Definition: error_handler.h:316
ETL_CONSTEXPR exception(string_type reason_, string_type, numeric_type line_)
Constructor.
Definition: exception.h:69
Definition: exception.h:47
enable_if
Definition: type_traits_generator.h:1191
bitset_ext
Definition: absolute.h:38
etl::imessage_router & get_null_message_router()
null message router functionality.
Definition: message_router_generator.h:272
uint_least8_t message_id_t
Allow alternative type for message id.
Definition: message_types.h:40
Definition: type_traits.h:1376