|
libwreport 3.42
|
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) |
| Setup this variable as a BUFR variable. | |
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_bufr | ( | Varcode | code, |
| const char * | desc, | ||
| const char * | unit, | ||
| int | scale = 0, | ||
| unsigned | len = 0, | ||
| int | bit_ref = 0, | ||
| int | bit_len = 0 ) |
Setup this variable as a BUFR variable.
This is a compatibility method for existing old code. The functions used to initialize _Varinfo structures are in internals/varinfo.h, and a new API for creating _Varinfo structures outside of tables has not yet been designed.
| len | this is ignored and computed from the other arguments |
References bit_len, bit_ref, code, desc, len, scale, and unit.
| 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().