@@ -229,75 +229,16 @@ struct CallbackTyped : CallbackRawBaseSingle {
229229 }
230230
231231 template <typename ... Params>
232- void sendTuple (std::tuple<Params...> tup) {
233- using Trait = CBTraits<Args...>;
234- using MsgT = messaging::ParamMsg<typename Trait::TupleType>;
235- auto msg = vt::makeMessage<MsgT>();
236- msg->setParams (std::move (tup));
237- CallbackRawBaseSingle::sendMsg<MsgT>(msg);
238- }
232+ void sendTuple (std::tuple<Params...> tup);
239233
240234 template <typename ... Params>
241- void send (Params&&... params) {
242- using Trait = CBTraits<Args...>;
243- if constexpr (std::is_same_v<typename Trait::MsgT, NoMsg>) {
244- // We have to go through some tricky code to make the MsgProps case work
245- // If we use the type for Params to send, it's possible that we have a
246- // type mismatch in the actual handler type. A possible edge case is when
247- // a char const* is sent, but the handler is a std::string. In this case,
248- // the ParamMsg will be cast incorrectly during the virual dispatch to a
249- // collection because callbacks don't have the collection type. Thus, the
250- // wrong ParamMsg will be cast to which requires serialization, leading to
251- // a failure.
252- if constexpr (sizeof ...(Params) == sizeof ...(Args) + 1 ) {
253- using MsgT = messaging::ParamMsg<
254- std::tuple<
255- std::decay_t <std::tuple_element_t <0 , std::tuple<Params...>>>,
256- std::decay_t <Args>...
257- >
258- >;
259- auto msg = vt::makeMessage<MsgT>();
260- msg->setParams (std::forward<Params>(params)...);
261- CallbackRawBaseSingle::sendMsg<MsgT>(msg);
262- } else {
263- using MsgT = messaging::ParamMsg<typename Trait::TupleType>;
264- auto msg = vt::makeMessage<MsgT>();
265- msg->setParams (std::forward<Params>(params)...);
266- CallbackRawBaseSingle::sendMsg<MsgT>(msg);
267- }
268- } else {
269- using MsgT = typename Trait::MsgT;
270- auto msg = makeMessage<MsgT>(std::forward<Params>(params)...);
271- sendMsg (msg.get ());
272- }
273- }
274-
275- void send (typename CBTraits<Args...>::MsgT* msg) {
276- using MsgT = typename CBTraits<Args...>::MsgT;
277- if constexpr (not std::is_same_v<MsgT, NoMsg>) {
278- CallbackRawBaseSingle::sendMsg<MsgT>(msg);
279- }
280- }
235+ void send (Params&&... params);
281236
282237 template <typename MsgT>
283238 void send (messaging::MsgPtrThief<MsgT> msg) {
284239 CallbackRawBaseSingle::sendMsg<MsgT>(msg);
285240 }
286241
287- void sendMsg (messaging::MsgPtrThief<typename CBTraits<Args...>::MsgT> msg) {
288- using MsgT = typename CBTraits<Args...>::MsgT;
289- if constexpr (not std::is_same_v<MsgT, NoMsg>) {
290- CallbackRawBaseSingle::sendMsg<MsgT>(msg);
291- }
292- }
293-
294- void sendMsg (typename CBTraits<Args...>::MsgT* msg) {
295- using MsgT = typename CBTraits<Args...>::MsgT;
296- if constexpr (not std::is_same_v<MsgT, NoMsg>) {
297- CallbackRawBaseSingle::sendMsg<MsgT>(msg);
298- }
299- }
300-
301242 template <typename SerializerT>
302243 void serialize (SerializerT& s) {
303244 CallbackRawBaseSingle::serialize (s);
0 commit comments