Skip to content

Commit

Permalink
Updated documentation regarding usage of the comms::option::def::Fixe…
Browse files Browse the repository at this point in the history
…dValue.
  • Loading branch information
arobenko committed Oct 27, 2024
1 parent 559f6a5 commit e32f175
Show file tree
Hide file tree
Showing 12 changed files with 165 additions and 95 deletions.
7 changes: 0 additions & 7 deletions include/comms/Field.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,6 @@ class Field : public details::FieldBase<TOptions...>
return false;
}

/// @brief Default indication of whether the application is prevented to updated the field's value
/// @return Always @b false
static constexpr bool fixedValue()
{
return false;
}

protected:
/// @brief Write data into the output buffer.
/// @details Use this function to write data to the the buffer
Expand Down
41 changes: 25 additions & 16 deletions include/comms/field/ArrayList.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,27 +164,29 @@ using ArrayListBase =
/// @tparam TOptions Zero or more options that modify/refine default behaviour
/// of the field.@n
/// Supported options are:
/// @li @ref comms::option::app::FixedSizeStorage
/// @li @ref comms::option::app::CustomStorageType
/// @li @ref comms::option::app::OrigDataView (valid only if TElement is integral type
/// of 1 byte size.
/// @li @ref comms::option::def::SequenceSizeFieldPrefix
/// @li @ref comms::option::def::SequenceSerLengthFieldPrefix
/// @li @ref comms::option::def::SequenceElemSerLengthFieldPrefix
/// @li @ref comms::option::def::SequenceElemFixedSerLengthFieldPrefix
/// @li @ref comms::option::def::SequenceSizeForcingEnabled
/// @li @ref comms::option::def::SequenceLengthForcingEnabled
/// @li @ref comms::option::def::SequenceFixedSize
/// @li @ref comms::option::def::SequenceTerminationFieldSuffix
/// @li @ref comms::option::def::SequenceTrailingFieldSuffix
/// @li @ref comms::option::def::DefaultValueInitialiser
/// @li @ref comms::option::def::EmptySerialization
/// @li @ref comms::option::def::FailOnInvalid
/// @li @ref comms::option::def::FieldType
/// @li @ref comms::option::def::FixedValue
/// @li @ref comms::option::def::HasCustomRead
/// @li @ref comms::option::def::HasCustomRefresh
/// @li @ref comms::option::def::FailOnInvalid
/// @li @ref comms::option::def::IgnoreInvalid
/// @li @ref comms::option::def::EmptySerialization
/// @li @ref comms::option::def::SequenceElemFixedSerLengthFieldPrefix
/// @li @ref comms::option::def::SequenceElemSerLengthFieldPrefix
/// @li @ref comms::option::def::SequenceFixedSize
/// @li @ref comms::option::def::SequenceLengthForcingEnabled
/// @li @ref comms::option::def::SequenceSerLengthFieldPrefix
/// @li @ref comms::option::def::SequenceSizeFieldPrefix
/// @li @ref comms::option::def::SequenceSizeForcingEnabled
/// @li @ref comms::option::def::SequenceTerminationFieldSuffix
/// @li @ref comms::option::def::SequenceTrailingFieldSuffix
/// @li @ref comms::option::def::VersionStorage
/// @li @ref comms::option::def::FieldType
/// @li @ref comms::option::app::CustomStorageType
/// @li @ref comms::option::app::FixedSizeStorage
/// @li @ref comms::option::app::OrigDataView (valid only if TElement is integral type
/// of 1 byte size.

/// @extends comms::Field
/// @headerfile comms/field/ArrayList.h
template <typename TFieldBase, typename TElement, typename... TOptions>
Expand Down Expand Up @@ -353,6 +355,13 @@ class ArrayList : public details::ArrayListBase<TFieldBase, TElement, TOptions..
return ParsedOptions::HasSequenceFixedSize;
}

/// @brief Compile time inquiry of whether @ref comms::option::def::FixedValue option
/// has been used.
static constexpr bool hasFixedValue()
{
return ParsedOptions::HasFixedValue;
}

/// @brief Compile time inquiry of fixed size provided via @ref comms::option::def::SequenceFixedSize option.
/// @details If the @ref comms::option::def::SequenceFixedSize option hasn't been used
/// <b>std::numeric_limits&lt;std::size_t&gt;\::max()</b> is returned.
Expand Down
15 changes: 12 additions & 3 deletions include/comms/field/Bitfield.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,14 @@ namespace field
/// @tparam TOptions Zero or more options that modify/refine default behaviour
/// of the field.@n
/// Supported options are:
/// @li @ref comms::option::def::HasCustomRead
/// @li @ref comms::option::def::HasCustomRefresh
/// @li @ref comms::option::def::EmptySerialization
/// @li @ref comms::option::def::VersionStorage
/// @li @ref comms::option::def::FieldType
/// @li @ref comms::option::def::FixedValue
/// @li @ref comms::option::def::HasCustomRead
/// @li @ref comms::option::def::HasCustomRefresh
/// @li @ref comms::option::def::HasVersionDependentMembers
/// @li @ref comms::option::def::VersionStorage

/// @pre TMember is a variant of std::tuple, that contains other fields.
/// @pre Every field member specifies its length in bits using
/// @ref comms::option::def::FixedBitLength option.
Expand Down Expand Up @@ -178,6 +180,13 @@ class Bitfield : public
return ParsedOptions::HasFieldType;
}

/// @brief Compile time inquiry of whether @ref comms::option::def::FixedValue option
/// has been used.
static constexpr bool hasFixedValue()
{
return ParsedOptions::HasFixedValue;
}

/// @brief Retrieve number of bits specified member field consumes.
/// @tparam TIdx Index of the member field.
/// @return Number of bits, specified with @ref comms::option::def::FixedBitLength option
Expand Down
22 changes: 15 additions & 7 deletions include/comms/field/BitmaskValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,19 @@ using BitmaskUndertlyingTypeT =
/// using MyField =comms::field::EnumValue<MyFieldBase, comms::option::def::FixedLength<2> >;
/// @endcode
/// Supported options are:
/// @li @ref comms::option::def::FixedLength
/// @li @ref comms::option::def::FixedBitLength
/// @li @ref comms::option::def::DefaultValueInitialiser or comms::option::def::DefaultNumValue.
/// @li @ref comms::option::def::AvailableLengthLimit
/// @li @ref comms::option::def::BitmaskReservedBits.
/// @li @ref comms::option::def::DefaultValueInitialiser or comms::option::def::DefaultNumValue.
/// @li @ref comms::option::def::EmptySerialization
/// @li @ref comms::option::def::FailOnInvalid
/// @li @ref comms::option::def::FieldType
/// @li @ref comms::option::def::FixedBitLength
/// @li @ref comms::option::def::FixedLength
/// @li @ref comms::option::def::FixedValue
/// @li @ref comms::option::def::HasCustomRead
/// @li @ref comms::option::def::HasCustomRefresh
/// @li @ref comms::option::def::FailOnInvalid
/// @li @ref comms::option::def::IgnoreInvalid
/// @li @ref comms::option::def::EmptySerialization
/// @li @ref comms::option::def::VersionStorage
/// @li @ref comms::option::def::AvailableLengthLimit
/// @li @ref comms::option::def::FieldType
/// @extends comms::Field
/// @headerfile comms/field/BitmaskValue.h
/// @see COMMS_BITMASK_BITS()
Expand Down Expand Up @@ -188,6 +189,13 @@ class BitmaskValue : public TFieldBase
return ParsedOptions::HasFieldType;
}

/// @brief Compile time inquiry of whether @ref comms::option::def::FixedValue option
/// has been used.
static constexpr bool hasFixedValue()
{
return ParsedOptions::HasFixedValue;
}

/// @brief Get access to underlying mask value storage.
/// @return Const reference to the underlying stored value.
const ValueType& value() const
Expand Down
16 changes: 12 additions & 4 deletions include/comms/field/Bundle.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ namespace field
/// of the field.@n
/// Supported options are:
/// @li @ref comms::option::def::DefaultValueInitialiser
/// @li @ref comms::option::def::RemLengthMemberField
/// @li @ref comms::option::def::HasCustomRead
/// @li @ref comms::option::def::HasCustomRefresh
/// @li @ref comms::option::def::EmptySerialization
/// @li @ref comms::option::def::VersionStorage
/// @li @ref comms::option::def::FieldType
/// @li @ref comms::option::def::FixedValue
/// @li @ref comms::option::def::HasCustomRead
/// @li @ref comms::option::def::HasCustomRefresh
/// @li @ref comms::option::def::HasVersionDependentMembers
/// @li @ref comms::option::def::RemLengthMemberField
/// @li @ref comms::option::def::VersionStorage
/// @extends comms::Field
/// @headerfile comms/field/Bundle.h
/// @see @ref COMMS_FIELD_MEMBERS_NAMES()
Expand Down Expand Up @@ -144,6 +145,13 @@ class Bundle : public
return ParsedOptions::HasFieldType;
}

/// @brief Compile time inquiry of whether @ref comms::option::def::FixedValue option
/// has been used.
static constexpr bool hasFixedValue()
{
return ParsedOptions::HasFixedValue;
}

/// @brief Get access to the stored tuple of fields.
ValueType& value()
{
Expand Down
30 changes: 19 additions & 11 deletions include/comms/field/EnumValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,24 @@ namespace field
/// defined to be std::uint16_t. The value is serialised using big endian
/// notation because base field class receives comms::option::def::BigEndian option.@n
/// Supported options are:
/// @li @ref comms::option::def::FixedLength
/// @li @ref comms::option::def::FixedBitLength
/// @li @ref comms::option::def::VarLength
/// @li @ref comms::option::def::NumValueSerOffset
/// @li @ref comms::option::def::AvailableLengthLimit
/// @li @ref comms::option::def::DefaultValueInitialiser or @ref comms::option::def::DefaultNumValue.
/// @li @ref comms::option::def::ValidNumValueRange, @ref comms::option::def::ValidNumValue,
/// @ref comms::option::def::ValidBigUnsignedNumValueRange, @ref comms::option::def::ValidBigUnsignedNumValue
/// @li @ref comms::option::def::ValidRangesClear
/// @li @ref comms::option::def::EmptySerialization
/// @li @ref comms::option::def::FailOnInvalid
/// @li @ref comms::option::def::FieldType
/// @li @ref comms::option::def::FixedBitLength
/// @li @ref comms::option::def::FixedLength
/// @li @ref comms::option::def::FixedValue
/// @li @ref comms::option::def::HasCustomRead
/// @li @ref comms::option::def::HasCustomRefresh
/// @li @ref comms::option::def::FailOnInvalid
/// @li @ref comms::option::def::IgnoreInvalid
/// @li @ref comms::option::def::EmptySerialization
/// @li @ref comms::option::def::InvalidByDefault
/// @li @ref comms::option::def::NumValueSerOffset
/// @li @ref comms::option::def::ValidNumValueRange, @ref comms::option::def::ValidNumValue,
/// @ref comms::option::def::ValidBigUnsignedNumValueRange, @ref comms::option::def::ValidBigUnsignedNumValue
/// @li @ref comms::option::def::ValidRangesClear
/// @li @ref comms::option::def::VarLength
/// @li @ref comms::option::def::VersionStorage
/// @li @ref comms::option::def::AvailableLengthLimit
/// @li @ref comms::option::def::FieldType
/// @extends comms::Field
/// @headerfile comms/field/Bundle.h
template <typename TFieldBase, typename TEnum, typename... TOptions>
Expand Down Expand Up @@ -145,6 +146,13 @@ class EnumValue : public details::AdaptBasicFieldT<basic::EnumValue<TFieldBase,
return ParsedOptions::HasFieldType;
}

/// @brief Compile time inquiry of whether @ref comms::option::def::FixedValue option
/// has been used.
static constexpr bool hasFixedValue()
{
return ParsedOptions::HasFixedValue;
}

/// @brief Get access to enum value storage.
const ValueType& value() const
{
Expand Down
24 changes: 16 additions & 8 deletions include/comms/field/FloatValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,20 @@ namespace field
/// be serialised using big endian notation.@n
/// Supported options are:
/// @li @ref comms::option::def::DefaultValueInitialiser or @ref comms::option::def::DefaultNumValue.
/// @li @ref comms::option::def::ValidNumValueRange, @ref comms::option::def::ValidNumValue,
/// @ref comms::option::def::ValidBigUnsignedNumValueRange, @ref comms::option::def::ValidBigUnsignedNumValue
/// @li @ref comms::option::def::ValidRangesClear
/// @li @ref comms::option::def::EmptySerialization
/// @li @ref comms::option::def::FailOnInvalid
/// @li @ref comms::option::def::FieldType
/// @li @ref comms::option::def::FixedValue
/// @li @ref comms::option::def::HasCustomRead
/// @li @ref comms::option::def::HasCustomRefresh
/// @li @ref comms::option::def::FailOnInvalid
/// @li @ref comms::option::def::IgnoreInvalid
/// @li @ref comms::option::def::InvalidByDefault
/// @li @b comms::option::def::Units* - all variants of value units, see
/// @ref sec_field_tutorial_int_value_units for details.
/// @li @ref comms::option::def::EmptySerialization
/// @li @ref comms::option::def::InvalidByDefault
/// @li @ref comms::option::def::ValidNumValueRange, @ref comms::option::def::ValidNumValue,
/// @ref comms::option::def::ValidBigUnsignedNumValueRange, @ref comms::option::def::ValidBigUnsignedNumValue
/// @li @ref comms::option::def::ValidRangesClear
/// @li @ref comms::option::def::VersionStorage
/// @li @ref comms::option::def::FieldType
/// @extends comms::Field
/// @headerfile comms/field/FloatValue.h
template <typename TFieldBase, typename T, typename... TOptions>
Expand Down Expand Up @@ -135,7 +136,14 @@ class FloatValue : public details::AdaptBasicFieldT<basic::FloatValue<TFieldBase
static constexpr bool hasFieldType()
{
return ParsedOptions::HasFieldType;
}
}

/// @brief Compile time inquiry of whether @ref comms::option::def::FixedValue option
/// has been used.
static constexpr bool hasFixedValue()
{
return ParsedOptions::HasFixedValue;
}

/// @brief Get access to floating point value storage.
const ValueType& value() const
Expand Down
34 changes: 21 additions & 13 deletions include/comms/field/IntValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,27 @@ namespace field
/// consume 2 bytes (because sizeof(std::uint16_t) == 2) and will
/// be serialised using big endian notation.@n
/// Supported options are:
/// @li @ref comms::option::def::FixedLength
/// @li @ref comms::option::def::FixedBitLength
/// @li @ref comms::option::def::VarLength
/// @li @ref comms::option::def::NumValueSerOffset
/// @li @ref comms::option::def::AvailableLengthLimit
/// @li @ref comms::option::def::DefaultValueInitialiser or @ref comms::option::def::DefaultNumValue.
/// @li @ref comms::option::def::ValidNumValueRange, @ref comms::option::def::ValidNumValue,
/// @ref comms::option::def::ValidBigUnsignedNumValueRange, @ref comms::option::def::ValidBigUnsignedNumValue
/// @li @ref comms::option::def::ValidRangesClear
/// @li comms::option::def::EmptySerialization
/// @li @ref comms::option::def::FailOnInvalid
/// @li @ref comms::option::def::FieldType
/// @li @ref comms::option::def::FixedBitLength
/// @li @ref comms::option::def::FixedLength
/// @li @ref comms::option::def::FixedValue
/// @li @ref comms::option::def::HasCustomRead
/// @li @ref comms::option::def::HasCustomRefresh
/// @li @ref comms::option::def::FailOnInvalid
/// @li @ref comms::option::def::IgnoreInvalid
/// @li @ref comms::option::def::InvalidByDefault
/// @li @ref comms::option::def::NumValueSerOffset
/// @li @ref comms::option::def::ScalingRatio
/// @li @b comms::option::def::Units* - all variants of value units, see
/// @ref sec_field_tutorial_int_value_units for details.
/// @li comms::option::def::EmptySerialization
/// @li @ref comms::option::def::InvalidByDefault
/// @li @ref comms::option::def::ValidNumValueRange, @ref comms::option::def::ValidNumValue,
/// @ref comms::option::def::ValidBigUnsignedNumValueRange, @ref comms::option::def::ValidBigUnsignedNumValue
/// @li @ref comms::option::def::ValidRangesClear
/// @li @ref comms::option::def::VarLength
/// @li @ref comms::option::def::VersionStorage
/// @li @ref comms::option::def::AvailableLengthLimit
/// @li @ref comms::option::def::FieldType
/// @extends comms::Field
/// @headerfile comms/field/IntValue.h
template <typename TFieldBase, typename T, typename... TOptions>
Expand Down Expand Up @@ -175,7 +176,14 @@ class IntValue : public details::AdaptBasicFieldT<basic::IntValue<TFieldBase, T>
static constexpr bool hasVarLength()
{
return ParsedOptions::HasVarLengthLimits;
}
}

/// @brief Compile time inquiry of whether @ref comms::option::def::FixedValue option
/// has been used.
static constexpr bool hasFixedValue()
{
return ParsedOptions::HasFixedValue;
}

/// @brief Scales value according to ratio specified in provided
/// @ref comms::option::def::ScalingRatio option.
Expand Down
14 changes: 11 additions & 3 deletions include/comms/field/Optional.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ namespace field
/// Supported options are:
/// @li @ref comms::option::def::DefaultValueInitialiser, @ref comms::option::def::DefaultOptionalMode,
/// @ref comms::option::def::OptionalMissingByDefault, or @ref comms::option::def::OptionalExistsByDefault.
/// @li @ref comms::option::def::FieldType
/// @li @ref comms::option::def::FixedValue
/// @li @ref comms::option::def::HasCustomRead
/// @li @ref comms::option::def::HasCustomRefresh
/// @li @ref comms::option::def::VersionStorage
/// @li @ref comms::option::def::FieldType
/// @li @ref comms::option::def::MissingOnReadFail
/// @li @ref comms::option::def::MissingOnInvalid
/// @li @ref comms::option::def::MissingOnReadFail
/// @li @ref comms::option::def::VersionStorage
/// @extends comms::Field
/// @headerfile comms/field/Optional.h
template <typename TField, typename... TOptions>
Expand Down Expand Up @@ -131,6 +132,13 @@ class Optional : public details::AdaptBasicFieldT<basic::Optional<TField>, TOpti
static constexpr bool hasFieldType()
{
return ParsedOptions::HasFieldType;
}

/// @brief Compile time inquiry of whether @ref comms::option::def::FixedValue option
/// has been used.
static constexpr bool hasFixedValue()
{
return ParsedOptions::HasFixedValue;
}

/// @brief Check whether mode is equivalent to Mode::Tentative
Expand Down
Loading

0 comments on commit e32f175

Please sign in to comment.