modbuspp
1.1.40
C++ wrapper for the libmodbus library
|
Arithmetic data in multiple 16-bit Modbus registers. More...
#include <data.h>
Public Member Functions | |
Data () | |
Default constructor. More... | |
Data (const T &t) | |
Constructor from a value of T. | |
Endian | endianness () const |
Return the bytes and words endianness. | |
T * | operator & () |
Overload of the pointer operator on the T value. | |
const T * | operator & () const |
operator const T & () const | |
operator T & () | |
Overload of the reference operator on the T value. | |
T & | operator= (const T &t) |
Overload of the assignment operator from a T value. | |
void | print () |
Prints the hexadecimal values of the current T value. More... | |
std::array< uint16_t, sizeof(T)/2 > & | registers () |
Array of Modbus registers corresponding to the T value. | |
const std::array< uint16_t, sizeof(T)/2 > & | registers () const |
Array of Modbus registers corresponding to the T value. | |
void | setEndianness (Endian endian) |
Set the bytes and words endianness. | |
std::size_t | size () const |
Number of bytes of type T. | |
void | swap (T &v) |
Swap bytes and words of a T value v. More... | |
T & | value () |
Access to the T value. | |
const T & | value () const |
Static Public Member Functions | |
static void | print (const uint8_t *p, const size_t s) |
Prints the hexadecimal values of a byte array. More... | |
static void | print (const T &v) |
Prints the hexadecimal values of T value. More... | |
Arithmetic data in multiple 16-bit Modbus registers.
Data is a template class for storing, transmitting, and receiving arithmetic data in multiple 16-bit Modbus registers.
T | is a type of arithmetic data (int, float ...) of a size greater than or equal to 2. |
e | is the order of bytes and words in the data model used by the user's Modbus network. By default it is the big endian order for bytes and words that is used. |
|
inline |
Default constructor.
The default value of T is 0.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlinestatic |
Prints the hexadecimal values of a byte array.
For debugging purpose.
|
inlinestatic |
Prints the hexadecimal values of T value.
For debugging purpose.
References Modbus::Data< T, e >::print().
|
inline |
Prints the hexadecimal values of the current T value.
For debugging purpose.
References Modbus::Data< T, e >::size(), and Modbus::Data< T, e >::swap().
Referenced by Modbus::Data< T, e >::print().
|
inline |
Swap bytes and words of a T value v.
The order used is endianness().
References Modbus::EndianBigBig, Modbus::EndianBigLittle, Modbus::EndianLittleBig, and Modbus::EndianLittleLittle.
Referenced by Modbus::Data< T, e >::print().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.