22 #ifndef WREPORT_VARINFO_H
23 #define WREPORT_VARINFO_H
86 #define WR_VAR(f, x, y) ((wreport::Varcode)( ((unsigned)(f)<<14) | ((unsigned)(x)<<8) | (unsigned)(y) ))
94 #define WR_STRING_TO_VAR(str) ((wreport::Varcode)( \
95 (( ((str)[0] - '0')*10 + ((str)[1] - '0') ) << 8) | \
96 ( ((str)[2] - '0')*100 + ((str)[3] - '0')*10 + ((str)[4] - '0') ) \
102 #define WR_VAR_F(code) (((code) >> 14) & 0x3)
106 #define WR_VAR_X(code) ((code) >> 8 & 0x3f)
110 #define WR_VAR_Y(code) ((code) & 0xff)
136 #define VARINFO_FLAG_STRING 0x01
137 #define VARINFO_FLAG_BINARY 0x02
225 int encode_int(
double fval)
const throw ();
236 unsigned encode_bit_int(
double fval)
const;
247 double decode_int(
int val)
const throw ();
258 double bufr_decode_int(uint32_t val)
const throw ();
270 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);
279 void set_string(
Varcode var,
const char* desc,
int len);
285 void compute_range();
Varcode var
The variable code.
Definition: varinfo.h:151
Alteration alteration
C-table alteration that has been applied to this entry (deprecated)
Definition: varinfo.h:182
double dmax
Maximum scaled value the field can have.
Definition: varinfo.h:180
const _Varinfo * operator->() const
Standard smart pointer methods.
Definition: varinfo.h:362
Smart pointer to handle/use varinfos.
Definition: varinfo.h:291
const _Varinfo & operator*() const
Standard smart pointer methods.
Definition: varinfo.h:361
int scale
The scale of the variable.
Definition: varinfo.h:158
#define VARINFO_FLAG_BINARY
Mark literal binary variables.
Definition: varinfo.h:137
int ref
The reference value for the variable.
Definition: varinfo.h:161
_Varinfo * m_impl
Varinfo structure to which the pointer refers.
Definition: varinfo.h:295
bool is_string() const
Check if we are a string value.
Definition: varinfo.h:205
_Varinfo * operator->()
Standard smart pointer methods.
Definition: varinfo.h:314
const _Varinfo * impl() const
Access the underlying _Varinfo structure.
Definition: varinfo.h:366
MutableVarinfo(const MutableVarinfo &vi)
Create a smart pointer to the given variable information.
Definition: varinfo.h:301
double dmin
Minimum scaled value the field can have.
Definition: varinfo.h:178
int bufr_scale
The scale of the variable when encoded in BUFR.
Definition: varinfo.h:188
void do_ref() const
Increment the reference count to this Data object.
Definition: varinfo.h:196
int _ref
Reference count.
Definition: varinfo.h:191
_Varinfo & operator*()
Standard smart pointer methods.
Definition: varinfo.h:315
Holds the information about a DBALLE variable.
Definition: varinfo.h:148
bool is_binary() const
Check if we are a binary value.
Definition: varinfo.h:211
_Varinfo * impl() const
Access the underlying _Varinfo structure.
Definition: varinfo.h:319
int bit_ref
The reference value for bit-encoding.
Definition: varinfo.h:167
short unsigned int Alteration
Describes how a wreport::Varinfo has been altered: it is used for supporting variables coming from BU...
Definition: varinfo.h:130
std::string varcode_format(Varcode code)
Format a varcode into a string.
MutableVarinfo & operator=(const MutableVarinfo &vi)
Standard smart pointer methods.
Definition: varinfo.h:307
short unsigned int Varcode
Holds the WMO variable code of a variable.
Definition: varinfo.h:78
Varcode descriptor_code(const char *desc)
Convert a FXXYYY string descriptor code into its short integer representation.
unsigned bit_len
The length in bits of the variable when encoded in a bit string (after scaling and changing reference...
Definition: varinfo.h:170
Smart pointer to handle/use varinfos.
Definition: varinfo.h:336
int imax
Maximum unscaled value the field can have.
Definition: varinfo.h:176
unsigned flags
Variable flags (see VARINFO_FLAG_* constants)
Definition: varinfo.h:172
const Varinfo & operator=(const Varinfo &vi)
Standard smart pointer methods.
Definition: varinfo.h:354
static MutableVarinfo create_singleuse()
Create a single use varinfo structure.
unsigned len
The length in digits of the integer representation of this variable (after scaling and changing refer...
Definition: varinfo.h:164
Varinfo(const Varinfo &vi)
Create a smart pointer to the given variable information.
Definition: varinfo.h:347
Varinfo(const _Varinfo *impl)
Create a smart pointer to the given variable information.
Definition: varinfo.h:345
Varinfo(const MutableVarinfo &vi)
Create a smart pointer to the given variable information.
Definition: varinfo.h:348
MutableVarinfo(_Varinfo *impl)
Create a smart pointer to the given variable information.
Definition: varinfo.h:300
const _Varinfo * m_impl
Varinfo structure to which the pointer refers.
Definition: varinfo.h:340
Varinfo(const _Varinfo &impl)
Create a smart pointer to the given variable information.
Definition: varinfo.h:346
#define VARINFO_FLAG_STRING
Varinfo flags.
Definition: varinfo.h:136
struct _Varinfo * alterations
Other altered versions of this Varinfo.
Definition: varinfo.h:184
bool do_unref() const
Decrement the reference count to this Data object, and return true if the reference count went down t...
Definition: varinfo.h:202
int imin
Minimum unscaled value the field can have.
Definition: varinfo.h:174