COMMS
Template library intended to help with implementation of communication protocols.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Related Symbols | List of all members
comms::field::Bundle< TFieldBase, TMembers, TOptions > Class Template Reference

#include "comms/field/Bundle.h"

Detailed Description

template<typename TFieldBase, typename TMembers, typename... TOptions>
class comms::field::Bundle< TFieldBase, TMembers, TOptions >

Bundles multiple fields into a single field.

The class wraps nicely multiple fields and provides expected single field API functions, such as length(), read(), write(), valid(). It may be useful when a collection (comms::field::ArrayList) of complex fields is required.

Refer to Bundle Fields for tutorial and usage examples.

Template Parameters
TFieldBaseBase class for this field, expected to be a variant of comms::Field.
TMembersAll wrapped fields bundled together in std::tuple.
TOptionsZero or more options that modify/refine default behaviour of the field.
Supported options are:
See also
COMMS_FIELD_MEMBERS_NAMES()
COMMS_FIELD_MEMBERS_ACCESS()
COMMS_FIELD_MEMBERS_ACCESS_NOTEMPLATE()
COMMS_FIELD_ALIAS()
Inheritance diagram for comms::field::Bundle< TFieldBase, TMembers, TOptions >:
comms::Field< TOptions >

Public Types

using CommsTag = typename BaseImpl::CommsTag
 Tag indicating type of the field.
 
using Endian = typename BaseImpl::Endian
 Endian used for serialisation.
 
using FieldBase = TFieldBase
 Base class provided in the first template parameter.
 
using FieldType = typename ParsedOptions::FieldType
 Type of actual extending field specified via comms::option::def::FieldType.
 
using ParsedOptions = details::OptionsParser< TOptions... >
 All the options provided to this class bundled into struct.
 
using ValueType = typename BaseImpl::ValueType
 Value type.
 
using VersionType = typename BaseImpl::VersionType
 Version type.
 

Public Member Functions

 Bundle ()=default
 Default constructor.
 
 Bundle (const ValueType &val)
 Constructor.
 
 Bundle (ValueType &&val)
 Constructor.
 
bool canWrite () const
 Check of whether the field has a consistent value for writing.
 
const ValueTypegetValue () const
 Get value.
 
VersionType getVersion () const
 Get version of the field.
 
std::size_t length () const
 Get length required to serialise bundled fields.
 
template<std::size_t TFromIdx>
std::size_t lengthFrom () const
 Get length required to serialise specified bundled member fields.
 
template<std::size_t TFromIdx, std::size_t TUntilIdx>
std::size_t lengthFromUntil () const
 Get length required to serialise specified bundled member fields.
 
template<std::size_t TUntilIdx>
std::size_t lengthUntil () const
 Get length required to serialise specified bundled member fields.
 
template<typename TIter >
ErrorStatus read (TIter &iter, std::size_t size)
 Read field value from input data sequence.
 
template<std::size_t TFromIdx, typename TIter >
ErrorStatus readFrom (TIter &iter, std::size_t len)
 Read selected number of member fields (from specified index).
 
template<std::size_t TFromIdx, typename TIter >
ErrorStatus readFromAndUpdateLen (TIter &iter, std::size_t &len)
 Read selected number of member fields (from specified index) while updating remaining length information.
 
template<std::size_t TFromIdx, typename TIter >
void readFromNoStatus (TIter &iter)
 Read selected member fields from input data sequence without error check and status report.
 
template<std::size_t TFromIdx, std::size_t TUntilIdx, typename TIter >
ErrorStatus readFromUntil (TIter &iter, std::size_t len)
 Read selected number of member fields (between specified indices).
 
template<std::size_t TFromIdx, std::size_t TUntilIdx, typename TIter >
ErrorStatus readFromUntilAndUpdateLen (TIter &iter, std::size_t &len)
 Read selected number of member fields (between specified indices) while updating remaining length information.
 
template<std::size_t TFromIdx, std::size_t TUntilIdx, typename TIter >
void readFromUntilNoStatus (TIter &iter)
 Read selected member fields from input data sequence without error check and status report.
 
template<typename TIter >
void readNoStatus (TIter &iter)
 Read field value from input data sequence without error check and status report.
 
template<std::size_t TUntilIdx, typename TIter >
ErrorStatus readUntil (TIter &iter, std::size_t len)
 Read selected number of member fields (until specified index).
 
template<std::size_t TUntilIdx, typename TIter >
ErrorStatus readUntilAndUpdateLen (TIter &iter, std::size_t &len)
 Read selected number of member fields (until specified index) while updating remaining length information.
 
template<std::size_t TUntilIdx, typename TIter >
void readUntilNoStatus (TIter &iter)
 Read selected member fields from input data sequence without error check and status report.
 
bool refresh ()
 Refresh the field's contents.
 
template<typename U >
void setValue (U &&val)
 Set value.
 
bool setVersion (VersionType version)
 Default implementation of version update.
 
bool valid () const
 Check validity of all the bundled fields.
 
ValueTypevalue ()
 Get access to the stored tuple of fields.
 
const ValueTypevalue () const
 Get access to the stored tuple of fields.
 
template<typename TIter >
ErrorStatus write (TIter &iter, std::size_t size) const
 Write current field value to output data sequence.
 
template<std::size_t TFromIdx, typename TIter >
ErrorStatus writeFrom (TIter &iter, std::size_t size) const
 Write selected member fields to output data sequence.
 
template<std::size_t TFromIdx, typename TIter >
void writeFromNoStatus (TIter &iter)
 Write selected member fields to output data sequence without error check and status report.
 
template<std::size_t TFromIdx, std::size_t TUntilIdx, typename TIter >
ErrorStatus writeFromUntil (TIter &iter, std::size_t size) const
 Write selected member fields to output data sequence.
 
template<std::size_t TFromIdx, std::size_t TUntilIdx, typename TIter >
void writeFromUntilNoStatus (TIter &iter)
 Write selected member fields to output data sequence without error check and status report.
 
template<typename TIter >
void writeNoStatus (TIter &iter) const
 Write current field value to output data sequence without error check and status report.
 
template<std::size_t TUntilIdx, typename TIter >
ErrorStatus writeUntil (TIter &iter, std::size_t size) const
 Write selected member fields to output data sequence.
 
template<std::size_t TUntilIdx, typename TIter >
void writeUntilNoStatus (TIter &iter)
 Write selected member fields to output data sequence without error check and status report.
 

Static Public Member Functions

static constexpr bool canWrite ()
 Default check of whether the field has a consistent value for writing.
 
static constexpr bool hasEmptySerialization ()
 Compile time inquiry of whether comms::option::def::EmptySerialization option has been used.
 
static constexpr bool hasFailOnInvalid ()
 Compile time inquiry of whether comms::option::def::FailOnInvalid option has been used.
 
static constexpr bool hasFieldType ()
 Compile time inquiry of whether comms::option::def::FieldType option has been used.
 
static constexpr bool hasIgnoreInvalid ()
 Compile time inquiry of whether comms::option::def::IgnoreInvalid option has been used.
 
static constexpr bool hasNonDefaultRefresh ()
 Compile time check if this class has non-default refresh functionality.
 
static constexpr bool hasReadNoStatus ()
 Compile time check of whether the field has proper readNoStatus() member function (or similar).
 
static constexpr bool hasVarLength ()
 Default check of whether the field has variable length definition via comms::option::def::VarLength option.
 
static constexpr bool hasWriteNoStatus ()
 Compile time check of whether the field has proper writeNoStatus() member function.
 
static constexpr bool isVersionDependent ()
 Compile time check if this class is version dependent.
 
static constexpr std::size_t maxLength ()
 Get maximal length that is required to serialise all bundled fields.
 
template<std::size_t TFromIdx>
static constexpr std::size_t maxLengthFrom ()
 Get maximal length that is required to serialise specified bundled fields.
 
template<std::size_t TFromIdx, std::size_t TUntilIdx>
static constexpr std::size_t maxLengthFromUntil ()
 Get maximal length that is required to serialise specified bundled fields.
 
template<std::size_t TUntilIdx>
static constexpr std::size_t maxLengthUntil ()
 Get maximal length that is required to serialise specified bundled fields.
 
static constexpr std::size_t minLength ()
 Get minimal length that is required to serialise all bundled fields.
 
template<std::size_t TFromIdx>
static constexpr std::size_t minLengthFrom ()
 Get minimal length that is required to serialise specified bundled fields.
 
template<std::size_t TFromIdx, std::size_t TUntilIdx>
static constexpr std::size_t minLengthFromUntil ()
 Get minimal length that is required to serialise specified bundled fields.
 
template<std::size_t TUntilIdx>
static constexpr std::size_t minLengthUntil ()
 Get minimal length that is required to serialise specified bundled fields.
 
static constexpr bool valid ()
 Default validity check.
 

Static Protected Member Functions

template<typename T , typename TIter >
static T readData (TIter &iter)
 Read data from input buffer.
 
template<typename T , std::size_t TSize, typename TIter >
static T readData (TIter &iter)
 Read partial data from input buffer.
 
template<typename T , typename TIter >
static void writeData (T value, TIter &iter)
 Write data into the output buffer.
 
template<std::size_t TSize, typename T , typename TIter >
static void writeData (T value, TIter &iter)
 Write partial data into the output buffer.
 

Related Symbols

(Note that these are not member symbols.)

template<typename T >
constexpr bool isBundle ()
 Compile time check function of whether a provided type is any variant of comms::field::Bundle.
 
template<typename TFieldBase , typename TMembers , typename... TOptions>
bool operator!= (const Bundle< TFieldBase, TMembers, TOptions... > &field1, const Bundle< TFieldBase, TMembers, TOptions... > &field2) noexcept
 Non-equality comparison operator.
 
template<typename TFieldBase , typename TMembers , typename... TOptions>
bool operator< (const Bundle< TFieldBase, TMembers, TOptions... > &field1, const Bundle< TFieldBase, TMembers, TOptions... > &field2) noexcept
 Equivalence comparison operator.
 
template<typename TFieldBase , typename TMembers , typename... TOptions>
bool operator<= (const Bundle< TFieldBase, TMembers, TOptions... > &field1, const Bundle< TFieldBase, TMembers, TOptions... > &field2) noexcept
 Equivalence comparison operator.
 
template<typename TFieldBase , typename TMembers , typename... TOptions>
bool operator== (const Bundle< TFieldBase, TMembers, TOptions... > &field1, const Bundle< TFieldBase, TMembers, TOptions... > &field2) noexcept
 Equality comparison operator.
 
template<typename TFieldBase , typename TMembers , typename... TOptions>
bool operator> (const Bundle< TFieldBase, TMembers, TOptions... > &field1, const Bundle< TFieldBase, TMembers, TOptions... > &field2) noexcept
 Equivalence comparison operator.
 
template<typename TFieldBase , typename TMembers , typename... TOptions>
bool operator>= (const Bundle< TFieldBase, TMembers, TOptions... > &field1, const Bundle< TFieldBase, TMembers, TOptions... > &field2) noexcept
 Equivalence comparison operator.
 

Member Typedef Documentation

◆ FieldType

template<typename TFieldBase , typename TMembers , typename... TOptions>
using comms::field::Bundle< TFieldBase, TMembers, TOptions >::FieldType = typename ParsedOptions::FieldType

Type of actual extending field specified via comms::option::def::FieldType.

void if comms::option::def::FieldType hasn't been applied.

◆ ValueType

template<typename TFieldBase , typename TMembers , typename... TOptions>
using comms::field::Bundle< TFieldBase, TMembers, TOptions >::ValueType = typename BaseImpl::ValueType

Value type.

Same as TMemebers template argument, i.e. it is std::tuple of all the wrapped fields.

Constructor & Destructor Documentation

◆ Bundle()

template<typename TFieldBase , typename TMembers , typename... TOptions>
comms::field::Bundle< TFieldBase, TMembers, TOptions >::Bundle ( )
default

Default constructor.

Invokes default constructor of every wrapped field

Member Function Documentation

◆ canWrite()

template<typename... TOptions>
static constexpr bool comms::Field< TOptions >::canWrite ( )
staticconstexprinherited

Default check of whether the field has a consistent value for writing.

Returns
Always true.

◆ getValue()

template<typename TFieldBase , typename TMembers , typename... TOptions>
const ValueType & comms::field::Bundle< TFieldBase, TMembers, TOptions >::getValue ( ) const

Get value.

Implemented by calling value(), but can be overriden in the derived class

◆ getVersion()

template<typename TFieldBase , typename TMembers , typename... TOptions>
VersionType comms::field::Bundle< TFieldBase, TMembers, TOptions >::getVersion ( ) const

Get version of the field.

Exists only if comms::option::def::VersionStorage option has been provided.

◆ hasVarLength()

template<typename... TOptions>
static constexpr bool comms::Field< TOptions >::hasVarLength ( )
staticconstexprinherited

Default check of whether the field has variable length definition via comms::option::def::VarLength option.

Returns
Always false.

◆ length()

template<typename TFieldBase , typename TMembers , typename... TOptions>
std::size_t comms::field::Bundle< TFieldBase, TMembers, TOptions >::length ( ) const

Get length required to serialise bundled fields.

Summarises all the results returned by the call to length() for every field in the bundle.

Returns
Number of bytes it will take to serialise the field value.

◆ lengthFrom()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TFromIdx>
std::size_t comms::field::Bundle< TFieldBase, TMembers, TOptions >::lengthFrom ( ) const

Get length required to serialise specified bundled member fields.

Summarises all the results returned by the call to length() for every specified field in the bundle.

Template Parameters
TFromIdxIndex of the field (included) from which the counting must start.
Returns
Number of bytes it will take to serialise the specified member fields.
Precondition
TFromIdx < std::tuple_size<ValueType>::value

◆ lengthFromUntil()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TFromIdx, std::size_t TUntilIdx>
std::size_t comms::field::Bundle< TFieldBase, TMembers, TOptions >::lengthFromUntil ( ) const

Get length required to serialise specified bundled member fields.

Summarises all the results returned by the call to length() for every specified field in the bundle.

Template Parameters
TFromIdxIndex of the field (included) from which the counting must start.
TUntilIdxIndex of the field (not included) until which the counting must be performed.
Returns
Number of bytes it will take to serialise the specified member fields.
Precondition
TUntilIdx <= std::tuple_size<ValueType>::value
TFromIdx < TUntilIdx

◆ lengthUntil()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TUntilIdx>
std::size_t comms::field::Bundle< TFieldBase, TMembers, TOptions >::lengthUntil ( ) const

Get length required to serialise specified bundled member fields.

Summarises all the results returned by the call to length() for every specified field in the bundle.

Template Parameters
TUntilIdxIndex of the field (not included) until which the counting must be performed.
Returns
Number of bytes it will take to serialise the specified member fields.
Precondition
TUntilIdx <= std::tuple_size<ValueType>::value

◆ maxLength()

template<typename TFieldBase , typename TMembers , typename... TOptions>
static constexpr std::size_t comms::field::Bundle< TFieldBase, TMembers, TOptions >::maxLength ( )
staticconstexpr

Get maximal length that is required to serialise all bundled fields.

Returns
Maximal number of bytes required serialise the field value.

◆ maxLengthFrom()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TFromIdx>
static constexpr std::size_t comms::field::Bundle< TFieldBase, TMembers, TOptions >::maxLengthFrom ( )
staticconstexpr

Get maximal length that is required to serialise specified bundled fields.

Template Parameters
TFromIdxIndex of the field (included) from which the counting must start.
Returns
Minimal number of bytes required to serialise the specified member fields.
Precondition
TFromIdx < std::tuple_size<ValueType>::value

◆ maxLengthFromUntil()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TFromIdx, std::size_t TUntilIdx>
static constexpr std::size_t comms::field::Bundle< TFieldBase, TMembers, TOptions >::maxLengthFromUntil ( )
staticconstexpr

Get maximal length that is required to serialise specified bundled fields.

Template Parameters
TFromIdxIndex of the field (included) from which the counting must start.
TUntilIdxIndex of the field (not included) until which the counting must be performed.
Returns
Minimal number of bytes required to serialise the specified member fields.
Precondition
TUntilIdx <= std::tuple_size<ValueType>::value
TFromIdx < TUntilIdx

◆ maxLengthUntil()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TUntilIdx>
static constexpr std::size_t comms::field::Bundle< TFieldBase, TMembers, TOptions >::maxLengthUntil ( )
staticconstexpr

Get maximal length that is required to serialise specified bundled fields.

Template Parameters
TUntilIdxIndex of the field (not included) until which the counting must be performed.
Returns
Minimal number of bytes required to serialise the specified member fields.
Precondition
TUntilIdx <= std::tuple_size<ValueType>::value

◆ minLength()

template<typename TFieldBase , typename TMembers , typename... TOptions>
static constexpr std::size_t comms::field::Bundle< TFieldBase, TMembers, TOptions >::minLength ( )
staticconstexpr

Get minimal length that is required to serialise all bundled fields.

Returns
Minimal number of bytes required serialise the field value.

◆ minLengthFrom()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TFromIdx>
static constexpr std::size_t comms::field::Bundle< TFieldBase, TMembers, TOptions >::minLengthFrom ( )
staticconstexpr

Get minimal length that is required to serialise specified bundled fields.

Template Parameters
TFromIdxIndex of the field (included) from which the counting must start.
Returns
Minimal number of bytes required to serialise the specified member fields.
Precondition
TFromIdx < std::tuple_size<ValueType>::value

◆ minLengthFromUntil()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TFromIdx, std::size_t TUntilIdx>
static constexpr std::size_t comms::field::Bundle< TFieldBase, TMembers, TOptions >::minLengthFromUntil ( )
staticconstexpr

Get minimal length that is required to serialise specified bundled fields.

Template Parameters
TFromIdxIndex of the field (included) from which the counting must start.
TUntilIdxIndex of the field (not included) until which the counting must be performed.
Returns
Minimal number of bytes required to serialise the specified member fields.
Precondition
TUntilIdx <= std::tuple_size<ValueType>::value
TFromIdx < TUntilIdx

◆ minLengthUntil()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TUntilIdx>
static constexpr std::size_t comms::field::Bundle< TFieldBase, TMembers, TOptions >::minLengthUntil ( )
staticconstexpr

Get minimal length that is required to serialise specified bundled fields.

Template Parameters
TUntilIdxIndex of the field (not included) until which the counting must be performed.
Returns
Minimal number of bytes required to serialise the specified member fields.
Precondition
TUntilIdx <= std::tuple_size<ValueType>::value

◆ read()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<typename TIter >
ErrorStatus comms::field::Bundle< TFieldBase, TMembers, TOptions >::read ( TIter &  iter,
std::size_t  size 
)

Read field value from input data sequence.

Invokes read() member function over every bundled field.

Parameters
[in,out]iterIterator to read the data.
[in]sizeNumber of bytes available for reading.
Returns
Status of read operation.
Postcondition
Iterator is advanced.

◆ readData() [1/2]

template<typename... TOptions>
template<typename T , typename TIter >
static T comms::Field< TOptions >::readData ( TIter &  iter)
staticprotectedinherited

Read data from input buffer.

Use this function to read data from the intput buffer maintained by the caller. The endianness of the data will be as specified in options of the class.

Template Parameters
TReturn type
TIterType of input iterator
Parameters
[in,out]iterInput iterator.
Returns
The integral type value.
Precondition
TSize <= sizeof(T)
The iterator must be valid and can be successfully dereferenced and incremented at least sizeof(T) times.
Postcondition
The iterator is advanced.
Note
Thread safety: Safe for distinct stream buffers, unsafe otherwise.

◆ readData() [2/2]

template<typename... TOptions>
template<typename T , std::size_t TSize, typename TIter >
static T comms::Field< TOptions >::readData ( TIter &  iter)
staticprotectedinherited

Read partial data from input buffer.

Use this function to read data from the intput buffer maintained by the caller. The endianness of the data will be as specified in options of the class.

Template Parameters
TReturn type
TSizenumber of bytes to read
TIterType of input iterator
Parameters
[in,out]iterInput iterator.
Returns
The integral type value.
Precondition
TSize <= sizeof(T)
The iterator must be valid and can be successfully dereferenced and incremented at least TSize times.
Postcondition
The internal pointer of the stream buffer is advanced.
Note
Thread safety: Safe for distinct stream buffers, unsafe otherwise.

◆ readFrom()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TFromIdx, typename TIter >
ErrorStatus comms::field::Bundle< TFieldBase, TMembers, TOptions >::readFrom ( TIter &  iter,
std::size_t  len 
)

Read selected number of member fields (from specified index).

Similar to read(), but invokes read() member function of only selected member fields.

Template Parameters
TFromIdxIndex of the member field (included) from which the "read" operation starts
Parameters
[in,out]iterIterator to read the data.
[in]lenNumber of bytes available for reading.
Returns
Status of read operation.
Precondition
TFromIdx < std::tuple_size<ValueType>
Postcondition
Iterator is advanced.

◆ readFromAndUpdateLen()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TFromIdx, typename TIter >
ErrorStatus comms::field::Bundle< TFieldBase, TMembers, TOptions >::readFromAndUpdateLen ( TIter &  iter,
std::size_t &  len 
)

Read selected number of member fields (from specified index) while updating remaining length information.

Similar to readFrom(), but updates provided length information. Number of consumed bytes are subsctruced from provided length value.

Template Parameters
TFromIdxIndex of the member field (included) from which the "read" operation starts
Parameters
[in,out]iterIterator to read the data.
[in,out]lenNumber of bytes available for reading.
Returns
Status of read operation.
Precondition
TFromIdx < std::tuple_size<ValueType>
Postcondition
Iterator is advanced.

◆ readFromNoStatus()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TFromIdx, typename TIter >
void comms::field::Bundle< TFieldBase, TMembers, TOptions >::readFromNoStatus ( TIter &  iter)

Read selected member fields from input data sequence without error check and status report.

Similar to readNoStatus(), but invokes readNoStatus() of only selected member fields.

Template Parameters
TFromIdxIndex of the member field (included) from which the "read" operation starts
Parameters
[in,out]iterIterator to read the data.
Precondition
TFromIdx < std::tuple_size<ValueType>
Postcondition
Iterator is advanced.

◆ readFromUntil()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TFromIdx, std::size_t TUntilIdx, typename TIter >
ErrorStatus comms::field::Bundle< TFieldBase, TMembers, TOptions >::readFromUntil ( TIter &  iter,
std::size_t  len 
)

Read selected number of member fields (between specified indices).

Similar to read(), but invokes read() member function of only selected member fields.

Template Parameters
TFromIdxIndex of the member field (included) from which the "read" operation starts
TUntilIdxIndex of the member field (NOT included) until which the "read" operation continues.
Parameters
[in,out]iterIterator to read the data.
[in]lenNumber of bytes available for reading.
Returns
Status of read operation.
Precondition
TUntilIdx <= std::tuple_size<ValueType>
TFromIdx < TUntilIdx
Postcondition
Iterator is advanced.

◆ readFromUntilAndUpdateLen()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TFromIdx, std::size_t TUntilIdx, typename TIter >
ErrorStatus comms::field::Bundle< TFieldBase, TMembers, TOptions >::readFromUntilAndUpdateLen ( TIter &  iter,
std::size_t &  len 
)

Read selected number of member fields (between specified indices) while updating remaining length information.

Similar to readFromUntil(), but updates provided length information. Number of consumed bytes are subsctruced from provided length value.

Template Parameters
TFromIdxIndex of the member field (included) from which the "read" operation starts
TUntilIdxIndex of the member field (NOT included) until which the "read" operation continues.
Parameters
[in,out]iterIterator to read the data.
[in,out]lenNumber of bytes available for reading.
Returns
Status of read operation.
Precondition
TUntilIdx <= std::tuple_size<ValueType>
TFromIdx < TUntilIdx
Postcondition
Iterator is advanced.

◆ readFromUntilNoStatus()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TFromIdx, std::size_t TUntilIdx, typename TIter >
void comms::field::Bundle< TFieldBase, TMembers, TOptions >::readFromUntilNoStatus ( TIter &  iter)

Read selected member fields from input data sequence without error check and status report.

Similar to readNoStatus(), but invokes readNoStatus() of only selected member fields.

Template Parameters
TFromIdxIndex of the member field (included) from which the "read" operation starts
TUntilIdxIndex of the member field (NOT included) until which the "read" operation continues.
Parameters
[in,out]iterIterator to read the data.
Precondition
TUntilIdx <= std::tuple_size<ValueType>
TFromIdx < TUntilIdx
Postcondition
Iterator is advanced.

◆ readNoStatus()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<typename TIter >
void comms::field::Bundle< TFieldBase, TMembers, TOptions >::readNoStatus ( TIter &  iter)

Read field value from input data sequence without error check and status report.

Similar to read(), but doesn't perform any correctness checks and doesn't report any failures.

Parameters
[in,out]iterIterator to read the data.
Postcondition
Iterator is advanced.

◆ readUntil()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TUntilIdx, typename TIter >
ErrorStatus comms::field::Bundle< TFieldBase, TMembers, TOptions >::readUntil ( TIter &  iter,
std::size_t  len 
)

Read selected number of member fields (until specified index).

Similar to read(), but invokes read() member function of only selected member fields.

Template Parameters
TUntilIdxIndex of the member field (NOT included) until which the "read" operation continues.
Parameters
[in,out]iterIterator to read the data.
[in]lenNumber of bytes available for reading.
Returns
Status of read operation.
Precondition
TUntilIdx <= std::tuple_size<ValueType>
Postcondition
Iterator is advanced.

◆ readUntilAndUpdateLen()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TUntilIdx, typename TIter >
ErrorStatus comms::field::Bundle< TFieldBase, TMembers, TOptions >::readUntilAndUpdateLen ( TIter &  iter,
std::size_t &  len 
)

Read selected number of member fields (until specified index) while updating remaining length information.

Similar to readUntil(), but updates provided length information. Number of consumed bytes are subsctruced from provided length value.

Template Parameters
TUntilIdxIndex of the member field (NOT included) until which the "read" operation continues.
Parameters
[in,out]iterIterator to read the data.
[in,out]lenNumber of bytes available for reading.
Returns
Status of read operation.
Precondition
TUntilIdx <= std::tuple_size<ValueType>
Postcondition
Iterator is advanced.

◆ readUntilNoStatus()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TUntilIdx, typename TIter >
void comms::field::Bundle< TFieldBase, TMembers, TOptions >::readUntilNoStatus ( TIter &  iter)

Read selected member fields from input data sequence without error check and status report.

Similar to readNoStatus(), but invokes readNoStatus() of only selected member fields.

Template Parameters
TUntilIdxIndex of the member field (NOT included) until which the "read" operation continues.
Parameters
[in,out]iterIterator to read the data.
Precondition
TUntilIdx <= std::tuple_size<ValueType>
Postcondition
Iterator is advanced.

◆ refresh()

template<typename TFieldBase , typename TMembers , typename... TOptions>
bool comms::field::Bundle< TFieldBase, TMembers, TOptions >::refresh ( )

Refresh the field's contents.

Calls refresh() member function on every member field, will return true if any of the calls returns true.

◆ setValue()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<typename U >
void comms::field::Bundle< TFieldBase, TMembers, TOptions >::setValue ( U &&  val)

Set value.

Implemented as re-assigning to value(), but can be overriden in the derived class.

◆ setVersion()

template<typename TFieldBase , typename TMembers , typename... TOptions>
bool comms::field::Bundle< TFieldBase, TMembers, TOptions >::setVersion ( VersionType  version)

Default implementation of version update.

Returns
true in case the field contents have changed, false otherwise

◆ valid()

template<typename... TOptions>
static constexpr bool comms::Field< TOptions >::valid ( )
staticconstexprinherited

Default validity check.

Always returns true, can be overriden by the derived class

Returns
Always true

◆ write()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<typename TIter >
ErrorStatus comms::field::Bundle< TFieldBase, TMembers, TOptions >::write ( TIter &  iter,
std::size_t  size 
) const

Write current field value to output data sequence.

Invokes write() member function over every bundled field.

Parameters
[in,out]iterIterator to write the data.
[in]sizeMaximal number of bytes that can be written.
Returns
Status of write operation.
Postcondition
Iterator is advanced.

◆ writeData() [1/2]

template<typename... TOptions>
template<typename T , typename TIter >
static void comms::Field< TOptions >::writeData ( value,
TIter &  iter 
)
staticprotectedinherited

Write data into the output buffer.

Use this function to write data to the the buffer maintained by the caller. The endianness of the data will be as specified in the options provided to the class.

Template Parameters
TType of the value to write. Must be integral.
Typeof output iterator
Parameters
[in]valueIntegral type value to be written.
[in,out]iterOutput iterator.
Precondition
The iterator must be valid and can be successfully dereferenced and incremented at least sizeof(T) times.
Postcondition
The iterator is advanced.
Note
Thread safety: Safe for distinct buffers, unsafe otherwise.

◆ writeData() [2/2]

template<typename... TOptions>
template<std::size_t TSize, typename T , typename TIter >
static void comms::Field< TOptions >::writeData ( value,
TIter &  iter 
)
staticprotectedinherited

Write partial data into the output buffer.

Use this function to write partial data to the buffer maintained by the caller. The endianness of the data will be as specified the class options.

Template Parameters
TSizeLength of the value in bytes known in compile time.
TType of the value to write. Must be integral.
TIterType of output iterator
Parameters
[in]valueIntegral type value to be written.
[in,out]iterOutput iterator.
Precondition
TSize <= sizeof(T)
The iterator must be valid and can be successfully dereferenced and incremented at least TSize times.
Postcondition
The iterator is advanced.
Note
Thread safety: Safe for distinct buffers, unsafe otherwise.

◆ writeFrom()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TFromIdx, typename TIter >
ErrorStatus comms::field::Bundle< TFieldBase, TMembers, TOptions >::writeFrom ( TIter &  iter,
std::size_t  size 
) const

Write selected member fields to output data sequence.

Similar to write(), but invokes write member function of only selected member fields.

Template Parameters
TFromIdxIndex of the member field (included) from which the "write" operation starts.
Parameters
[in,out]iterIterator to write the data.
[in]sizeMaximal number of bytes that can be written.
Returns
Status of write operation.
Precondition
TFromIdx < std::tuple_size<ValueType>
Postcondition
Iterator is advanced.

◆ writeFromNoStatus()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TFromIdx, typename TIter >
void comms::field::Bundle< TFieldBase, TMembers, TOptions >::writeFromNoStatus ( TIter &  iter)

Write selected member fields to output data sequence without error check and status report.

Similar to writeNoStatus(), but invokes writeNoStatus() of only selected member fields.

Template Parameters
TFromIdxIndex of the member field (included) from which the "write" operation starts
Parameters
[in,out]iterIterator to read the data.
Precondition
TFromIdx < std::tuple_size<ValueType>
Postcondition
Iterator is advanced.

◆ writeFromUntil()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TFromIdx, std::size_t TUntilIdx, typename TIter >
ErrorStatus comms::field::Bundle< TFieldBase, TMembers, TOptions >::writeFromUntil ( TIter &  iter,
std::size_t  size 
) const

Write selected member fields to output data sequence.

Similar to write(), but invokes write member function of only selected member fields.

Template Parameters
TFromIdxIndex of the member field (included) from which the "write" operation starts.
TUntilIdxIndex of the member field (NOT included) until which the "write" operation continues.
Parameters
[in,out]iterIterator to write the data.
[in]sizeMaximal number of bytes that can be written.
Returns
Status of write operation.
Precondition
TUntilIdx <= std::tuple_size<ValueType>
TFromIdx < TUntilIdx
Postcondition
Iterator is advanced.

◆ writeFromUntilNoStatus()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TFromIdx, std::size_t TUntilIdx, typename TIter >
void comms::field::Bundle< TFieldBase, TMembers, TOptions >::writeFromUntilNoStatus ( TIter &  iter)

Write selected member fields to output data sequence without error check and status report.

Similar to writeNoStatus(), but invokes writeNoStatus() of only selected member fields.

Template Parameters
TFromIdxIndex of the member field (included) from which the "write" operation starts
TUntilIdxIndex of the member field (NOT included) until which the "write" operation continues.
Parameters
[in,out]iterIterator to read the data.
Precondition
TUntilIdx <= std::tuple_size<ValueType>
Postcondition
Iterator is advanced.

◆ writeNoStatus()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<typename TIter >
void comms::field::Bundle< TFieldBase, TMembers, TOptions >::writeNoStatus ( TIter &  iter) const

Write current field value to output data sequence without error check and status report.

Similar to write(), but doesn't perform any correctness checks and doesn't report any failures.

Parameters
[in,out]iterIterator to write the data.
Postcondition
Iterator is advanced.

◆ writeUntil()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TUntilIdx, typename TIter >
ErrorStatus comms::field::Bundle< TFieldBase, TMembers, TOptions >::writeUntil ( TIter &  iter,
std::size_t  size 
) const

Write selected member fields to output data sequence.

Similar to write(), but invokes write member function of only selected member fields.

Template Parameters
TUntilIdxIndex of the member field (NOT included) until which the "write" operation continues.
Parameters
[in,out]iterIterator to write the data.
[in]sizeMaximal number of bytes that can be written.
Returns
Status of write operation.
Precondition
TUntilIdx <= std::tuple_size<ValueType>
Postcondition
Iterator is advanced.

◆ writeUntilNoStatus()

template<typename TFieldBase , typename TMembers , typename... TOptions>
template<std::size_t TUntilIdx, typename TIter >
void comms::field::Bundle< TFieldBase, TMembers, TOptions >::writeUntilNoStatus ( TIter &  iter)

Write selected member fields to output data sequence without error check and status report.

Similar to writeNoStatus(), but invokes writeNoStatus() of only selected member fields.

Template Parameters
TUntilIdxIndex of the member field (NOT included) until which the "write" operation continues.
Parameters
[in,out]iterIterator to read the data.
Precondition
TUntilIdx <= std::tuple_size<ValueType>
Postcondition
Iterator is advanced.

Friends And Related Symbol Documentation

◆ isBundle()

template<typename T >
constexpr bool isBundle ( )
related

Compile time check function of whether a provided type is any variant of comms::field::Bundle.

Template Parameters
TAny type.
Returns
true in case provided type is any variant of Bundle

◆ operator!=()

template<typename TFieldBase , typename TMembers , typename... TOptions>
bool operator!= ( const Bundle< TFieldBase, TMembers, TOptions... > &  field1,
const Bundle< TFieldBase, TMembers, TOptions... > &  field2 
)
related

Non-equality comparison operator.

Parameters
[in]field1First field.
[in]field2Second field.
Returns
true in case fields are NOT equal, false otherwise.

◆ operator<()

template<typename TFieldBase , typename TMembers , typename... TOptions>
bool operator< ( const Bundle< TFieldBase, TMembers, TOptions... > &  field1,
const Bundle< TFieldBase, TMembers, TOptions... > &  field2 
)
related

Equivalence comparison operator.

Parameters
[in]field1First field.
[in]field2Second field.

◆ operator<=()

template<typename TFieldBase , typename TMembers , typename... TOptions>
bool operator<= ( const Bundle< TFieldBase, TMembers, TOptions... > &  field1,
const Bundle< TFieldBase, TMembers, TOptions... > &  field2 
)
related

Equivalence comparison operator.

Parameters
[in]field1First field.
[in]field2Second field.

◆ operator==()

template<typename TFieldBase , typename TMembers , typename... TOptions>
bool operator== ( const Bundle< TFieldBase, TMembers, TOptions... > &  field1,
const Bundle< TFieldBase, TMembers, TOptions... > &  field2 
)
related

Equality comparison operator.

Parameters
[in]field1First field.
[in]field2Second field.
Returns
true in case fields are equal, false otherwise.

◆ operator>()

template<typename TFieldBase , typename TMembers , typename... TOptions>
bool operator> ( const Bundle< TFieldBase, TMembers, TOptions... > &  field1,
const Bundle< TFieldBase, TMembers, TOptions... > &  field2 
)
related

Equivalence comparison operator.

Parameters
[in]field1First field.
[in]field2Second field.

◆ operator>=()

template<typename TFieldBase , typename TMembers , typename... TOptions>
bool operator>= ( const Bundle< TFieldBase, TMembers, TOptions... > &  field1,
const Bundle< TFieldBase, TMembers, TOptions... > &  field2 
)
related

Equivalence comparison operator.

Parameters
[in]field1First field.
[in]field2Second field.

The documentation for this class was generated from the following file: