libwreport  2.4
Public Member Functions | Data Fields
wreport::Bulletin Struct Reference

Storage for the decoded data of a BUFR or CREX message. More...

#include <bulletin.h>

Inheritance diagram for wreport::Bulletin:
wreport::BufrBulletin wreport::CrexBulletin

Public Member Functions

virtual void clear ()
 Reset the bulletin.
virtual const char * encoding_name () const =0 throw ()
 Type of source/target encoding.
Subsetobtain_subset (unsigned subsection)
 Get a Subset from the message.
const Subsetsubset (unsigned subsection) const
 Get a Subset from the message.
virtual void load_tables ()=0
 Load a new set of tables to use for encoding this message.
virtual void decode_header (const std::string &buf, const char *fname="(memory)", size_t offset=0)=0
 Parse only the header of an encoded message.
virtual void decode (const std::string &buf, const char *fname="(memory)", size_t offset=0)=0
 Parse an encoded message.
virtual void encode (std::string &buf) const =0
 Encode the message.
void visit_datadesc (opcode::Visitor &e) const
 Walk the structure of the data descriptor section sending events to an opcode::Explorer.
void visit (bulletin::Visitor &out) const
 Run the Data Descriptor Section interpreter, sending commands to executor.
void print (FILE *out) const
 Dump the contents of this bulletin.
void print_structured (FILE *out) const
 Dump the contents of this bulletin, in a more structured way.
virtual void print_details (FILE *out) const
 Print format-specific details.
void print_datadesc (FILE *out, unsigned indent=0) const
 Pretty-print the data descriptor section.
virtual unsigned diff (const Bulletin &msg) const
 Compute the differences between two bulletins.
virtual unsigned diff_details (const Bulletin &msg) const
 Diff format-specific details.

Data Fields

const char * fname
 Input file name (optional).
size_t offset
 File offset of the start of the message.
int type
 Message category.
int subtype
 International message subcategory.
int localsubtype
 Local message subcategory.
int edition
 Edition number.
int master_table_number
 Master table number.
const Vartablebtable
 vartable used to lookup B table codes
const DTabledtable
 dtable used to lookup D table codes
std::vector< Varcodedatadesc
 Parsed data descriptor section.
std::vector< Subsetsubsets
 Decoded variables.
int rep_year
 Representative datetime for this data.
int rep_month
 Month.
int rep_day
 Day.
int rep_hour
 Hour.
int rep_minute
 Minute.
int rep_second
 Second.

Detailed Description

Storage for the decoded data of a BUFR or CREX message.

A Bulletin roughly reflects the structure of a BUFR or CREX message: it contains metadata, a sequence of wreport::Varcode with the contents of a Data Descriptor Section, and one or more wreport::Subset with the decoded values.

Subsets are essentially sequences of wreport::Var objects, and therefore contain the values together with the full range of variable information, including type, measurement units and number of significant digits.

Extra values like quality control statistics or replaced values are represented as 'attributes' to the wreport::Var objects.

Member Function Documentation

virtual void wreport::Bulletin::decode ( const std::string &  buf,
const char *  fname = "(memory)",
size_t  offset = 0 
)
pure virtual

Parse an encoded message.

Parameters
bufThe buffer to decode
fnameThe file name to use for error messages
offsetThe offset inside the file of the start of the bulletin, used for error messages

Implemented in wreport::CrexBulletin, and wreport::BufrBulletin.

virtual void wreport::Bulletin::decode_header ( const std::string &  buf,
const char *  fname = "(memory)",
size_t  offset = 0 
)
pure virtual

Parse only the header of an encoded message.

Parameters
bufThe buffer to decode
fnameThe file name to use for error messages
offsetThe offset inside the file of the start of the bulletin, used for error messages

Implemented in wreport::CrexBulletin, and wreport::BufrBulletin.

virtual unsigned wreport::Bulletin::diff ( const Bulletin msg) const
virtual

Compute the differences between two bulletins.

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

See Also
notes.h).
Parameters
msgThe bulletin to compare with this one
Returns
The number of differences found
Subset& wreport::Bulletin::obtain_subset ( unsigned  subsection)

Get a Subset from the message.

The subset will be created if it does not exist, and it will be memory managed by the Bulletin.

Parameters
subsectionThe subsection index (starting from 0)
void wreport::Bulletin::print_datadesc ( FILE *  out,
unsigned  indent = 0 
) const

Pretty-print the data descriptor section.

Parameters
outOutput stream to use
indentIndent all output by this amount of spaces
const Subset& wreport::Bulletin::subset ( unsigned  subsection) const

Get a Subset from the message.

An exception will be thrown if the subset does not exist

Parameters
subsectionThe subsection index (starting from 0)

Field Documentation

const char* wreport::Bulletin::fname

Input file name (optional).

If available, it will be used to generate better error messages.

If not available, it is NULL.

size_t wreport::Bulletin::offset

File offset of the start of the message.

If available, it will be used to generate better error messages.

If not available, it is 0.

int wreport::Bulletin::rep_year

Representative datetime for this data.

Year


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