15#include "basic/FloatValue.h"
16#include "details/AdaptBasicField.h"
60template <
typename TFieldBase,
typename T,
typename... TOptions>
61class FloatValue :
public details::AdaptBasicFieldT<basic::FloatValue<TFieldBase, T>, TOptions...>
63 using BaseImpl = details::AdaptBasicFieldT<basic::FloatValue<TFieldBase, T>, TOptions...>;
69 using Endian =
typename BaseImpl::Endian;
86 using UnitsType =
typename ParsedOptions::UnitsType;
95 using FieldType =
typename ParsedOptions::FieldType;
111 return ParsedOptions::HasFailOnInvalid;
118 return ParsedOptions::HasIgnoreInvalid;
125 return ParsedOptions::HasEmptySerialization;
132 return ParsedOptions::HasUnits;
139 return ParsedOptions::HasFieldType;
146 return ParsedOptions::HasFixedValue;
153 return ParsedOptions::HasName;
159 return BaseImpl::value();
165 return BaseImpl::value();
172 return BaseImpl::getValue();
177 template <
typename U>
180 BaseImpl::setValue(std::forward<U>(val));
187 return BaseImpl::length();
194 return BaseImpl::minLength();
201 return BaseImpl::maxLength();
207 return BaseImpl::valid();
214 return BaseImpl::refresh();
222 template <
typename TIter>
225 return BaseImpl::read(iter, size);
232 return BaseImpl::hasReadNoStatus();
240 template <
typename TIter>
243 BaseImpl::readNoStatus(iter);
249 return BaseImpl::canWrite();
257 template <
typename TIter>
260 return BaseImpl::write(iter, size);
267 return BaseImpl::hasWriteNoStatus();
275 template <
typename TIter>
278 BaseImpl::writeNoStatus(iter);
284 return ParsedOptions::HasCustomVersionUpdate || BaseImpl::isVersionDependent();
290 return BaseImpl::hasNonDefaultRefresh();
297 return BaseImpl::getVersion();
304 return BaseImpl::setVersion(
version);
308 using BaseImpl::readData;
309 using BaseImpl::writeData;
312 static_assert(!ParsedOptions::HasVarLengthLimits,
313 "comms::option::def::VarLength option is not applicable to FloatValue field");
314 static_assert(!ParsedOptions::HasAvailableLengthLimit,
315 "comms::option::def::AvailableLengthLimit option is not applicable to FloatValue field");
316 static_assert(!ParsedOptions::HasSequenceElemLengthForcing,
317 "comms::option::def::SequenceElemLengthForcingEnabled option is not applicable to FloatValue field");
318 static_assert(!ParsedOptions::HasSequenceSizeForcing,
319 "comms::option::def::SequenceSizeForcingEnabled option is not applicable to FloatValue field");
320 static_assert(!ParsedOptions::HasSequenceLengthForcing,
321 "comms::option::def::SequenceLengthForcingEnabled option is not applicable to FloatValue field");
322 static_assert(!ParsedOptions::HasSequenceFixedSize,
323 "comms::option::def::SequenceFixedSize option is not applicable to FloatValue field");
324 static_assert(!ParsedOptions::HasSequenceFixedSizeUseFixedSizeStorage,
325 "comms::option::app::SequenceFixedSizeUseFixedSizeStorage option is not applicable to FloatValue field");
326 static_assert(!ParsedOptions::HasSequenceSizeFieldPrefix,
327 "comms::option::def::SequenceSizeFieldPrefix option is not applicable to FloatValue field");
328 static_assert(!ParsedOptions::HasSequenceSerLengthFieldPrefix,
329 "comms::option::def::SequenceSerLengthFieldPrefix option is not applicable to FloatValue field");
330 static_assert(!ParsedOptions::HasSequenceElemSerLengthFieldPrefix,
331 "comms::option::def::SequenceElemSerLengthFieldPrefix option is not applicable to FloatValue field");
332 static_assert(!ParsedOptions::HasSequenceElemFixedSerLengthFieldPrefix,
333 "comms::option::def::SequenceElemSerLengthFixedFieldPrefix option is not applicable to FloatValue field");
334 static_assert(!ParsedOptions::HasSequenceTrailingFieldSuffix,
335 "comms::option::def::SequenceTrailingFieldSuffix option is not applicable to FloatValue field");
336 static_assert(!ParsedOptions::HasSequenceTerminationFieldSuffix,
337 "comms::option::def::SequenceTerminationFieldSuffix option is not applicable to FloatValue field");
338 static_assert(!ParsedOptions::HasFixedSizeStorage,
339 "comms::option::app::FixedSizeStorage option is not applicable to FloatValue field");
340 static_assert(!ParsedOptions::HasCustomStorageType,
341 "comms::option::app::CustomStorageType option is not applicable to FloatValue field");
342 static_assert(!ParsedOptions::HasOrigDataView,
343 "comms::option::app::OrigDataView option is not applicable to FloatValue field");
344 static_assert(!ParsedOptions::HasVersionsRange,
345 "comms::option::def::ExistsBetweenVersions (or similar) option is not applicable to FloatValue field");
346 static_assert(!ParsedOptions::HasMissingOnReadFail,
347 "comms::option::def::MissingOnReadFail option is not applicable to FloatValue field");
348 static_assert(!ParsedOptions::HasMissingOnInvalid,
349 "comms::option::def::MissingOnInvalid option is not applicable to FloatValue field");
357template <
typename TFieldBase,
typename T,
typename... TOptions>
362 return field1.value() == field2.value();
370template <
typename TFieldBase,
typename T,
typename... TOptions>
375 return field1.value() != field2.value();
383template <
typename TFieldBase,
typename T,
typename... TOptions>
388 return field1.value() < field2.value();
399 return std::is_same<typename T::CommsTag, tag::Float>::value;
405template <
typename TFieldBase,
typename T,
typename... TOptions>
416template <
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:62
bool setVersion(VersionType version)
Default implementation of version update.
Definition FloatValue.h:302
typename ParsedOptions::UnitsRatio UnitsRatio
Scaling ratio determined by the forced units via the comms::option::def::Units* option.
Definition FloatValue.h:90
static constexpr bool hasNonDefaultRefresh()
Compile time check if this class has non-default refresh functionality.
Definition FloatValue.h:288
typename BaseImpl::ValueType ValueType
Type of underlying floating point value.
Definition FloatValue.h:82
constexpr bool isFloatValue()
Compile time check function of whether a provided type is any variant of comms::field::FloatValue.
Definition FloatValue.h:397
typename BaseImpl::CommsTag CommsTag
Tag indicating type of the field.
Definition FloatValue.h:78
bool valid() const
Check validity of the field value.
Definition FloatValue.h:205
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:408
bool operator!=(const FloatValue< TFieldBase, T, TOptions... > &field1, const FloatValue< TFieldBase, T, TOptions... > &field2) noexcept
Non-equality comparison operator.
Definition FloatValue.h:371
static constexpr bool hasName()
Compile time inquiry of whether comms::option::def::HasName option has been used.
Definition FloatValue.h:151
ValueType & value()
Get access to floating point value storage.
Definition FloatValue.h:163
static constexpr bool hasReadNoStatus()
Compile time check of whether the field has proper readNoStatus() member function.
Definition FloatValue.h:230
typename ParsedOptions::UnitsType UnitsType
Units type defined by any of the comms::option::def::Units* option.
Definition FloatValue.h:86
bool operator==(const FloatValue< TFieldBase, T, TOptions... > &field1, const FloatValue< TFieldBase, T, TOptions... > &field2) noexcept
Equality comparison operator.
Definition FloatValue.h:358
typename BaseImpl::Endian Endian
Endian used for serialisation.
Definition FloatValue.h:69
static constexpr bool hasEmptySerialization()
Compile time inquiry of whether comms::option::def::EmptySerialization option has been used.
Definition FloatValue.h:123
static constexpr bool hasFieldType()
Compile time inquiry of whether comms::option::def::FieldType option has been used.
Definition FloatValue.h:137
static constexpr bool hasWriteNoStatus()
Compile time check of whether the field has proper writeNoStatus() member function.
Definition FloatValue.h:265
ErrorStatus write(TIter &iter, std::size_t size) const
Write current field value to output data sequence.
Definition FloatValue.h:258
const ValueType & value() const
Get access to floating point value storage.
Definition FloatValue.h:157
ErrorStatus read(TIter &iter, std::size_t size)
Read field value from input data sequence.
Definition FloatValue.h:223
void readNoStatus(TIter &iter)
Read field value from input data sequence without error check and status report.
Definition FloatValue.h:241
static constexpr bool hasFixedValue()
Compile time inquiry of whether comms::option::def::FixedValue option has been used.
Definition FloatValue.h:144
bool refresh()
Refresh the field's value.
Definition FloatValue.h:212
void setValue(U &&val)
Set value.
Definition FloatValue.h:178
details::OptionsParser< TOptions... > ParsedOptions
All the options provided to this class bundled into struct.
Definition FloatValue.h:75
void writeNoStatus(TIter &iter) const
Write current field value to output data sequence without error check and status report.
Definition FloatValue.h:276
FloatValue()=default
Default constructor.
const ValueType & getValue() const
Get value.
Definition FloatValue.h:170
static constexpr bool hasFailOnInvalid()
Compile time inquiry of whether comms::option::def::FailOnInvalid option has been used.
Definition FloatValue.h:109
constexpr std::size_t length() const
Get length required to serialise the current field value.
Definition FloatValue.h:185
FloatValue(const ValueType &val)
Constructor.
Definition FloatValue.h:102
static constexpr std::size_t minLength()
Get minimal length that is required to serialise field of this type.
Definition FloatValue.h:192
typename BaseImpl::VersionType VersionType
Version type.
Definition FloatValue.h:72
VersionType getVersion() const
Get version of the field.
Definition FloatValue.h:295
TFieldBase FieldBase
Base class provided in the first template parameter.
Definition FloatValue.h:66
static constexpr bool isVersionDependent()
Compile time check if this class is version dependent.
Definition FloatValue.h:282
static constexpr std::size_t maxLength()
Get maximal length that is required to serialise field of this type.
Definition FloatValue.h:199
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:130
static constexpr bool hasIgnoreInvalid()
Compile time inquiry of whether comms::option::def::IgnoreInvalid option has been used.
Definition FloatValue.h:116
bool canWrite() const
Check of whether the field has a consistent value for writing.
Definition FloatValue.h:247
bool operator<(const FloatValue< TFieldBase, T, TOptions... > &field1, const FloatValue< TFieldBase, T, TOptions... > &field2) noexcept
Equivalence comparison operator.
Definition FloatValue.h:384
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:419
typename ParsedOptions::FieldType FieldType
Type of actual extending field specified via comms::option::def::FieldType.
Definition FloatValue.h:95
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.