15#include "comms/field/details/FieldOpHelpers.h"
28 template <
typename TField,
typename TIter>
34 auto& elem = field.createBack();
35 auto es = field.readElement(elem, iter, remLen);
37 field.value().pop_back();
45 template <
typename TField,
typename TIter>
46 static comms::ErrorStatus readSequenceN(TField& field, std::size_t count, TIter& iter, std::size_t& len)
50 auto& elem = field.createBack();
51 auto es = field.readElement(elem, iter, len);
53 field.value().pop_back();
61 template <
typename TField,
typename TIter>
62 static void readSequenceNoStatusN(TField& field, std::size_t count, TIter& iter)
66 auto& elem = field.createBack();
67 field.readElementNoStatus(elem, iter);
72 template <
typename TField>
73 static bool canWriteSequence(
const TField& field)
75 for (
auto& elem : field.value()) {
76 if (!field.canWriteElement(elem)) {
84 template <
typename TField,
typename TIter>
85 static comms::ErrorStatus writeSequence(
const TField& field, TIter& iter, std::size_t len)
88 auto remainingLen = len;
89 for (
auto& elem : field.value()) {
90 if (!field.canWriteElement(elem)) {
95 es = field.writeElement(elem, iter, remainingLen);
104 template <
typename TField,
typename TIter>
105 static void writeSequenceNoStatus(TField& field, TIter& iter)
107 for (
auto& elem : field.value()) {
108 field.writeElementNoStatus(elem, iter);
112 template <
typename TField,
typename TIter>
113 static comms::ErrorStatus writeSequenceN(
const TField& field, std::size_t count, TIter& iter, std::size_t& len)
116 for (
auto& elem : field.value()) {
121 es = field.writeElement(elem, iter, len);
132 template <
typename TField,
typename TIter>
133 static void writeSequenceNoStatusN(
const TField& field, std::size_t count, TIter& iter)
135 for (
auto& elem : field.value()) {
140 field.writeElementNoStatus(elem, iter);
145 template <
typename TIter>
146 static void advanceWriteIterator(TIter& iter, std::size_t len)
148 using IterType =
typename std::decay<
decltype(iter)>::type;
149 using ByteType =
typename std::iterator_traits<IterType>::value_type;
157 static constexpr std::size_t maxSupportedLength()
162 template <
typename TFields,
typename TVersionType>
163 static bool setVersionForMembers(TFields& fields, TVersionType
version)
168 template <
typename... TFields>
169 using IsAnyFieldVersionDependentBoolType =
172 comms::field::details::FieldVersionDependentCheckHelper<>())
178 template <
typename... TFields>
179 using FieldSelectMaxLengthIntType =
180 std::integral_constant<
183 std::size_t(0), comms::field::details::FieldMaxLengthCalcHelper<>())
186 template <
typename... TFields>
187 using FieldSumMaxLengthIntType =
188 std::integral_constant<
191 std::size_t(0), comms::field::details::FieldMaxLengthSumCalcHelper<>())
194 template <std::size_t TFrom, std::size_t TUntil,
typename... TFields>
195 using FieldSumMaxLengthFromUntilIntType =
196 std::integral_constant<
199 std::size_t(0), comms::field::details::FieldMaxLengthSumCalcHelper<>())
202 template <
typename... TFields>
203 using FieldSumMinLengthIntType =
204 std::integral_constant<
207 std::size_t(0), comms::field::details::FieldMinLengthSumCalcHelper<>())
210 template <std::size_t TFrom, std::size_t TUntil,
typename... TFields>
211 using FieldSumMinLengthFromUntilIntType =
212 std::integral_constant<
215 std::size_t(0), comms::field::details::FieldMinLengthSumCalcHelper<>())
218 template <
typename... TFields>
219 using FieldSumTotalBitLengthIntType =
220 std::integral_constant<
223 std::size_t(0), comms::field::details::FieldTotalBitLengthSumCalcHelper<>())
226 template <std::size_t TFrom, std::size_t TUntil,
typename... TFields>
227 using FieldSumTotalBitLengthFromUntilIntType =
228 std::integral_constant<
231 std::size_t(0), comms::field::details::FieldTotalBitLengthSumCalcHelper<>())
234 template <
typename... TFields>
235 using AnyFieldHasNonDefaultRefreshBoolType =
238 comms::field::details::FieldNonDefaultRefreshCheckHelper<>())
244 template <
typename... TFields>
245 using AllFieldsHaveReadNoStatusBoolType =
248 true, comms::field::details::FieldReadNoStatusDetectHelper<>())
254 template <
typename... TFields>
255 using AllFieldsHaveWriteNoStatusBoolType =
258 true, comms::field::details::FieldWriteNoStatusDetectHelper<>())
266 template <
typename TVersionType>
267 static comms::field::details::FieldVersionUpdateHelper<TVersionType> makeVersionUpdater(TVersionType
version)
269 return comms::field::details::FieldVersionUpdateHelper<TVersionType>(
version);
This file contain definition of error statuses used by comms module.
Contains various tuple type manipulation classes and functions.
constexpr TValue tupleTypeAccumulate(const TValue &value, TFunc &&func)
Performs "accumulate" algorithm on every type of the tuple.
Definition Tuple.h:685
constexpr TValue tupleTypeAccumulateFromUntil(const TValue &value, TFunc &&func)
Performs "accumulate" algorithm on specified types inside the tuple.
Definition Tuple.h:713
constexpr bool tupleTypeIsAnyOf(TFunc &&func)
Compile time check of whether any type within a tuple has a certain condition.
Definition Tuple.h:990
constexpr TValue tupleAccumulate(TTuple &&tuple, const TValue &value, TFunc &&func)
Performs "accumulate" algorithm on every element of the tuple.
Definition Tuple.h:586
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.
@ InvalidMsgData
Used to indicate that a message has invalid data.
constexpr unsigned version()
Version of the COMMS library as single numeric value.
Definition version.h:64
Replacement to std::conditional.
Definition type_traits.h:28