#include "wb_giraff_main_serial.h"
#include <arpa/inet.h>
#include <sstream>
Go to the source code of this file.
|
#define | DELIMITER ',' |
|
#define | SEP ':' |
|
#define | PARSER(s, c, p) if (k.compare(s) == 0) { set_##c ( p ); continue; } |
|
#define | SV std::vector<std::string> |
|
#define | COMP(v, s) v.compare(0, 2, s) == 0 |
|
#define | IS_HEX(v) COMP(v, "F*") || COMP(v, "I*") |
|
#define | READ_HEX(v) htonl(strtol(v.c_str()+2, NULL, 16)) |
|
#define | PARSE_HEX_FLOAT(v) static_cast<float>(READ_HEX(v)) |
|
#define | PARSE_HEX_INT32(v) static_cast<int32_t>(READ_HEX(v)) |
|
#define | PARSE_HEX_INT16(v) static_cast<int16_t>(READ_HEX(v)) |
|
#define | PARSE_HEX_INT8(v) static_cast<int8_t>(READ_HEX(v)) |
|
#define | PARSE_FLOAT IS_HEX(v) ? PARSE_HEX_FLOAT(v) : static_cast<float>(atof(v.c_str())) |
|
#define | PARSE_INT16 IS_HEX(v) ? PARSE_HEX_INT16(v) : static_cast<int16_t>(atoi(v.c_str())) |
|
#define | PARSE_INT32 IS_HEX(v) ? PARSE_HEX_INT32(v) : static_cast<int32_t>(atoi(v.c_str())) |
|
#define | PARSE_INT8 IS_HEX(v) ? PARSE_HEX_INT8(v) : static_cast<uint8_t>(atoi(v.c_str())) |
|
◆ COMP
#define COMP |
( |
|
v, |
|
|
|
s |
|
) |
| v.compare(0, 2, s) == 0 |
◆ DELIMITER
◆ IS_HEX
#define IS_HEX |
( |
|
v | ) |
COMP(v, "F*") || COMP(v, "I*") |
◆ PARSE_FLOAT
◆ PARSE_HEX_FLOAT
#define PARSE_HEX_FLOAT |
( |
|
v | ) |
static_cast<float>(READ_HEX(v)) |
◆ PARSE_HEX_INT16
#define PARSE_HEX_INT16 |
( |
|
v | ) |
static_cast<int16_t>(READ_HEX(v)) |
◆ PARSE_HEX_INT32
#define PARSE_HEX_INT32 |
( |
|
v | ) |
static_cast<int32_t>(READ_HEX(v)) |
◆ PARSE_HEX_INT8
#define PARSE_HEX_INT8 |
( |
|
v | ) |
static_cast<int8_t>(READ_HEX(v)) |
◆ PARSE_INT16
◆ PARSE_INT32
◆ PARSE_INT8
◆ PARSER
#define PARSER |
( |
|
s, |
|
|
|
c, |
|
|
|
p |
|
) |
| if (k.compare(s) == 0) { set_##c ( p ); continue; } |
◆ READ_HEX
#define READ_HEX |
( |
|
v | ) |
htonl(strtol(v.c_str()+2, NULL, 16)) |
◆ SEP
◆ SV
#define SV std::vector<std::string> |