Information about a variable.
More...
#include <varinfo.h>
|
int | encode_decimal (double fval) const |
| Encode a double value into a decimal integer value using Varinfo decimal encoding informations (scale) More...
|
|
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) More...
|
|
double | decode_decimal (int val) const |
| Decode a double value from a decimal integer value using Varinfo decimal encoding informations (scale) More...
|
|
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) More...
|
|
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. More...
|
|
void | set_binary (Varcode code, const char *desc, unsigned bit_len) |
| Set all the fields to represent an opaque binary variable. More...
|
|
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)
|
|
|
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. More...
|
|
unsigned | len |
| Length in digits of the variable encoded as a decimal integer.
|
|
int | bit_ref |
| Binary reference value for the variable. More...
|
|
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
◆ decode_binary()
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)
- Parameters
-
- Returns
- The decoded double value
◆ decode_decimal()
double wreport::_Varinfo::decode_decimal |
( |
int |
val | ) |
const |
Decode a double value from a decimal integer value using Varinfo decimal encoding informations (scale)
- Parameters
-
- Returns
- The decoded double value
◆ encode_binary()
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)
- Parameters
-
- Returns
- The double value encoded as an unsigned integer
◆ encode_decimal()
int wreport::_Varinfo::encode_decimal |
( |
double |
fval | ) |
const |
Encode a double value into a decimal integer value using Varinfo decimal encoding informations (scale)
- Parameters
-
- Returns
- The double value encoded as an integer
◆ set_binary()
void wreport::_Varinfo::set_binary |
( |
Varcode |
code, |
|
|
const char * |
desc, |
|
|
unsigned |
bit_len |
|
) |
| |
Set all the fields to represent an opaque binary variable.
- Parameters
-
code | the variable code |
desc | the variable description |
bit_len | the variable length in bits |
◆ set_string()
void wreport::_Varinfo::set_string |
( |
Varcode |
code, |
|
|
const char * |
desc, |
|
|
unsigned |
len |
|
) |
| |
Set all the fields to represent a string variable.
- Parameters
-
code | the variable code |
desc | the variable description |
len | the maximum string length |
◆ bit_ref
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.
◆ scale
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).
The documentation for this struct was generated from the following file: