libwreport 2.1
|
Holds the information about a DBALLE variable. More...
#include <varinfo.h>
Public Member Functions | |
void | do_ref () const |
Increment the reference count to this Data object. | |
bool | do_unref () const |
Decrement the reference count to this Data object, and return true if the reference count went down to 0. | |
bool | is_string () const |
Check if we are a string value. | |
bool | is_binary () const |
Check if we are a binary value. | |
int | encode_int (double fval) const throw () |
Encode a double value into an integer value using Varinfo decimal encoding informations (ref and scale) | |
unsigned | encode_bit_int (double fval) const |
Encode a double value into an integer value using Varinfo binary encoding informations (bit_ref and bufr_scale) | |
double | decode_int (int val) const throw () |
Decode a double value from integer value using Varinfo encoding informations. | |
double | bufr_decode_int (uint32_t val) const throw () |
Decode a double value from integer value using Varinfo encoding informations for BUFR. | |
void | reset () |
Set all fields to 0, except the reference count. | |
void | set (Varcode var, const char *desc, const char *unit, int scale=0, int ref=0, int len=0, int bit_ref=0, int bit_len=0, int flags=0, const char *bufr_unit=0, int bufr_scale=0) |
Set the values all in one shot. | |
void | set_string (Varcode var, const char *desc, int len) |
Initialise the varinfo to represent a string variable. | |
void | compute_range () |
Compute the valid variable range and store it in the *min and *max fields. | |
Data Fields | |
Varcode | var |
The variable code. | |
char | desc [64] |
The variable description. | |
char | unit [24] |
The measurement unit of the variable. | |
int | scale |
The scale of the variable. | |
int | ref |
The reference value for the variable. | |
unsigned | len |
The length in digits of the integer representation of this variable (after scaling and changing reference value) | |
int | bit_ref |
The reference value for bit-encoding. | |
unsigned | bit_len |
The length in bits of the variable when encoded in a bit string (after scaling and changing reference value) | |
unsigned | flags |
Variable flags (see VARINFO_FLAG_* constants) | |
int | imin |
Minimum unscaled value the field can have. | |
int | imax |
Maximum unscaled value the field can have. | |
double | dmin |
Minimum scaled value the field can have. | |
double | dmax |
Maximum scaled value the field can have. | |
Alteration | alteration |
C-table alteration that has been applied to this entry (deprecated) | |
struct _Varinfo * | alterations |
Other altered versions of this Varinfo. | |
char | bufr_unit [24] |
The measurement unit of the variable when encoded in BUFR. | |
int | bufr_scale |
The scale of the variable when encoded in BUFR. | |
int | _ref |
Reference count. |
Holds the information about a DBALLE variable.
It never needs to be deallocated, as all the Varinfo returned by DB-ALLe are pointers to memory-cached versions that are guaranteed to exist for all the lifetime of the program.
double wreport::_Varinfo::bufr_decode_int | ( | uint32_t | val | ) | const throw () |
Decode a double value from integer value using Varinfo encoding informations for BUFR.
val | Value to decode |
double wreport::_Varinfo::decode_int | ( | int | val | ) | const throw () |
Decode a double value from integer value using Varinfo encoding informations.
val | Value to decode |
unsigned wreport::_Varinfo::encode_bit_int | ( | double | fval | ) | const |
Encode a double value into an integer value using Varinfo binary encoding informations (bit_ref and bufr_scale)
fval | Value to encode |
int wreport::_Varinfo::encode_int | ( | double | fval | ) | const throw () |
Encode a double value into an integer value using Varinfo decimal encoding informations (ref and scale)
fval | Value to encode |
void wreport::_Varinfo::set | ( | Varcode | var, |
const char * | desc, | ||
const char * | unit, | ||
int | scale = 0 , |
||
int | ref = 0 , |
||
int | len = 0 , |
||
int | bit_ref = 0 , |
||
int | bit_len = 0 , |
||
int | flags = 0 , |
||
const char * | bufr_unit = 0 , |
||
int | bufr_scale = 0 |
||
) |
Set the values all in one shot.
It also calls compute_range
void wreport::_Varinfo::set_string | ( | Varcode | var, |
const char * | desc, | ||
int | len | ||
) |
Initialise the varinfo to represent a string variable.
var | the variable code |
desc | the variable description |
len | the maximum string length |
The reference value for bit-encoding.
When the variable is encoded in a bit string, it is added this value
The scale of the variable when encoded in BUFR.
char wreport::_Varinfo::bufr_unit[24] |
The measurement unit of the variable when encoded in BUFR.
char wreport::_Varinfo::desc[64] |
The variable description.
The reference value for the variable.
When the variable is represented as an integer, and after scaling, it is added this value
The scale of the variable.
When the variable is represented as an integer, it is multiplied by 10**scale
char wreport::_Varinfo::unit[24] |
The measurement unit of the variable.
The variable code.
See WR_VAR, WR_VAR_X, WR_VAR_Y.