libdballe 5.10
|
Storage for related physical data. More...
#include <msg.h>
Public Member Functions | |
Msg () | |
Create a new dba_msg. | |
Msg (const Msg &m) | |
Msg & | operator= (const Msg &m) |
void | clear () |
Remove all information from Msg. | |
void | add_context (std::auto_ptr< msg::Context > ctx) |
Add a missing context, taking care of its memory management. | |
bool | remove_context (const Level &lev, const Trange &tr) |
Remove a context from the message. | |
const msg::Context * | find_context (const Level &lev, const Trange &tr) const |
Find a msg::Context given its description. | |
const msg::Context * | find_station_context () const |
Find the station info context. | |
msg::Context * | edit_context (const Level &lev, const Trange &tr) |
Find a msg::Context given its description. | |
msg::Context & | obtain_context (const Level &lev, const Trange &tr) |
Find a msg::Context given its description, creating it if it does not exist. | |
const wreport::Var * | find (wreport::Varcode code, const Level &lev, const Trange &tr) const |
Find a variable given its description. | |
wreport::Var * | edit (wreport::Varcode code, const Level &lev, const Trange &tr) |
Find a variable given its description. | |
const wreport::Var * | find_by_id (int id) const |
Find a datum given its shortcut ID. | |
const msg::Context * | find_context_by_id (int id) const |
Find a contexts given level and timerange found in a shortcut ID. | |
wreport::Var * | edit_by_id (int id) |
Find a datum given its shortcut ID. | |
void | set (const wreport::Var &var, wreport::Varcode code, const Level &lev, const Trange &tr) |
Add or replace a value. | |
void | set_by_id (const wreport::Var &var, int shortcut) |
Add or replace a value. | |
void | set (std::auto_ptr< wreport::Var > var, const Level &lev, const Trange &tr) |
Add or replace a value, taking ownership of the source variable without copying it. | |
void | seti (wreport::Varcode code, int val, int conf, const Level &lev, const Trange &tr) |
Add or replace an integer value in the dba_msg. | |
void | setd (wreport::Varcode code, double val, int conf, const Level &lev, const Trange &tr) |
Add or replace a double value in the dba_msg. | |
void | setc (wreport::Varcode code, const char *val, int conf, const Level &lev, const Trange &tr) |
Add or replace a string value in the dba_msg. | |
void | set_date (const char *date) |
Set the date from a string in the format "YYYY-MM-DD HH:MM:SS". | |
void | sounding_pack_levels (Msg &dst) const |
Copy to dest all the variable in this message that match filter TODO: to be implemented. | |
void | parse_date (int *values) const |
Parse the date set in the Msg. | |
bool | from_csv (CSVReader &in) |
Read data from a CSV input. | |
void | to_csv (std::ostream &out) const |
Output in CSV format. | |
void | print (FILE *out) const |
Dump all the contents of the message to the given stream. | |
unsigned | diff (const Msg &msg) const |
Compute the differences between two Msg. | |
void | lua_push (struct lua_State *L) |
Push the variable as an object in the lua stack. | |
Static Public Member Functions | |
static void | csv_header (std::ostream &out) |
Output the CSV header. | |
static MsgType | type_from_repmemo (const char *repmemo) |
Get the message source type corresponding to the given report code. | |
static const char * | repmemo_from_type (MsgType type) |
Get the report code corresponding to the given message source type. | |
static Msg * | lua_check (struct lua_State *L, int idx) |
Check that the element at idx is a dba_msg. | |
Data Fields | |
MsgType | type |
Source of the data. | |
std::vector< msg::Context * > | data |
Context in the message. | |
Protected Member Functions | |
int | find_index (const Level &lev, const Trange &tr) const |
Return the index of the given context, or -1 if it was not found. |
Storage for related physical data.
dballe::Msg::Msg | ( | ) |
Create a new dba_msg.
By default, type is MSG_GENERIC
void dballe::Msg::add_context | ( | std::auto_ptr< msg::Context > | ctx | ) |
Add a missing context, taking care of its memory management.
Note: if the context already exists, an exception is thrown
unsigned dballe::Msg::diff | ( | const Msg & | msg | ) | const |
Compute the differences between two Msg.
Details of the differences found will be formatted using the notes system (
msg | Message to compare this one to |
wreport::Var* dballe::Msg::edit_by_id | ( | int | id | ) |
Find a datum given its shortcut ID.
msg | The message to query |
id | Shortcut ID of the value to set (see vars.h) |
msg::Context* dballe::Msg::edit_context | ( | const Level & | lev, |
const Trange & | tr | ||
) |
Find a msg::Context given its description.
const wreport::Var* dballe::Msg::find_by_id | ( | int | id | ) | const |
Find a datum given its shortcut ID.
msg | The message to query |
id | Shortcut ID of the value to set (see vars.h) |
const msg::Context* dballe::Msg::find_context | ( | const Level & | lev, |
const Trange & | tr | ||
) | const |
Find a msg::Context given its description.
const msg::Context* dballe::Msg::find_context_by_id | ( | int | id | ) | const |
Find a contexts given level and timerange found in a shortcut ID.
msg | The message to query |
id | Shortcut ID with the level information to use |
const msg::Context* dballe::Msg::find_station_context | ( | ) | const |
Find the station info context.
bool dballe::Msg::from_csv | ( | CSVReader & | in | ) |
Read data from a CSV input.
Reading stops when one of Longitude, Latitude, Report or Date changes.
static Msg* dballe::Msg::lua_check | ( | struct lua_State * | L, |
int | idx | ||
) | [static] |
Check that the element at idx is a dba_msg.
msg::Context& dballe::Msg::obtain_context | ( | const Level & | lev, |
const Trange & | tr | ||
) |
Find a msg::Context given its description, creating it if it does not exist.
void dballe::Msg::parse_date | ( | int * | values | ) | const |
Parse the date set in the Msg.
This function will examine the values year, month, day, hour, min and sec, and will compute the lower bound of the datetime they represent.
values | An array of 6 integers that will be filled with the minimum year, month, day, hour, minute and seconds. |
void dballe::Msg::print | ( | FILE * | out | ) | const |
Dump all the contents of the message to the given stream.
out | The stream to dump the contents of the dba_msg to. |
Remove a context from the message.
void dballe::Msg::set_by_id | ( | const wreport::Var & | var, |
int | shortcut | ||
) |
Add or replace a value.
var | The Var with the value to set |
shortcut | Shortcut ID of the value to set |
void dballe::Msg::setc | ( | wreport::Varcode | code, |
const char * | val, | ||
int | conf, | ||
const Level & | lev, | ||
const Trange & | tr | ||
) |
Add or replace a string value in the dba_msg.
code | The dba_varcode of the destination value. See vartable::h |
val | The string value of the data |
conf | The confidence interval of the data, as the value of a B33007 WMO B (per cent confidence) table entry, that is, a number between 0 and 100 inclusive. -1 means no confidence interval attribute. |
lev | The Level of the value |
tr | The Trange of the value |
void dballe::Msg::setd | ( | wreport::Varcode | code, |
double | val, | ||
int | conf, | ||
const Level & | lev, | ||
const Trange & | tr | ||
) |
Add or replace a double value in the dba_msg.
code | The dba_varcode of the destination value. See vartable::h |
val | The double value of the data |
conf | The confidence interval of the data, as the value of a B33007 WMO B (per cent confidence) table entry, that is, a number between 0 and 100 inclusive. -1 means no confidence interval attribute. |
lev | The Level of the value |
tr | The Trange of the value |
void dballe::Msg::seti | ( | wreport::Varcode | code, |
int | val, | ||
int | conf, | ||
const Level & | lev, | ||
const Trange & | tr | ||
) |
Add or replace an integer value in the dba_msg.
code | The dba_varcode of the destination value.. See vartable::h |
val | The integer value of the data |
conf | The confidence interval of the data, as the value of a B33007 WMO B (per cent confidence) table entry, that is, a number between 0 and 100 inclusive. -1 means no confidence interval attribute. |
lev | The Level of the value |
tr | The Trange of the value |
void dballe::Msg::sounding_pack_levels | ( | Msg & | dst | ) | const |
Copy to dest all the variable in this message that match filter TODO: to be implemented.
Copy a Msg, removing the sounding significance from the level descriptions and packing together the data at the same pressure level.
This is used to postprocess data after decoding, where the l2 field of the level description is temporarily used to store the vertical sounding significance, to simplify decoding.