1 #ifndef WREPORT_VARINFO_H 2 #define WREPORT_VARINFO_H 65 #define WR_VAR(f, x, y) ((wreport::Varcode)( ((unsigned)(f)<<14) | ((unsigned)(x)<<8) | (unsigned)(y) )) 73 #define WR_STRING_TO_VAR(str) ((wreport::Varcode)( \ 74 (( ((str)[0] - '0')*10 + ((str)[1] - '0') ) << 8) | \ 75 ( ((str)[2] - '0')*100 + ((str)[3] - '0')*10 + ((str)[4] - '0') ) \ 79 #define WR_VAR_F(code) (((code) >> 14) & 0x3) 82 #define WR_VAR_X(code) ((code) >> 8 & 0x3f) 85 #define WR_VAR_Y(code) ((code) & 0xff) 94 #define WR_VAR_FXY(code) WR_VAR_F(code), WR_VAR_X(code), WR_VAR_Y(code) 193 int encode_decimal(
double fval)
const;
198 double round_decimal(
double val)
const;
209 uint32_t encode_binary(
double fval)
const;
220 double decode_decimal(
int val)
const;
231 double decode_binary(uint32_t val)
const;
234 void set_bufr(Varcode code,
237 int scale=0,
unsigned len=0,
238 int bit_ref=0,
int bit_len=0);
241 void set_crex(Varcode code,
244 int scale=0,
unsigned len=0);
253 void set_string(Varcode code,
const char* desc,
unsigned len);
262 void set_binary(Varcode code,
const char* desc,
unsigned bit_len);
269 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:182
Vartype type
Type of the value stored in the variable.
Definition: varinfo.h:141
int scale
Scale of the variable, defining its decimal precision.
Definition: varinfo.h:156
Vartype
Variable type.
Definition: varinfo.h:110
Varcode code
Variable code, as in WMO BUFR/CREX table B.
Definition: varinfo.h:138
double dmin
Minimum value the field can have.
Definition: varinfo.h:179
uint16_t Varcode
Holds the WMO variable code of a variable.
Definition: varinfo.h:57
Information about a variable.
Definition: varinfo.h:135
int bit_ref
Binary reference value for the variable.
Definition: varinfo.h:167
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:170
String functions.
Definition: benchmark.h:13
int imax
Minimum unscaled decimal integer value the field can have.
Definition: varinfo.h:176
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:159
const _Varinfo * Varinfo
Varinfo reference.
Definition: varinfo.h:281
int imin
Minimum unscaled decimal integer value the field can have.
Definition: varinfo.h:173