#include "comms/Field.h"
template<typename... TOptions>
class comms::Field< TOptions >
Base class to all the field classes.
Every custom "field" class should inherit from this one.
- Template Parameters
-
TOptions | Zero or more options. The supported options are:
|
|
using | Endian = typename BaseImpl::Endian |
| Endian type.
|
|
using | VersionType = typename BaseImpl::VersionType |
| Version type.
|
|
|
static constexpr bool | canWrite () |
| Default check of whether the field has a consistent value for writing.
|
|
static constexpr bool | hasNonDefaultRefresh () |
| Default check of whether the field has defines refresh functionality.
|
|
static constexpr bool | hasReadNoStatus () |
| Default check of whether the field has readNoStatus() member function.
|
|
static constexpr bool | hasVarLength () |
| Default check of whether the field has variable length definition via comms::option::def::VarLength option.
|
|
static constexpr bool | hasWriteNoStatus () |
| Default check of whether the field has writeNoStatus() member function.
|
|
static constexpr bool | isVersionDependent () |
| Default check of whether the field is version dependent.
|
|
static constexpr bool | refresh () |
| Default refresh functionality.
|
|
static constexpr bool | setVersion (VersionType) |
| Default version update functionality.
|
|
static constexpr bool | valid () |
| Default validity check.
|
|
|
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.
|
|
◆ Endian
template<typename... TOptions>
using comms::Field< TOptions >::Endian = typename BaseImpl::Endian |
◆ canWrite()
template<typename... TOptions>
static constexpr bool comms::Field< TOptions >::canWrite |
( |
| ) |
|
|
staticconstexpr |
Default check of whether the field has a consistent value for writing.
- Returns
- Always true.
◆ hasNonDefaultRefresh()
template<typename... TOptions>
static constexpr bool comms::Field< TOptions >::hasNonDefaultRefresh |
( |
| ) |
|
|
staticconstexpr |
Default check of whether the field has defines refresh functionality.
- Returns
- Always false.
◆ hasReadNoStatus()
template<typename... TOptions>
static constexpr bool comms::Field< TOptions >::hasReadNoStatus |
( |
| ) |
|
|
staticconstexpr |
Default check of whether the field has readNoStatus() member function.
- Returns
- Always true.
◆ hasVarLength()
template<typename... TOptions>
static constexpr bool comms::Field< TOptions >::hasVarLength |
( |
| ) |
|
|
staticconstexpr |
◆ hasWriteNoStatus()
template<typename... TOptions>
static constexpr bool comms::Field< TOptions >::hasWriteNoStatus |
( |
| ) |
|
|
staticconstexpr |
Default check of whether the field has writeNoStatus() member function.
- Returns
- Always true.
◆ isVersionDependent()
template<typename... TOptions>
static constexpr bool comms::Field< TOptions >::isVersionDependent |
( |
| ) |
|
|
staticconstexpr |
Default check of whether the field is version dependent.
- Returns
- Always false.
◆ readData() [1/2]
template<typename... TOptions>
template<typename T , typename TIter >
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
-
T | Return type |
TIter | Type of input iterator |
- Parameters
-
[in,out] | iter | Input 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 >
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
-
T | Return type |
TSize | number of bytes to read |
TIter | Type of input iterator |
- Parameters
-
[in,out] | iter | Input 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.
◆ refresh()
template<typename... TOptions>
Default refresh functionality.
Does nothing and returns false, can be overriden by the derived class
- Returns
- Always false
◆ setVersion()
template<typename... TOptions>
Default version update functionality.
Does nothing and returns false, can be overriden by the derived class
- Returns
- Always false
◆ valid()
template<typename... TOptions>
Default validity check.
Always returns true, can be overriden by the derived class
- Returns
- Always true
◆ writeData() [1/2]
template<typename... TOptions>
template<typename T , typename TIter >
static void comms::Field< TOptions >::writeData |
( |
T |
value, |
|
|
TIter & |
iter |
|
) |
| |
|
staticprotected |
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
-
T | Type of the value to write. Must be integral. |
Type | of output iterator |
- Parameters
-
[in] | value | Integral type value to be written. |
[in,out] | iter | Output 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 |
( |
T |
value, |
|
|
TIter & |
iter |
|
) |
| |
|
staticprotected |
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
-
TSize | Length of the value in bytes known in compile time. |
T | Type of the value to write. Must be integral. |
TIter | Type of output iterator |
- Parameters
-
[in] | value | Integral type value to be written. |
[in,out] | iter | Output 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.
The documentation for this class was generated from the following file: