1 #ifndef WREPORT_VARINFO_H 2 #define WREPORT_VARINFO_H 6 #include <wreport/fwd.h> 66 #define WR_VAR(f, x, y) ((wreport::Varcode)( ((unsigned)(f)<<14) | ((unsigned)(x)<<8) | (unsigned)(y) )) 74 #define WR_STRING_TO_VAR(str) ((wreport::Varcode)( \ 75 (( ((str)[0] - '0')*10 + ((str)[1] - '0') ) << 8) | \ 76 ( ((str)[2] - '0')*100 + ((str)[3] - '0')*10 + ((str)[4] - '0') ) \ 80 #define WR_VAR_F(code) (((code) >> 14) & 0x3) 83 #define WR_VAR_X(code) ((code) >> 8 & 0x3f) 86 #define WR_VAR_Y(code) ((code) & 0xff) 95 #define WR_VAR_FXY(code) WR_VAR_F(code), WR_VAR_X(code), WR_VAR_Y(code) 194 int encode_decimal(
double fval)
const;
199 double round_decimal(
double val)
const;
210 uint32_t encode_binary(
double fval)
const;
221 double decode_decimal(
int val)
const;
232 double decode_binary(uint32_t val)
const;
235 void set_bufr(Varcode code,
238 int scale=0,
unsigned len=0,
239 int bit_ref=0,
int bit_len=0);
242 void set_crex(Varcode code,
245 int scale=0,
unsigned len=0);
254 void set_string(Varcode code,
const char* desc,
unsigned len);
263 void set_binary(Varcode code,
const char* desc,
unsigned bit_len);
270 void compute_range();
Vartype vartype_parse(const char *s)
Return a Vartype from its string description.
Varcode varcode_parse(const char *desc)
Convert a FXXYYY string descriptor code into its short integer representation.
double dmax
Maximum value the field can have.
Definition: varinfo.h:183
Vartype type
Type of the value stored in the variable.
Definition: varinfo.h:142
int scale
Scale of the variable, defining its decimal precision.
Definition: varinfo.h:157
Vartype
Variable type.
Definition: varinfo.h:111
Varcode code
Variable code, as in WMO BUFR/CREX table B.
Definition: varinfo.h:139
const _Varinfo * Varinfo
Varinfo reference.
Definition: fwd.h:9
double dmin
Minimum value the field can have.
Definition: varinfo.h:180
uint16_t Varcode
Holds the WMO variable code of a variable.
Definition: fwd.h:11
Information about a variable.
Definition: varinfo.h:136
int bit_ref
Binary reference value for the variable.
Definition: varinfo.h:168
std::string varcode_format(Varcode code)
Format a varcode into a string.
unsigned bit_len
Length in bits of the variable when encoded as an unsigned binary value.
Definition: varinfo.h:171
String functions.
Definition: benchmark.h:13
int imax
Minimum unscaled decimal integer value the field can have.
Definition: varinfo.h:177
const char * vartype_format(Vartype type)
Return a string description of a Vartype.
unsigned len
Length in digits of the variable encoded as a decimal integer.
Definition: varinfo.h:160
int imin
Minimum unscaled decimal integer value the field can have.
Definition: varinfo.h:174