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 float& f ) noexcept
165 F4(
const ModbusRTU::ModbusData* data,
size_t size ) noexcept
167 for(
size_t i = 0; i <
wsize() && i < size; i++ )
190 return lroundf(raw.val);
200 static const size_t bsize = 2;
216 Byte( uint8_t b1, uint8_t b2 ) noexcept
222 Byte(
const ModbusRTU::ModbusData dat ) noexcept
245 uint8_t operator[](
const size_t i )
261 Unsigned(
const long& val ) noexcept
266 Unsigned(
const ModbusRTU::ModbusData dat ) noexcept
298 Signed() noexcept: raw(0) {}
300 Signed(
const long& val ) noexcept
305 Signed(
const ModbusRTU::ModbusData dat ) noexcept
336 static const size_t i2Size = 2;
347 memset(raw.v, 0,
sizeof(raw.v));
350 I2( int32_t v ) noexcept
354 I2(
const ModbusRTU::ModbusData* data,
size_t size ) noexcept
356 for(
size_t i = 0; i <
wsize() && i < size; i++ )
387 raw_backorder.val = 0;
390 I2r(
const int32_t v ) noexcept:
I2(v)
393 std::swap(raw_backorder.v[0], raw_backorder.v[1]);
396 I2r(
const ModbusRTU::ModbusData* data,
size_t size ) noexcept:
I2(data, size)
400 std::swap(raw.v[0], raw.v[1]);
413 static const size_t u2Size = 2;
424 memset(raw.v, 0,
sizeof(raw.v));
427 U2( uint32_t v ) noexcept
431 U2(
const ModbusRTU::ModbusData* data,
size_t size ) noexcept
433 for(
size_t i = 0; i <
wsize() && i < size; i++ )
460 operator unsigned long()
462 return (uint32_t)raw.val;
474 raw_backorder.val = 0;
477 U2r( int32_t v ) noexcept:
U2(v)
480 std::swap(raw_backorder.v[0], raw_backorder.v[1]);
483 U2r(
const ModbusRTU::ModbusData* data,
size_t size ) noexcept:
U2(data, size)
487 std::swap(raw.v[0], raw.v[1]);
500 #endif // _RTUTypes_H_
Definition: CallbackTimer.h:29
static VType type()
Definition: VTypes.h:179
static size_t wsize()
Definition: VTypes.h:274
static VType type()
Definition: VTypes.h:318
static VType type()
Definition: VTypes.h:235
static size_t wsize()
Definition: VTypes.h:313
static size_t wsize()
Definition: VTypes.h:230
static VType type()
Definition: VTypes.h:445
static size_t wsize()
Definition: VTypes.h:363
static VType type()
Definition: VTypes.h:279
static size_t wsize()
Definition: VTypes.h:88
static VType type()
Definition: VTypes.h:93
static size_t wsize()
Definition: VTypes.h:440
static VType type()
Definition: VTypes.h:368
static size_t wsize()
Definition: VTypes.h:174