52 template <typename TMessage>
53 void handle(TMessage& msg)
55 beginMsgHandlingImpl(msg);
56 addExtraTransportFieldsInternal(msg);
57 auto& fields = msg.fields();
58 comms::util::tupleForEach(
60 FieldsWrapperCreateHelper(
63 addFieldImpl(std::move(wrapper));
85 class FieldsWrapperCreateHelper
89 FieldsWrapperCreateHelper(WrapperDispatchFunc&& dispatchOp)
90 : m_dispatchOp(std::move(dispatchOp))
94 template <
typename TField>
95 void operator()(TField&& field)
98 details::FieldWrapperCreator::createWrapper(
99 std::forward<TField>(field));
100 m_dispatchOp(std::move(wraper));
104 WrapperDispatchFunc m_dispatchOp;
107 struct HasExtraTransportFieldsTag {};
108 struct NoExtraTransportFieldsTag {};
110 template <
typename TMessage>
111 void addExtraTransportFieldsInternal(TMessage& msg)
113 using MessageType =
typename std::decay<
decltype(msg)>::type;
115 typename std::conditional<
116 MessageType::hasTransportFields(),
117 HasExtraTransportFieldsTag,
118 NoExtraTransportFieldsTag
121 addExtraTransportFieldsInternal(msg, Tag());
124 template <
typename TMessage>
125 void addExtraTransportFieldsInternal(TMessage&, NoExtraTransportFieldsTag)
130 template <
typename TMessage>
131 void addExtraTransportFieldsInternal(TMessage& msg, HasExtraTransportFieldsTag)
133 auto& fields = msg.transportFields();
134 comms::util::tupleForEach(
136 FieldsWrapperCreateHelper(
137 [
this](FieldWrapperPtr wrapper)
139 addExtraTransportFieldImpl(std::move(wrapper));