64 using NoForcingTag = comms::details::tag::Tag1<>;
66 using ParsedOptionsInternal = details::MsgDispatcherOptionsParser<TOptions...>;
70 ParsedOptionsInternal::HasForcedDispatch
72 typename ParsedOptionsInternal::ForcedDispatch,
76 template <
typename TAllMessages,
typename TMsgId,
typename TMsg,
typename THandler>
77 static auto dispatchInternal(TMsgId&&
id, std::size_t idx, TMsg& msg, THandler& handler, NoForcingTag) ->
78 decltype(comms::dispatchMsg<TAllMessages>(std::forward<TMsgId>(
id), idx, msg, handler))
80 return comms::dispatchMsg<TAllMessages>(std::forward<TMsgId>(
id), idx, msg, handler);
83 template <
typename TAllMessages,
typename TMsgId,
typename TMsg,
typename THandler>
84 static auto dispatchInternal(TMsgId&&
id, TMsg& msg, THandler& handler, NoForcingTag) ->
85 decltype(comms::dispatchMsg<TAllMessages>(std::forward<TMsgId>(
id), msg, handler))
87 return comms::dispatchMsg<TAllMessages>(std::forward<TMsgId>(
id), msg, handler);
90 template <
typename TAllMessages,
typename TMsg,
typename THandler>
91 static auto dispatchInternal(TMsg& msg, THandler& handler, NoForcingTag) ->
92 decltype(comms::dispatchMsg<TAllMessages>(msg, handler))
94 return comms::dispatchMsg<TAllMessages>(msg, handler);
97 template <
typename TAllMessages,
typename TMsgId,
typename TMsg,
typename THandler>
99 decltype(comms::dispatchMsgPolymorphic<TAllMessages>(std::forward<TMsgId>(
id), idx, msg, handler))
101 return comms::dispatchMsgPolymorphic<TAllMessages>(std::forward<TMsgId>(
id), idx, msg, handler);
104 template <
typename TAllMessages,
typename TMsgId,
typename TMsg,
typename THandler>
106 decltype(comms::dispatchMsgPolymorphic<TAllMessages>(std::forward<TMsgId>(
id), msg, handler))
108 return comms::dispatchMsgPolymorphic<TAllMessages>(std::forward<TMsgId>(
id), msg, handler);
111 template <
typename TAllMessages,
typename TMsg,
typename THandler>
113 decltype(comms::dispatchMsgPolymorphic<TAllMessages>(msg, handler))
115 return comms::dispatchMsgPolymorphic<TAllMessages>(msg, handler);
118 template <
typename TAllMessages,
typename TMsgId,
typename TMsg,
typename THandler>
120 decltype(comms::dispatchMsgStaticBinSearch<TAllMessages>(std::forward<TMsgId>(
id), idx, msg, handler))
122 return comms::dispatchMsgStaticBinSearch<TAllMessages>(std::forward<TMsgId>(
id), idx, msg, handler);
125 template <
typename TAllMessages,
typename TMsgId,
typename TMsg,
typename THandler>
127 decltype(comms::dispatchMsgStaticBinSearch<TAllMessages>(std::forward<TMsgId>(
id), msg, handler))
129 return comms::dispatchMsgStaticBinSearch<TAllMessages>(std::forward<TMsgId>(
id), msg, handler);
132 template <
typename TAllMessages,
typename TMsg,
typename THandler>
134 decltype(comms::dispatchMsgStaticBinSearch<TAllMessages>(msg, handler))
136 return comms::dispatchMsgStaticBinSearch<TAllMessages>(msg, handler);
139 template <
typename TAllMessages,
typename TMsgId,
typename TMsg,
typename THandler>
141 decltype(comms::dispatchMsgLinearSwitch<TAllMessages>(std::forward<TMsgId>(
id), idx, msg, handler))
143 return comms::dispatchMsgLinearSwitch<TAllMessages>(std::forward<TMsgId>(
id), idx, msg, handler);
146 template <
typename TAllMessages,
typename TMsgId,
typename TMsg,
typename THandler>
148 decltype(comms::dispatchMsgLinearSwitch<TAllMessages>(std::forward<TMsgId>(
id), msg, handler))
150 return comms::dispatchMsgLinearSwitch<TAllMessages>(std::forward<TMsgId>(
id), msg, handler);
153 template <
typename TAllMessages,
typename TMsg,
typename THandler>
155 decltype(comms::dispatchMsgLinearSwitch<TAllMessages>(msg, handler))
157 return comms::dispatchMsgLinearSwitch<TAllMessages>(msg, handler);
160 template <
typename TAllMessages>
161 static constexpr bool isDispatchPolymorphicInternal(NoForcingTag)
163 return comms::dispatchMsgTypeIsPolymorphic<TAllMessages>();
166 template <
typename TAllMessages,
typename TTag>
167 static constexpr bool isDispatchPolymorphicInternal(TTag)
169 static_assert(!std::is_same<TTag, NoForcingTag>::value,
"Invalid tag dispatch");
170 return std::is_same<TTag, comms::traits::dispatch::Polymorphic>::value;
173 template <
typename TAllMessages>
174 static constexpr bool isDispatchStaticBinSearchInternal(NoForcingTag)
176 return comms::dispatchMsgTypeIsStaticBinSearch<TAllMessages>();
179 template <
typename TAllMessages,
typename TTag>
180 static constexpr bool isDispatchStaticBinSearchInternal(TTag)
182 static_assert(!std::is_same<TTag, NoForcingTag>::value,
"Invalid tag dispatch");
183 return std::is_same<TTag, comms::traits::dispatch::StaticBinSearch>::value;
186 template <
typename TAllMessages>
187 static constexpr bool isDispatchLinearSwitchInternal(NoForcingTag)
192 template <
typename TAllMessages,
typename TTag>
193 static constexpr bool isDispatchLinearSwitchInternal(TTag)
195 static_assert(!std::is_same<TTag, NoForcingTag>::value,
"Invalid tag dispatch");
196 return std::is_same<TTag, comms::traits::dispatch::LinearSwitch>::value;
216 template <
typename TAllMessages,
typename TMsgId,
typename TMsg,
typename THandler>
217 static auto dispatch(TMsgId&&
id, std::size_t idx, TMsg& msg, THandler& handler) ->
218 decltype(dispatchInternal<TAllMessages>(std::forward<TMsgId>(
id), idx, msg, handler, Tag()))
220 return dispatchInternal<TAllMessages>(std::forward<TMsgId>(
id), idx, msg, handler, Tag());
231 template <
typename TAllMessages,
typename TMsgId,
typename TMsg,
typename THandler>
232 static auto dispatch(TMsgId&&
id, TMsg&& msg, THandler&& handler) ->
233 decltype(dispatchInternal<TAllMessages>(std::forward<TMsgId>(
id), msg, handler, Tag()))
235 return dispatchInternal<TAllMessages>(std::forward<TMsgId>(
id), msg, handler, Tag());
249 template <
typename TAllMessages,
typename TMsg,
typename THandler>
250 static auto dispatch(TMsg&& msg, THandler&& handler) ->
251 decltype(dispatchInternal<TAllMessages>(msg, handler, Tag()))
253 return dispatchInternal<TAllMessages>(msg, handler, Tag());
261 template <
typename TAllMessages>
264 return isDispatchPolymorphicInternal<TAllMessages>(Tag());
272 template <
typename TAllMessages>
275 return isDispatchStaticBinSearchInternal<TAllMessages>(Tag());
283 template <
typename TAllMessages>
286 return isDispatchLinearSwitchInternal<TAllMessages>(Tag());