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
290 bool operator==(
const int& a)
const
292 return (
int)raw == a;
294 bool operator==(
const long& a)
const
296 return (
long)raw == a;
308 Signed() noexcept: raw(0) {}
310 Signed(
const long& val ) noexcept
315 Signed(
const ModbusRTU::ModbusData dat ) noexcept
338 bool operator== (
const int& a)
const
340 return (
int)raw == a;
342 bool operator== (
const long& a)
const
344 return (
long)raw == a;
355 static const size_t i2Size = 2;
366 memset(raw.v, 0,
sizeof(raw.v));
369 I2( int32_t v ) noexcept
373 I2(
const ModbusRTU::ModbusData* data,
size_t size ) noexcept
375 for(
size_t i = 0; i <
wsize() && i < size; i++ )
406 raw_backorder.val = 0;
409 I2r(
const int32_t v ) noexcept:
I2(v)
412 std::swap(raw_backorder.v[0], raw_backorder.v[1]);
415 I2r(
const ModbusRTU::ModbusData* data,
size_t size ) noexcept:
I2(data, size)
419 std::swap(raw.v[0], raw.v[1]);
432 static const size_t u2Size = 2;
443 memset(raw.v, 0,
sizeof(raw.v));
446 U2( uint32_t v ) noexcept
450 U2(
const ModbusRTU::ModbusData* data,
size_t size ) noexcept
452 for(
size_t i = 0; i <
wsize() && i < size; i++ )
479 operator unsigned long()
481 return (uint32_t)raw.val;
493 raw_backorder.val = 0;
496 U2r( int32_t v ) noexcept:
U2(v)
499 std::swap(raw_backorder.v[0], raw_backorder.v[1]);
502 U2r(
const ModbusRTU::ModbusData* data,
size_t size ) noexcept:
U2(data, size)
506 std::swap(raw.v[0], raw.v[1]);
static VType type()
Definition: VTypes.h:236
static size_t wsize()
Definition: VTypes.h:231
static size_t wsize()
Definition: VTypes.h:88
static VType type()
Definition: VTypes.h:93
static size_t wsize()
Definition: VTypes.h:175
static VType type()
Definition: VTypes.h:180
static size_t wsize()
Definition: VTypes.h:382
static VType type()
Definition: VTypes.h:387
static VType type()
Definition: VTypes.h:328
static size_t wsize()
Definition: VTypes.h:323
static VType type()
Definition: VTypes.h:464
static size_t wsize()
Definition: VTypes.h:459
static VType type()
Definition: VTypes.h:280
static size_t wsize()
Definition: VTypes.h:275
Definition: CommonEventLoop.h:15