template<typename TFieldBase, typename T, typename... TOptions>
class comms::field::FloatValue< TFieldBase, T, TOptions >
Field that represent floating point value.
Represents IEEE 754 floating point value, which means the value is serialised as is (consumes 4 bytes for float, and 8 bytes for double), using big or little endian.
- Template Parameters
-
TFieldBase | Base class for this field, expected to be a variant of comms::Field. |
T | Basic underlying floating point type, must be either float or double. |
TOptions | Zero or more options that modify/refine default behaviour of the field. If no option is provided The field's value is serialised as is.
Base class to all the field classes. Definition: Field.h:33
Field that represent floating point value. Definition: FloatValue.h:60
In the example above it will consume 4 bytes (because sizeof(float) == 4) and will be serialised using big endian notation.
Supported options are:
|
|
template<typename T , typename TIter > |
static T | readData (TIter &iter) |
| Read data from input buffer. More...
|
|
template<typename T , std::size_t TSize, typename TIter > |
static T | readData (TIter &iter) |
| Read partial data from input buffer. More...
|
|
template<typename T , typename TIter > |
static void | writeData (T value, TIter &iter) |
| Write data into the output buffer. More...
|
|
template<std::size_t TSize, typename T , typename TIter > |
static void | writeData (T value, TIter &iter) |
| Write partial data into the output buffer. More...
|
|
|
(Note that these are not member functions.)
|
template<typename T > |
constexpr bool | isFloatValue () |
| Compile time check function of whether a provided type is any variant of comms::field::FloatValue. More...
|
|
template<typename TFieldBase , typename T , typename... TOptions> |
bool | operator!= (const FloatValue< TFieldBase, T, TOptions... > &field1, const FloatValue< TFieldBase, T, TOptions... > &field2) noexcept |
| Non-equality comparison operator. More...
|
|
template<typename TFieldBase , typename T , typename... TOptions> |
bool | operator< (const FloatValue< TFieldBase, T, TOptions... > &field1, const FloatValue< TFieldBase, T, TOptions... > &field2) noexcept |
| Equivalence comparison operator. More...
|
|
template<typename TFieldBase , typename T , typename... TOptions> |
bool | operator== (const FloatValue< TFieldBase, T, TOptions... > &field1, const FloatValue< TFieldBase, T, TOptions... > &field2) noexcept |
| Equality comparison operator. More...
|
|
template<typename TFieldBase , typename T , typename... TOptions> |
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 access to its internal types.
|
|
template<typename TFieldBase , typename T , typename... TOptions> |
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 access to its internal types.
|
|
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.
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.
template<typename TFieldBase , typename T , typename... TOptions>
template<typename TIter >
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] | iter | Iterator to read the data. |
- Postcondition
- Iterator is advanced.
template<typename... TOptions>
template<typename T , typename TIter >
static void comms::Field< TOptions >::writeData |
( |
T |
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
-
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.
template<typename... TOptions>
template<std::size_t TSize, typename T , typename TIter >
static void comms::Field< TOptions >::writeData |
( |
T |
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
-
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.
template<typename TFieldBase , typename T , typename... TOptions>
template<typename TIter >
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] | iter | Iterator to write the data. |
- Postcondition
- Iterator is advanced.