26 #include "modbus/ModbusTypes.h" 49 std::ostream& operator<<( std::ostream& os,
const VType& vt );
52 std::string type2str( VType t ) noexcept;
53 VType str2type(
const std::string& s ) noexcept;
54 int wsize( VType t ) noexcept;
61 static const size_t f2Size = 2;
72 memset(raw.v, 0,
sizeof(raw.v));
75 F2(
const float& f ) noexcept
79 F2(
const ModbusRTU::ModbusData* data,
size_t size ) noexcept
81 for(
size_t i = 0; i <
wsize() && i < size; i++ )
104 return lroundf(raw.val);
108 return lroundf(raw.val);
123 raw_backorder.val = 0;
126 F2r(
const float& f ) noexcept:
F2(f)
129 std::swap(raw_backorder.v[0], raw_backorder.v[1]);
131 F2r(
const ModbusRTU::ModbusData* data,
size_t size ) noexcept:
F2(data, size)
135 std::swap(raw.v[0], raw.v[1]);
147 static const size_t f4Size = 4;
158 memset(raw.v, 0,
sizeof(raw.v));
161 F4(
const double& f ) noexcept
163 memset(raw.v, 0,
sizeof(raw.v));
166 F4(
const ModbusRTU::ModbusData* data,
size_t size ) noexcept
168 for(
size_t i = 0; i <
wsize() && i < size; i++ )
191 return lroundf(raw.val);
201 static const size_t bsize = 2;
217 Byte( uint8_t b1, uint8_t b2 ) noexcept
223 Byte(
const ModbusRTU::ModbusData dat ) noexcept
246 uint8_t operator[](
const size_t i )
262 Unsigned(
const long& val ) noexcept
267 Unsigned(
const ModbusRTU::ModbusData dat ) noexcept
299 Signed() noexcept: raw(0) {}
301 Signed(
const long& val ) noexcept
306 Signed(
const ModbusRTU::ModbusData dat ) noexcept
337 static const size_t i2Size = 2;
348 memset(raw.v, 0,
sizeof(raw.v));
351 I2( int32_t v ) noexcept
355 I2(
const ModbusRTU::ModbusData* data,
size_t size ) noexcept
357 for(
size_t i = 0; i <
wsize() && i < size; i++ )
388 raw_backorder.val = 0;
391 I2r(
const int32_t v ) noexcept:
I2(v)
394 std::swap(raw_backorder.v[0], raw_backorder.v[1]);
397 I2r(
const ModbusRTU::ModbusData* data,
size_t size ) noexcept:
I2(data, size)
401 std::swap(raw.v[0], raw.v[1]);
414 static const size_t u2Size = 2;
425 memset(raw.v, 0,
sizeof(raw.v));
428 U2( uint32_t v ) noexcept
432 U2(
const ModbusRTU::ModbusData* data,
size_t size ) noexcept
434 for(
size_t i = 0; i <
wsize() && i < size; i++ )
461 operator unsigned long()
463 return (uint32_t)raw.val;
475 raw_backorder.val = 0;
478 U2r( int32_t v ) noexcept:
U2(v)
481 std::swap(raw_backorder.v[0], raw_backorder.v[1]);
484 U2r(
const ModbusRTU::ModbusData* data,
size_t size ) noexcept:
U2(data, size)
488 std::swap(raw.v[0], raw.v[1]);
501 #endif // _RTUTypes_H_
Definition: CommonEventLoop.h:14
static VType type()
Definition: VTypes.h:180
static size_t wsize()
Definition: VTypes.h:275
static VType type()
Definition: VTypes.h:319
static VType type()
Definition: VTypes.h:236
static size_t wsize()
Definition: VTypes.h:314
static size_t wsize()
Definition: VTypes.h:231
static VType type()
Definition: VTypes.h:446
static size_t wsize()
Definition: VTypes.h:364
static VType type()
Definition: VTypes.h:280
static size_t wsize()
Definition: VTypes.h:88
static VType type()
Definition: VTypes.h:93
static size_t wsize()
Definition: VTypes.h:441
static VType type()
Definition: VTypes.h:369
static size_t wsize()
Definition: VTypes.h:175