libdballe  9.11
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
dballe::Message Class Referenceabstract

A bulletin that has been decoded and physically interpreted. More...

#include <message.h>

Inheritance diagram for dballe::Message:
dballe::impl::Message

Public Member Functions

 Message (const Message &)=default
 
Messageoperator= (const Message &o)=default
 
Messageoperator= (Message &&o)=default
 
virtual MessageType get_type () const =0
 Return the type of the data in the message.
 
virtual Datetime get_datetime () const =0
 Get the reference Datetime for this message.
 
virtual Coords get_coords () const =0
 Get the reference coordinates for this message.
 
virtual Ident get_ident () const =0
 Get the station identifier for this message.
 
virtual std::string get_report () const =0
 Get the report for this message.
 
virtual std::shared_ptr< Messageclone () const =0
 Return a copy of this message.
 
const wreport::Varget (const Level &lev, const Trange &tr, wreport::Varcode code) const
 Get a variable given its code, level and time range information. More...
 
const wreport::Varget (const char *shortcut) const
 Get a variable given its shortcut name. More...
 
const wreport::Varget (const std::string &shortcut) const
 Get a variable given its shortcut name. More...
 
void set (const Level &lev, const Trange &tr, wreport::Varcode code, const wreport::Var &var)
 Add or replace a value. More...
 
void set (const Level &lev, const Trange &tr, const wreport::Var &var)
 Add or replace a value. More...
 
void set (const Level &lev, const Trange &tr, std::unique_ptr< wreport::Var > var)
 Add or replace a value, taking ownership of the source variable without copying it. More...
 
void set (const char *shortcut, std::unique_ptr< wreport::Var > var)
 Add or replace a value, taking ownership of the source variable without copying it. More...
 
void set (const char *shortcut, const wreport::Var &var)
 Add or replace a value. More...
 
virtual bool foreach_var (std::function< bool(const Level &, const Trange &, const wreport::Var &)>) const =0
 Iterate the contents of the message.
 
virtual std::shared_ptr< CursorStationquery_stations (const Query &query) const =0
 Return a Cursor to access the station information in the message. More...
 
virtual std::shared_ptr< CursorStationDataquery_station_data (const Query &query) const =0
 Query the station variables in the message. More...
 
virtual std::shared_ptr< CursorDataquery_data (const Query &query) const =0
 Query the variables in the message. More...
 
virtual void print (FILE *out) const =0
 Print all the contents of this message to an output stream.
 
virtual unsigned diff (const Message &msg) const =0
 Compute the differences between two Messages. More...
 

Static Public Member Functions

static std::shared_ptr< Messagecreate (MessageType type)
 Create a new empty message.
 

Protected Member Functions

virtual const wreport::Varget_impl (const Level &lev, const Trange &tr, wreport::Varcode code) const =0
 Implementation of get(const Level&, const Trange&, wreport::Varcode)
 
virtual void set_impl (const Level &lev, const Trange &tr, std::unique_ptr< wreport::Var > var)=0
 Implementation of set(const Level& const Trange&, std::unique_ptr<wreport::Var>)
 

Detailed Description

A bulletin that has been decoded and physically interpreted.

Message collects zero or more variables that have been forecast or measured by the same station in the same instant.

Each variable is annotated with its vertical level/layer information, and its time range / statistical information.

The representation in Message is as connected as possible to physics rather than to observations.

Member Function Documentation

◆ diff()

virtual unsigned dballe::Message::diff ( const Message msg) const
pure virtual

Compute the differences between two Messages.

Details of the differences found will be formatted using the wreport notes system (

See also
wreport/notes.h).
Returns
The number of differences found

Implemented in dballe::impl::Message.

◆ get() [1/3]

const wreport::Var* dballe::Message::get ( const Level lev,
const Trange tr,
wreport::Varcode  code 
) const

Get a variable given its code, level and time range information.

Returns
A pointer to the variable, or nullptr if it was not found.

◆ get() [2/3]

const wreport::Var* dballe::Message::get ( const char *  shortcut) const

Get a variable given its shortcut name.

Returns
A pointer to the variable, or nullptr if it was not found.

◆ get() [3/3]

const wreport::Var* dballe::Message::get ( const std::string &  shortcut) const

Get a variable given its shortcut name.

Returns
A pointer to the variable, or nullptr if it was not found.

◆ query_data()

virtual std::shared_ptr<CursorData> dballe::Message::query_data ( const Query query) const
pure virtual

Query the variables in the message.

Parameters
queryThe query data (note: currently ignored)
Returns
The cursor to use to iterate over the results

Implemented in dballe::impl::Message.

◆ query_station_data()

virtual std::shared_ptr<CursorStationData> dballe::Message::query_station_data ( const Query query) const
pure virtual

Query the station variables in the message.

Parameters
queryThe query data (note: currently ignored)
Returns
The cursor to use to iterate over the results

Implemented in dballe::impl::Message.

◆ query_stations()

virtual std::shared_ptr<CursorStation> dballe::Message::query_stations ( const Query query) const
pure virtual

Return a Cursor to access the station information in the message.

The cursor will have only one result, with the one station present in the message, contain all station vars.

Parameters
queryThe query data (note: currently ignored)
Returns
The cursor to use to iterate over the results

Implemented in dballe::impl::Message.

◆ set() [1/5]

void dballe::Message::set ( const Level lev,
const Trange tr,
wreport::Varcode  code,
const wreport::Var var 
)

Add or replace a value.

Parameters
levThe Level of the value
trThe Trange of the value
codeThe Varcode of the destination value. If it is different than the varcode of var, a conversion will be attempted.
varThe Var with the value to set

◆ set() [2/5]

void dballe::Message::set ( const Level lev,
const Trange tr,
const wreport::Var var 
)

Add or replace a value.

Parameters
levThe Level of the value
trThe Trange of the value
varThe Var with the value to set

◆ set() [3/5]

void dballe::Message::set ( const Level lev,
const Trange tr,
std::unique_ptr< wreport::Var var 
)

Add or replace a value, taking ownership of the source variable without copying it.

Parameters
levThe Level of the value
trThe Trange of the value
varThe Var with the value to set. This Message will take ownership of memory management.

◆ set() [4/5]

void dballe::Message::set ( const char *  shortcut,
std::unique_ptr< wreport::Var var 
)

Add or replace a value, taking ownership of the source variable without copying it.

Parameters
shortcutShortcut name mapping to a (Level, Trange, Varcode) triplet
varThe Var with the value to set. This Message will take ownership of memory management.

◆ set() [5/5]

void dballe::Message::set ( const char *  shortcut,
const wreport::Var var 
)

Add or replace a value.

Parameters
shortcutShortcut name mapping to a (Level, Trange, Varcode) triplet
varThe Var with the value to set. If its varcode is different than the varcode of the shortcut, a conversion will be attempted.

The documentation for this class was generated from the following file: