69 #include <dballe/core/matcher.h>
114 const char* msg_type_name(MsgType type);
132 std::vector<msg::Context*>
data;
143 Msg& operator=(
const Msg& m);
222 const wreport::Var*
find(wreport::Varcode code,
const Level& lev,
const Trange& tr)
const;
236 wreport::Var*
edit(wreport::Varcode code,
const Level& lev,
const Trange& tr);
287 void set(
const wreport::Var& var, wreport::Varcode code,
const Level& lev,
const Trange& tr);
297 void set_by_id(
const wreport::Var& var,
int shortcut);
311 void set(std::auto_ptr<wreport::Var> var,
const Level& lev,
const Trange& tr);
329 void seti(wreport::Varcode code,
int val,
int conf,
const Level& lev,
const Trange& tr);
347 void setd(wreport::Varcode code,
double val,
int conf,
const Level& lev,
const Trange& tr);
365 void setc(wreport::Varcode code,
const char* val,
int conf,
const Level& lev,
const Trange& tr);
396 void sounding_unpack_levels(
Msg& dst)
const;
423 void to_csv(std::ostream& out)
const;
434 void print(FILE* out)
const;
447 unsigned diff(
const Msg& msg)
const;
459 #include <dballe/msg/msg-extravars.h>
481 virtual void operator()(std::auto_ptr<Msg>) = 0;
497 virtual matcher::Result
match_date(
const int* min,
const int* max)
const;
498 virtual matcher::Result
match_coords(
int latmin,
int latmax,
int lonmin,
int lonmax)
const;
515 dba_err dba_msg_set_by_id(dba_msg msg, dba_var var,
int id);
531 dba_err dba_msg_set_nocopy_by_id(dba_msg msg, dba_var var,
int id);
541 dba_msg_type dba_msg_get_type(dba_msg msg);
Store an array of physical data all on the same level.
Definition: msg/context.h:44
void sounding_pack_levels(Msg &dst) const
Copy to dest all the variable in this message that match filter TODO: to be implemented.
wreport::Var * edit(wreport::Varcode code, const Level &lev, const Trange &tr)
Find a variable given its description.
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 to_csv(std::ostream &out) const
Output in CSV format.
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.
Common interface for things that are matched.
Definition: matcher.h:48
Storage for related physical data.
Definition: msg.h:119
msg::Context * edit_context(const Level &lev, const Trange &tr)
Find a msg::Context given its description.
Implement ::dba_var, an encapsulation of a measured variable.
Shortcut IDs and functions to quickly refer to commonly used values inside a ::dba_msg.
virtual matcher::Result match_coords(int latmin, int latmax, int lonmin, int lonmax) const
Match coordinates, with bounds in 1/100000 of degree.
wreport::Var * edit_by_id(int id)
Find a datum given its shortcut ID.
MsgType type
Source of the data.
Definition: msg.h:129
std::vector< msg::Context * > data
Context in the message.
Definition: msg.h:132
static Msg * lua_check(struct lua_State *L, int idx)
Check that the element at idx is a dba_msg.
static const char * repmemo_from_type(MsgType type)
Get the report code corresponding to the given message source type.
const msg::Context * find_context(const Level &lev, const Trange &tr) const
Find a msg::Context given its description.
void parse_date(int *values) const
Parse the date set in the Msg.
msg::Context & obtain_station_context()
Shortcut to obtain_context(Level::ana(), Trange::ana());.
void set_by_id(const wreport::Var &var, int shortcut)
Add or replace a value.
static void csv_header(std::ostream &out)
Output the CSV header.
const wreport::Var * find_by_id(int id) const
Find a datum given its shortcut ID.
Msg()
Create a new dba_msg.
Match adapter for Msg.
Definition: msg.h:487
void set_date(const char *date)
Set the date from a string in the format "YYYY-MM-DD HH:MM:SS".
virtual matcher::Result match_station_id(int val) const
Match station ID.
void add_context(std::auto_ptr< msg::Context > ctx)
Add a missing context, taking care of its memory management.
int find_index(const Level &lev, const Trange &tr) const
Return the index of the given context, or -1 if it was not found.
virtual matcher::Result match_station_wmo(int block, int station=-1) const
Match station WMO code.
virtual matcher::Result match_rep_memo(const char *memo) const
Match rep_memo.
const msg::Context * find_context_by_id(int id) const
Find a contexts given level and timerange found in a shortcut ID.
void lua_push(struct lua_State *L)
Push the variable as an object in the lua stack.
bool remove_context(const Level &lev, const Trange &tr)
Remove a context from the message.
void clear()
Remove all information from Msg.
const wreport::Var * find(wreport::Varcode code, const Level &lev, const Trange &tr) const
Find a variable given its description.
virtual matcher::Result match_var_id(int val) const
Match variable ID.
void set(const wreport::Var &var, wreport::Varcode code, const Level &lev, const Trange &tr)
Add or replace a value.
bool from_csv(CSVReader &in)
Read data from a CSV input.
const msg::Context * find_station_context() const
Find the station info context.
Consumer interface used to stream messages as they are produced.
Definition: msg.h:478
msg::Context & obtain_context(const Level &lev, const Trange &tr)
Find a msg::Context given its description, creating it if it does not exist.
virtual matcher::Result match_date(const int *min, const int *max) const
Match date.
static MsgType type_from_repmemo(const char *repmemo)
Get the message source type corresponding to the given report code.
unsigned diff(const Msg &msg) const
Compute the differences between two 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 print(FILE *out) const
Dump all the contents of the message to the given stream.