10#include "comms/details/detect.h"
21template <
typename T,
bool THasImpl>
22struct ProtocolLayerHasFieldsImplHelper;
25struct ProtocolLayerHasFieldsImplHelper<T, true>
27 static const bool Value = T::hasFields();
31struct ProtocolLayerHasFieldsImplHelper<T, false>
33 static const bool Value =
false;
37struct ProtocolLayerHasFieldsImpl
39 static const bool Value =
40 ProtocolLayerHasFieldsImplHelper<T, comms::details::hasImplOptions<T>()>::Value;
44constexpr bool protocolLayerHasFieldsImpl()
46 return ProtocolLayerHasFieldsImpl<T>::Value;
49template <
typename T,
bool THasImpl>
50struct ProtocolLayerHasDoGetIdHelper;
53struct ProtocolLayerHasDoGetIdHelper<T, true>
55 static const bool Value = T::hasStaticMsgId();
59struct ProtocolLayerHasDoGetIdHelper<T, false>
61 static const bool Value =
false;
65struct ProtocolLayerHasDoGetId
67 static const bool Value =
68 ProtocolLayerHasDoGetIdHelper<T, comms::details::hasImplOptions<T>()>::Value;
72constexpr bool protocolLayerHasDoGetId()
74 return ProtocolLayerHasDoGetId<T>::Value;
77template <
class T,
class R =
void>
78struct ProtocolLayerEnableIfHasMsgPtr {
using Type = R; };
80template <
class T,
class Enable =
void>
81struct ProtocolLayerMsgPtr
87struct ProtocolLayerMsgPtr<T, typename ProtocolLayerEnableIfHasMsgPtr<typename T::MsgPtr>::Type>
89 using Type =
typename T::MsgPtr;
93class MissingSizeRetriever
96 MissingSizeRetriever(std::size_t& val) : value_(val) {}
98 void setValue(std::size_t val)
108struct IsMissingSizeRetrieverHelper
110 static const bool Value =
false;
113template <
typename... TParams>
114struct IsMissingSizeRetrieverHelper<MissingSizeRetriever<TParams...> >
116 static const bool Value =
true;
120constexpr bool isMissingSizeRetriever()
122 return IsMissingSizeRetrieverHelper<T>::Value;
125template <
typename TId>
129 MsgIdRetriever(TId& val) : value_(val) {}
131 template <
typename U>
132 void setValue(U&& val)
134 value_ =
static_cast<TId
>(val);
142struct IsMsgIdRetrieverHelper
144 static const bool Value =
false;
147template <
typename TId>
148struct IsMsgIdRetrieverHelper<MsgIdRetriever<TId> >
150 static const bool Value =
true;
154constexpr bool isMsgIdRetriever()
156 return IsMsgIdRetrieverHelper<T>::Value;
159class MsgIndexRetriever
162 MsgIndexRetriever(std::size_t& val) : value_(val) {}
164 void setValue(std::size_t val)
174struct IsMsgIndexRetrieverHelper
176 static const bool Value =
false;
180struct IsMsgIndexRetrieverHelper<MsgIndexRetriever>
182 static const bool Value =
true;
186constexpr bool isMsgIndexRetriever()
188 return IsMsgIndexRetrieverHelper<T>::Value;
191template <
typename TIter>
192class MsgPayloadRetriever
195 MsgPayloadRetriever(TIter& iter, std::size_t& len) : iter_(iter), len_(len) {}
197 template <
typename TOtherIter>
198 void setValue(TOtherIter iter, std::size_t len)
200 iter_ =
static_cast<TIter
>(iter);
209template <
typename TITer>
210struct IsMsgPayloadRetrieverHelper
212 static const bool Value =
false;
215template <
typename TIter>
216struct IsMsgPayloadRetrieverHelper<MsgPayloadRetriever<TIter> >
218 static const bool Value =
true;
222constexpr bool isMsgPayloadRetriever()
224 return IsMsgPayloadRetrieverHelper<T>::Value;
Main namespace for all classes / functions of COMMS library.