libwreport  2.8
Data Structures | Namespaces | Constant Groups | Macros | Typedefs | Functions
varinfo.h File Reference

Implement fast access to information about WMO variables. More...

#include <stdint.h>
#include <string>

Go to the source code of this file.

Data Structures

struct  wreport::_Varinfo
 Holds the information about a DBALLE variable. More...
 
class  wreport::MutableVarinfo
 Smart pointer to handle/use varinfos. More...
 
class  wreport::Varinfo
 Smart pointer to handle/use varinfos. More...
 

Namespaces

 wreport
 Main namespace.
 

Constant Groups

 wreport
 Main namespace.
 

Macros

#define WR_VAR(f, x, y)   ((wreport::Varcode)( ((unsigned)(f)<<14) | ((unsigned)(x)<<8) | (unsigned)(y) ))
 Create a WMO variable code from its F, X and Y components.
 
#define WR_STRING_TO_VAR(str)
 Convert a XXYYY string to a WMO variable code. More...
 
#define WR_VAR_F(code)   (((code) >> 14) & 0x3)
 Get the F part of a WMO variable code.
 
#define WR_VAR_X(code)   ((code) >> 8 & 0x3f)
 Get the X part of a WMO variable code.
 
#define WR_VAR_Y(code)   ((code) & 0xff)
 Get the Y part of a WMO variable code.
 
#define VARINFO_FLAG_STRING   0x01
 Varinfo flags. More...
 
#define VARINFO_FLAG_BINARY   0x02
 Mark literal binary variables.
 

Typedefs

typedef short unsigned int wreport::Varcode
 Holds the WMO variable code of a variable.
 
typedef short unsigned int wreport::Alteration
 Describes how a wreport::Varinfo has been altered: it is used for supporting variables coming from BUFR and CREX messages that use C codes to alter variable information.
 

Functions

std::string wreport::varcode_format (Varcode code)
 Format a varcode into a string.
 
Varcode wreport::descriptor_code (const char *desc)
 Convert a FXXYYY string descriptor code into its short integer representation. More...
 

Detailed Description

Implement fast access to information about WMO variables.

The measured value of a physical quantity has little meaning without specifying what quantity it represents, what units are used to measure it, and how many digits are significant for the value.

This module provides access to all this metadata:

There are many B tables with slight differences used by different meteorological centre or equipment. This module allows to access different vartables using dba_vartable_create().

wreport::Vartable and wreport::Varinfo have special memory management: they are never deallocated. This is a precise design choice to speed up passing and copying wreport::Varinfo values, that are used very intensely as they accompany all the physical values processed by DB-All.e and its components. This behaviour should not be a cause of memory leaks, since a software would only need to access a limited amount of B tables during its lifetime.

To construct a wreport::Varcode value one needs to provide three numbers: F, X and Y.

The normal text representation of a wreport::Varcode for a WMO B table uses the format Bxxyyy.

Macro Definition Documentation

#define VARINFO_FLAG_STRING   0x01

Varinfo flags.

Mark string variables

Referenced by wreport::_Varinfo::is_string().

#define WR_STRING_TO_VAR (   str)
Value:
(( ((str)[0] - '0')*10 + ((str)[1] - '0') ) << 8) | \
( ((str)[2] - '0')*100 + ((str)[3] - '0')*10 + ((str)[4] - '0') ) \
))

Convert a XXYYY string to a WMO variable code.

This is useful only in rare cases, such as when parsing tables; use descriptor_code() to parse proper entry names such as "B01003" or "D21301".