1 #ifndef WREPORT_BULLETIN_H
2 #define WREPORT_BULLETIN_H
4 #include <wreport/var.h>
5 #include <wreport/subset.h>
6 #include <wreport/opcodes.h>
7 #include <wreport/tables.h>
8 #include <wreport/fwd.h>
131 virtual void clear();
161 virtual std::
string encode() const = 0;
164 void print(FILE* out) const;
212 bool decode_adds_undef_attrs =
false;
221 static std::unique_ptr<BufrCodecOptions> create();
232 uint8_t edition_number = 4;
241 uint8_t master_table_version_number = 19;
251 uint8_t master_table_version_number_local = 0;
268 unsigned section_end[6] = { 0, 0, 0, 0, 0, 0 };
276 std::string
encode()
const override;
294 static bool read(FILE* in, std::string& buf,
const char*
fname=0, off_t*
offset=0);
306 static void write(
const std::string& buf, FILE* out,
const char*
fname=0);
312 static std::unique_ptr<BufrBulletin> create();
326 static std::unique_ptr<BufrBulletin> decode_header(
const std::string& raw,
const char*
fname=
"(memory)",
size_t offset=0);
342 static std::unique_ptr<BufrBulletin> decode_header(
const std::string& raw,
const BufrCodecOptions& opts,
const char*
fname=
"(memory)",
size_t offset=0);
356 static std::unique_ptr<BufrBulletin> decode(
const std::string& raw,
const char*
fname=
"(memory)",
size_t offset=0);
372 static std::unique_ptr<BufrBulletin> decode_verbose(
const std::string& raw, FILE* out,
const char*
fname=
"(memory)",
size_t offset=0);
388 static std::unique_ptr<BufrBulletin> decode(
const std::string& raw,
const BufrCodecOptions& opts,
const char*
fname=
"(memory)",
size_t offset=0);
399 uint8_t edition_number = 2;
407 uint8_t master_table_version_number = 19;
420 uint8_t master_table_version_number_bufr = 19;
430 uint8_t master_table_version_number_local = 0;
433 bool has_check_digit =
false;
439 std::string
encode()
const override;
457 static bool read(FILE* in, std::string& buf,
const char*
fname=0, off_t*
offset=0);
469 static void write(
const std::string& buf, FILE* out,
const char*
fname=0);
475 static std::unique_ptr<CrexBulletin> create();
489 static std::unique_ptr<CrexBulletin> decode_header(
const std::string& raw,
const char*
fname=
"(memory)",
size_t offset=0);
503 static std::unique_ptr<CrexBulletin> decode(
const std::string& raw,
const char*
fname=
"(memory)",
size_t offset=0);
519 static std::unique_ptr<CrexBulletin> decode_verbose(
const std::string& raw, FILE* out,
const char*
fname=
"(memory)",
size_t offset=0);
uint8_t rep_day
Most typical time for the BUFR message contents.
Definition: bulletin.h:111
virtual void print_details(FILE *out) const
Print format-specific details.
void print(FILE *out) const
Dump the contents of this bulletin.
void print_datadesc(FILE *out, unsigned indent=0) const
Pretty-print the data descriptor section.
virtual std::string encode() const =0
Encode the message.
Collection of BUFR/CREX tables used to work on a bulletin.
Definition: tables.h:17
uint16_t originating_subcentre
Identification of originating/generating sub-centre (allocated by originating/generating centre - see...
Definition: bulletin.h:94
const Subset & subset(unsigned subsection) const
Get a Subset from the message.
const char * encoding_name() const override
Type of source/target encoding.
Definition: bulletin.h:274
bool compression
Whether the message is compressed.
Definition: bulletin.h:254
std::string optional_section
Raw optional section of the message.
Definition: bulletin.h:261
Storage for the decoded data of a BUFR or CREX message.
Definition: bulletin.h:30
uint8_t rep_minute
Most typical time for the BUFR message contents.
Definition: bulletin.h:113
uint8_t master_table_number
BUFR Master table number.
Definition: bulletin.h:60
void print_structured(FILE *out) const
Dump the contents of this bulletin, in a more structured way.
virtual const char * encoding_name() const =0
Type of source/target encoding.
std::string fname
Input file name (optional).
Definition: bulletin.h:39
std::vector< Subset > subsets
Decoded variables.
Definition: bulletin.h:124
off_t offset
File offset of the start of the message.
Definition: bulletin.h:48
uint8_t rep_second
Most typical time for the BUFR message contents.
Definition: bulletin.h:114
virtual unsigned diff_details(const Bulletin &msg) const
Diff format-specific details.
uint8_t data_subcategory
International data sub-category (see Common Code table C-13)
Definition: bulletin.h:66
std::vector< Varcode > datadesc
Parsed data descriptor section.
Definition: bulletin.h:121
CREX bulletin implementation.
Definition: bulletin.h:396
uint8_t data_category
Data category (BUFR or CREX Table A)
Definition: bulletin.h:63
Represent a BUFR/CREX data subset as a list of decoded variables.
Definition: subset.h:13
Subset & obtain_subset(unsigned subsection)
Get a Subset from the message.
uint8_t rep_hour
Most typical time for the BUFR message contents.
Definition: bulletin.h:112
virtual void clear()
Reset the bulletin.
virtual void load_tables()=0
Load a new set of tables to use for encoding this message.
uint16_t rep_year
Most typical time for the BUFR message contents.
Definition: bulletin.h:109
virtual unsigned diff(const Bulletin &msg) const
Compute the differences between two bulletins.
Options used to configure BUFR decoding.
Definition: bulletin.h:201
uint8_t rep_month
Most typical time for the BUFR message contents.
Definition: bulletin.h:110
Tables tables
Varcode and opcode tables used for encoding or decoding.
Definition: bulletin.h:118
uint8_t data_subcategory_local
Local data sub-category, defined locally by automatic data-processing (ADP) centres.
Definition: bulletin.h:82
String functions.
Definition: benchmark.h:13
BUFR bulletin implementation.
Definition: bulletin.h:229
const char * encoding_name() const override
Type of source/target encoding.
Definition: bulletin.h:437
uint16_t originating_centre
Identification of originating/generating centre (see Common Code table C-11)
Definition: bulletin.h:88
uint8_t update_sequence_number
Update sequence number (zero for original messages and for messages containing only delayed reports; ...
Definition: bulletin.h:100