libwreport
2.9
|
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) More... | |
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) More... | |
double | decode_int (int val) const throw () |
Decode a double value from integer value using Varinfo encoding informations. More... | |
double | bufr_decode_int (uint32_t val) const throw () |
Decode a double value from integer value using Varinfo encoding informations for BUFR. More... | |
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. More... | |
void | set_string (Varcode var, const char *desc, int len) |
Initialise the varinfo to represent a string variable. More... | |
void | compute_range () |
Compute the valid variable range and store it in the *min and *max fields. | |
Data Fields | |
Varcode | var |
The variable code. More... | |
char | desc [64] |
The variable description. More... | |
char | unit [24] |
The measurement unit of the variable. More... | |
int | scale |
The scale of the variable. More... | |
int | ref |
The reference value for the variable. More... | |
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. More... | |
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. More... | |
int | bufr_scale |
The scale of the variable when encoded in BUFR. More... | |
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 |
int wreport::_Varinfo::bit_ref |
The reference value for bit-encoding.
When the variable is encoded in a bit string, it is added this value
int wreport::_Varinfo::bufr_scale |
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.
int wreport::_Varinfo::ref |
The reference value for the variable.
When the variable is represented as an integer, and after scaling, it is added this value
int wreport::_Varinfo::scale |
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.