16COMMS_MSVC_WARNING_PUSH
17COMMS_MSVC_WARNING_DISABLE(4100)
29struct FieldVersionDependentCheckHelper
31 template <
typename TField>
32 constexpr bool operator()()
const
34 return TField::isVersionDependent();
37 template <
typename TField>
38 constexpr bool operator()(
bool soFar)
const
40 return TField::isVersionDependent() || soFar;
45struct FieldMaxLengthCalcHelper
47 template <
typename TField>
48 constexpr std::size_t operator()(std::size_t val)
const
50 return val >= TField::maxLength() ? val : TField::maxLength();
55struct FieldMinLengthSumCalcHelper
57 template <
typename TField>
58 constexpr std::size_t operator()(std::size_t sum)
const
60 return sum + TField::minLength();
65struct FieldMaxLengthSumCalcHelper
67 template <
typename TField>
68 constexpr std::size_t operator()(std::size_t sum)
const
70 return sum + TField::maxLength();
74template <
bool THasBitLengthLimit>
75struct FieldBitLengthRetrieveHelper
77 template <
typename TField>
79 std::integral_constant<
81 TField::ParsedOptions::FixedBitLength
86struct FieldBitLengthRetrieveHelper<false>
88 template <
typename TField>
90 std::integral_constant<
92 TField::maxLength() * std::numeric_limits<std::uint8_t>::digits
98struct FieldTotalBitLengthSumCalcHelper
100 template <
typename TField>
101 constexpr std::size_t operator()(std::size_t sum)
const
103 return sum + FieldBitLengthRetrieveHelper<TField::ParsedOptions::HasFixedBitLengthLimit>::template Type<TField>::value;
107template <
typename...>
108struct FieldLengthSumCalcHelper
110 template <
typename TField>
111 constexpr std::size_t operator()(std::size_t sum,
const TField& field)
const
113 return sum + field.length();
117template <
typename...>
118struct FieldHasWriteNoStatusHelper
120 constexpr FieldHasWriteNoStatusHelper() =
default;
122 template <
typename TField>
123 constexpr bool operator()(
bool soFar)
const
125 return TField::hasWriteNoStatus() && soFar;
130struct FieldNonDefaultRefreshCheckHelper
132 template <
typename TField>
133 constexpr bool operator()()
const
135 return TField::hasNonDefaultRefresh();
138 template <
typename TField>
139 constexpr bool operator()(
bool soFar)
const
141 return TField::hasNonDefaultRefresh() || soFar;
146struct FieldValidCheckHelper
148 template <
typename TField>
149 constexpr bool operator()(
bool soFar,
const TField& field)
const
151 return soFar && field.valid();
155template <
typename...>
156struct FieldRefreshHelper
158 template <
typename TField>
159 bool operator()(
bool soFar, TField& field)
const
161 return field.refresh() || soFar;
165template <
typename TIter>
169 FieldReadHelper(ErrorStatus& es, TIter& iter, std::size_t& len)
176 template <
typename TField>
177 void operator()(TField& field)
183 auto fromIter = iter_;
184 es_ = field.read(iter_, len_);
186 len_ -=
static_cast<std::size_t
>(std::distance(fromIter, iter_));
197template <
typename TIter>
198class FieldReadNoStatusHelper
201 FieldReadNoStatusHelper(TIter& iter)
206 template <
typename TField>
207 void operator()(TField& field)
209 field.readNoStatus(iter_);
216template <
typename TIter>
217class FieldWriteHelper
220 FieldWriteHelper(ErrorStatus& es, TIter& iter, std::size_t len)
227 template <
typename TField>
228 void operator()(
const TField& field)
234 es_ = field.write(iter_, len_);
236 len_ -= field.length();
246template <
typename TIter>
247class FieldWriteNoStatusHelper
250 FieldWriteNoStatusHelper(TIter& iter)
255 template <
typename TField>
256 void operator()(
const TField& field)
258 field.writeNoStatus(iter_);
265template <
typename...>
266struct FieldReadNoStatusDetectHelper
268 template <
typename TField>
269 constexpr bool operator()()
const
271 return TField::hasReadNoStatus();
274 template <
typename TField>
275 constexpr bool operator()(
bool soFar)
const
277 return TField::hasReadNoStatus() && soFar;
282struct FieldWriteNoStatusDetectHelper
284 template <
typename TField>
285 constexpr bool operator()()
const
287 return TField::hasWriteNoStatus();
290 template <
typename TField>
291 constexpr bool operator()(
bool soFar)
const
293 return TField::hasWriteNoStatus() && soFar;
297template <
typename...>
298struct FieldCanWriteCheckHelper
300 template <
typename TField>
301 constexpr bool operator()(
bool soFar,
const TField& field)
const
303 return soFar && field.canWrite();
307template <
typename TVersionType>
308struct FieldVersionUpdateHelper
310 FieldVersionUpdateHelper(TVersionType version) : version_(
version) {}
312 template <
typename TField>
313 bool operator()(
bool updated, TField& field)
const
315 using FieldVersionType =
typename std::decay<
decltype(field)>::type::VersionType;
316 return field.setVersion(
static_cast<FieldVersionType
>(version_)) || updated;
320 const TVersionType version_ =
static_cast<TVersionType
>(0);
329COMMS_MSVC_WARNING_POP
Contains various compiler related definitions.
This file contain definition of error statuses used by comms module.
Main namespace for all classes / functions of COMMS library.
ErrorStatus
Error statuses reported by the Communication module.
Definition ErrorStatus.h:17
@ Success
Used to indicate successful outcome of the operation.
constexpr unsigned version()
Version of the COMMS library as single numeric value.
Definition version.h:64