15#include "basic/FloatValue.h"
16#include "details/AdaptBasicField.h"
58template <
typename TFieldBase,
typename T,
typename... TOptions>
59class FloatValue :
public details::AdaptBasicFieldT<basic::FloatValue<TFieldBase, T>, TOptions...>
61 using BaseImpl = details::AdaptBasicFieldT<basic::FloatValue<TFieldBase, T>, TOptions...>;
67 using Endian =
typename BaseImpl::Endian;
84 using UnitsType =
typename ParsedOptions::UnitsType;
93 using FieldType =
typename ParsedOptions::FieldType;
109 return ParsedOptions::HasFailOnInvalid;
116 return ParsedOptions::HasIgnoreInvalid;
123 return ParsedOptions::HasEmptySerialization;
130 return ParsedOptions::HasUnits;
137 return ParsedOptions::HasFieldType;
143 return BaseImpl::value();
149 return BaseImpl::value();
156 return BaseImpl::getValue();
161 template <
typename U>
164 BaseImpl::setValue(std::forward<U>(val));
171 return BaseImpl::length();
178 return BaseImpl::minLength();
185 return BaseImpl::maxLength();
191 return BaseImpl::valid();
198 return BaseImpl::refresh();
206 template <
typename TIter>
209 return BaseImpl::read(iter, size);
216 return BaseImpl::hasReadNoStatus();
224 template <
typename TIter>
227 BaseImpl::readNoStatus(iter);
233 return BaseImpl::canWrite();
241 template <
typename TIter>
244 return BaseImpl::write(iter, size);
251 return BaseImpl::hasWriteNoStatus();
259 template <
typename TIter>
262 BaseImpl::writeNoStatus(iter);
268 return ParsedOptions::HasCustomVersionUpdate || BaseImpl::isVersionDependent();
274 return BaseImpl::hasNonDefaultRefresh();
281 return BaseImpl::getVersion();
288 return BaseImpl::setVersion(
version);
292 using BaseImpl::readData;
293 using BaseImpl::writeData;
296 static_assert(!ParsedOptions::HasVarLengthLimits,
297 "comms::option::def::VarLength option is not applicable to FloatValue field");
298 static_assert(!ParsedOptions::HasAvailableLengthLimit,
299 "comms::option::def::AvailableLengthLimit option is not applicable to FloatValue field");
300 static_assert(!ParsedOptions::HasSequenceElemLengthForcing,
301 "comms::option::def::SequenceElemLengthForcingEnabled option is not applicable to FloatValue field");
302 static_assert(!ParsedOptions::HasSequenceSizeForcing,
303 "comms::option::def::SequenceSizeForcingEnabled option is not applicable to FloatValue field");
304 static_assert(!ParsedOptions::HasSequenceLengthForcing,
305 "comms::option::def::SequenceLengthForcingEnabled option is not applicable to FloatValue field");
306 static_assert(!ParsedOptions::HasSequenceFixedSize,
307 "comms::option::def::SequenceFixedSize option is not applicable to FloatValue field");
308 static_assert(!ParsedOptions::HasSequenceFixedSizeUseFixedSizeStorage,
309 "comms::option::app::SequenceFixedSizeUseFixedSizeStorage option is not applicable to FloatValue field");
310 static_assert(!ParsedOptions::HasSequenceSizeFieldPrefix,
311 "comms::option::def::SequenceSizeFieldPrefix option is not applicable to FloatValue field");
312 static_assert(!ParsedOptions::HasSequenceSerLengthFieldPrefix,
313 "comms::option::def::SequenceSerLengthFieldPrefix option is not applicable to FloatValue field");
314 static_assert(!ParsedOptions::HasSequenceElemSerLengthFieldPrefix,
315 "comms::option::def::SequenceElemSerLengthFieldPrefix option is not applicable to FloatValue field");
316 static_assert(!ParsedOptions::HasSequenceElemFixedSerLengthFieldPrefix,
317 "comms::option::def::SequenceElemSerLengthFixedFieldPrefix option is not applicable to FloatValue field");
318 static_assert(!ParsedOptions::HasSequenceTrailingFieldSuffix,
319 "comms::option::def::SequenceTrailingFieldSuffix option is not applicable to FloatValue field");
320 static_assert(!ParsedOptions::HasSequenceTerminationFieldSuffix,
321 "comms::option::def::SequenceTerminationFieldSuffix option is not applicable to FloatValue field");
322 static_assert(!ParsedOptions::HasFixedSizeStorage,
323 "comms::option::app::FixedSizeStorage option is not applicable to FloatValue field");
324 static_assert(!ParsedOptions::HasCustomStorageType,
325 "comms::option::app::CustomStorageType option is not applicable to FloatValue field");
326 static_assert(!ParsedOptions::HasOrigDataView,
327 "comms::option::app::OrigDataView option is not applicable to FloatValue field");
328 static_assert(!ParsedOptions::HasVersionsRange,
329 "comms::option::def::ExistsBetweenVersions (or similar) option is not applicable to FloatValue field");
330 static_assert(!ParsedOptions::HasMissingOnReadFail,
331 "comms::option::def::MissingOnReadFail option is not applicable to FloatValue field");
332 static_assert(!ParsedOptions::HasMissingOnInvalid,
333 "comms::option::def::MissingOnInvalid option is not applicable to FloatValue field");
341template <
typename TFieldBase,
typename T,
typename... TOptions>
346 return field1.value() == field2.value();
354template <
typename TFieldBase,
typename T,
typename... TOptions>
359 return field1.value() != field2.value();
367template <
typename TFieldBase,
typename T,
typename... TOptions>
372 return field1.value() < field2.value();
383 return std::is_same<typename T::CommsTag, tag::Float>::value;
389template <
typename TFieldBase,
typename T,
typename... TOptions>
400template <
typename TFieldBase,
typename T,
typename... TOptions>
This file contain definition of error statuses used by comms module.
Field that represent floating point value.
Definition FloatValue.h:60
bool setVersion(VersionType version)
Default implementation of version update.
Definition FloatValue.h:286
typename ParsedOptions::UnitsRatio UnitsRatio
Scaling ratio determined by the forced units via the comms::option::def::Units* option.
Definition FloatValue.h:88
static constexpr bool hasNonDefaultRefresh()
Compile time check if this class has non-default refresh functionality.
Definition FloatValue.h:272
typename BaseImpl::ValueType ValueType
Type of underlying floating point value.
Definition FloatValue.h:80
constexpr bool isFloatValue()
Compile time check function of whether a provided type is any variant of comms::field::FloatValue.
Definition FloatValue.h:381
typename BaseImpl::CommsTag CommsTag
Tag indicating type of the field.
Definition FloatValue.h:76
bool valid() const
Check validity of the field value.
Definition FloatValue.h:189
FloatValue< TFieldBase, T, TOptions... > & toFieldBase(FloatValue< TFieldBase, T, TOptions... > &field)
Upcast type of the field definition to its parent comms::field::FloatValue type in order to have acce...
Definition FloatValue.h:392
bool operator!=(const FloatValue< TFieldBase, T, TOptions... > &field1, const FloatValue< TFieldBase, T, TOptions... > &field2) noexcept
Non-equality comparison operator.
Definition FloatValue.h:355
ValueType & value()
Get access to floating point value storage.
Definition FloatValue.h:147
static constexpr bool hasReadNoStatus()
Compile time check of whether the field has proper readNoStatus() member function.
Definition FloatValue.h:214
typename ParsedOptions::UnitsType UnitsType
Units type defined by any of the comms::option::def::Units* option.
Definition FloatValue.h:84
bool operator==(const FloatValue< TFieldBase, T, TOptions... > &field1, const FloatValue< TFieldBase, T, TOptions... > &field2) noexcept
Equality comparison operator.
Definition FloatValue.h:342
typename BaseImpl::Endian Endian
Endian used for serialisation.
Definition FloatValue.h:67
static constexpr bool hasEmptySerialization()
Compile time inquiry of whether comms::option::def::EmptySerialization option has been used.
Definition FloatValue.h:121
static constexpr bool hasFieldType()
Compile time inquiry of whether comms::option::def::FieldType option has been used.
Definition FloatValue.h:135
static constexpr bool hasWriteNoStatus()
Compile time check of whether the field has proper writeNoStatus() member function.
Definition FloatValue.h:249
ErrorStatus write(TIter &iter, std::size_t size) const
Write current field value to output data sequence.
Definition FloatValue.h:242
const ValueType & value() const
Get access to floating point value storage.
Definition FloatValue.h:141
ErrorStatus read(TIter &iter, std::size_t size)
Read field value from input data sequence.
Definition FloatValue.h:207
void readNoStatus(TIter &iter)
Read field value from input data sequence without error check and status report.
Definition FloatValue.h:225
bool refresh()
Refresh the field's value.
Definition FloatValue.h:196
void setValue(U &&val)
Set value.
Definition FloatValue.h:162
details::OptionsParser< TOptions... > ParsedOptions
All the options provided to this class bundled into struct.
Definition FloatValue.h:73
void writeNoStatus(TIter &iter) const
Write current field value to output data sequence without error check and status report.
Definition FloatValue.h:260
FloatValue()=default
Default constructor.
const ValueType & getValue() const
Get value.
Definition FloatValue.h:154
static constexpr bool hasFailOnInvalid()
Compile time inquiry of whether comms::option::def::FailOnInvalid option has been used.
Definition FloatValue.h:107
constexpr std::size_t length() const
Get length required to serialise the current field value.
Definition FloatValue.h:169
FloatValue(const ValueType &val)
Constructor.
Definition FloatValue.h:100
static constexpr std::size_t minLength()
Get minimal length that is required to serialise field of this type.
Definition FloatValue.h:176
typename BaseImpl::VersionType VersionType
Version type.
Definition FloatValue.h:70
VersionType getVersion() const
Get version of the field.
Definition FloatValue.h:279
TFieldBase FieldBase
Base class provided in the first template parameter.
Definition FloatValue.h:64
static constexpr bool isVersionDependent()
Compile time check if this class is version dependent.
Definition FloatValue.h:266
static constexpr std::size_t maxLength()
Get maximal length that is required to serialise field of this type.
Definition FloatValue.h:183
static constexpr bool hasUnits()
Compile type inquiry of whether units have been set via any of the comms::option::def::Units* options...
Definition FloatValue.h:128
static constexpr bool hasIgnoreInvalid()
Compile time inquiry of whether comms::option::def::IgnoreInvalid option has been used.
Definition FloatValue.h:114
bool canWrite() const
Check of whether the field has a consistent value for writing.
Definition FloatValue.h:231
bool operator<(const FloatValue< TFieldBase, T, TOptions... > &field1, const FloatValue< TFieldBase, T, TOptions... > &field2) noexcept
Equivalence comparison operator.
Definition FloatValue.h:368
const FloatValue< TFieldBase, T, TOptions... > & toFieldBase(const FloatValue< TFieldBase, T, TOptions... > &field)
Upcast type of the field definition to its parent comms::field::FloatValue type in order to have acce...
Definition FloatValue.h:403
typename ParsedOptions::FieldType FieldType
Type of actual extending field specified via comms::option::def::FieldType.
Definition FloatValue.h:93
Contains definition of various tag classes.
Main namespace for all classes / functions of COMMS library.
ErrorStatus
Error statuses reported by the Communication module.
Definition ErrorStatus.h:17
constexpr unsigned version()
Version of the COMMS library as single numeric value.
Definition version.h:64
Contains definition of all the options used by the COMMS library.