libwreport 3.38
|
Information about a variable. More...
#include <varinfo.h>
Public Member Functions | |
int | encode_decimal (double fval) const |
Encode a double value into a decimal integer value using Varinfo decimal encoding informations (scale) | |
double | round_decimal (double val) const |
Round val so that it only fits the significant digits given in scale. | |
uint32_t | encode_binary (double fval) const |
Encode a double value into a positive integer value using Varinfo binary encoding informations (bit_ref and scale) | |
double | decode_decimal (int val) const |
Decode a double value from a decimal integer value using Varinfo decimal encoding informations (scale) | |
double | decode_binary (uint32_t val) const |
Decode a double value from a decimal integer value using Varinfo binary encoding informations (bit_ref and scale) | |
void | set_bufr (Varcode code, const char *desc, const char *unit, int scale=0, unsigned len=0, int bit_ref=0, int bit_len=0) |
Set all the base Varinfo fields, then call compute_range. | |
void | set_crex (Varcode code, const char *desc, const char *unit, int scale=0, unsigned len=0) |
Set all the base Varinfo fields, then call compute_range. | |
void | set_string (Varcode code, const char *desc, unsigned len) |
Set all the fields to represent a string variable. | |
void | set_binary (Varcode code, const char *desc, unsigned bit_len) |
Set all the fields to represent an opaque binary variable. | |
void | compute_range () |
Compute the widest ranges for imin, imax, dmin and dmax that can fit any value that can be encoded both with (scale, len) and with (scale, bit_ref, bit_len) | |
Data Fields | |
Varcode | code |
Variable code, as in WMO BUFR/CREX table B. | |
Vartype | type |
Type of the value stored in the variable. | |
char | desc [64] |
Freeform variable description. | |
char | unit [24] |
Measurement unit of the variable, using the units defined in WMO BUFR/CREX table B. | |
int | scale |
Scale of the variable, defining its decimal precision. | |
unsigned | len |
Length in digits of the variable encoded as a decimal integer. | |
int | bit_ref |
Binary reference value for the variable. | |
unsigned | bit_len |
Length in bits of the variable when encoded as an unsigned binary value. | |
int | imin |
Minimum unscaled decimal integer value the field can have. | |
int | imax |
Minimum unscaled decimal integer value the field can have. | |
double | dmin |
Minimum value the field can have. | |
double | dmax |
Maximum value the field can have. | |
Information about a variable.
The normal value of a variable is considered expressed in unit
double wreport::_Varinfo::decode_binary | ( | uint32_t | val | ) | const |
Decode a double value from a decimal integer value using Varinfo binary encoding informations (bit_ref and scale)
val | Value to decode |
double wreport::_Varinfo::decode_decimal | ( | int | val | ) | const |
Decode a double value from a decimal integer value using Varinfo decimal encoding informations (scale)
val | Value to decode |
uint32_t wreport::_Varinfo::encode_binary | ( | double | fval | ) | const |
Encode a double value into a positive integer value using Varinfo binary encoding informations (bit_ref and scale)
fval | Value to encode |
int wreport::_Varinfo::encode_decimal | ( | double | fval | ) | const |
Encode a double value into a decimal integer value using Varinfo decimal encoding informations (scale)
fval | Value to encode |
void wreport::_Varinfo::set_binary | ( | Varcode | code, |
const char * | desc, | ||
unsigned | bit_len ) |
void wreport::_Varinfo::set_string | ( | Varcode | code, |
const char * | desc, | ||
unsigned | len ) |
int wreport::_Varinfo::bit_ref |
Binary reference value for the variable.
The value of the variable can be encoded as an unsigned binary value by computing value * exp10(scale) + bit_ref.
Referenced by set_bufr().
int wreport::_Varinfo::scale |
Scale of the variable, defining its decimal precision.
The value of the variable can be encoded as a decimal integer by computing value * exp10(scale).
Referenced by set_bufr(), and set_crex().