1#ifndef WREPORT_BUFR_DECODER_H
2#define WREPORT_BUFR_DECODER_H
4#include <wreport/var.h>
5#include <wreport/bulletin.h>
6#include <wreport/bulletin/interpreter.h>
7#include <wreport/bufr/input.h>
11struct DispatchToSubsets;
32 void decode_sec1ed3();
33 void decode_sec1ed4();
79 virtual const Var& decode_and_add_bitmap(
const Tables& tables,
Varcode code,
unsigned bitmap_size) = 0;
128 const Var& decode_and_add_bitmap(
const Tables& tables,
Varcode code,
unsigned bitmap_size)
override;
153 const Var& decode_and_add_bitmap(
const Tables& tables,
Varcode code,
unsigned bitmap_size)
override;
164 void decode_b_value(
Varinfo info, std::function<
void(
unsigned,
Var&&)> dest);
195 void print_lead_continued();
BUFR bulletin implementation.
Definition bulletin.h:229
Options used to configure BUFR decoding.
Definition bulletin.h:200
Storage for the decoded data of a BUFR or CREX message.
Definition bulletin.h:30
Represent a BUFR/CREX data subset as a list of decoded variables.
Definition subset.h:13
A physical variable.
Definition var.h:25
String functions.
Definition benchmark.h:13
uint16_t Varcode
Holds the WMO variable code of a variable.
Definition fwd.h:12
Sequence of opcodes, as a slice of a Varcode vector.
Definition opcodes.h:20
Collection of BUFR/CREX tables used to work on a bulletin.
Definition tables.h:15
Information about a variable.
Definition varinfo.h:139
int decode_c03_refval_override(unsigned bits) override
Decode the given number of bits a signed integer, to use as a new value for B table reference value.
void decode_and_set_attribute(Varinfo info, unsigned pos) override
Decode an attribute with the given description, and add it to data at position pos.
void decode_and_add_raw_character_data(Varinfo info) override
Decode raw character data described by code and add it to the target subset(s)
Bulletin & out
Output bulletin.
Definition decoder.h:142
void decode_and_add_b_value_with_associated_field(Varinfo info, const bulletin::AssociatedField &field) override
Decode a B-table value with associated field, and add its value(s) to the target subset(s)
void decode_and_add_b_value(Varinfo info) override
Decode a B-table value and add its value(s) to the target subset(s)
const Var & decode_and_add_to_all(Varinfo info) override
Decode and add the same value to all datasets, return a reference to one of the variables added.
void print_last_attribute_added(FILE *out, Varcode code, unsigned pos) override
Print the value(s) of the last attributes(s) with the given code added to out.
const Subset & reference_subset() const override
Return the reference to a subset that is receiving the data currently decoded.
Varinfo lookup_info(unsigned pos) const override
Return information about a value previously stored at the given position.
unsigned subset_count
Number of subsets in data section.
Definition decoder.h:145
void print_last_variable_added(FILE *out) override
Print the value(s) of the last variable(s) added to out.
Var decode_uniform_b_value(Varinfo info) override
Decode a value that must always be the same across all datasets.
void define_substituted_value(unsigned pos) override
Request processing of a substituted value corresponding to position pos in the list or previous varia...
void define_c03_refval_override(Varcode code) override
Request processing of a new value for the reference value of the given B code.
void define_variable(Varinfo info) override
Request processing, according to info, of a data variable.
void define_attribute(Varinfo info, unsigned pos) override
Request processing of an attribute encoded with info, related to the variable as position pos in the ...
void define_raw_character_data(Varcode code) override
Request processing of C05yyy raw character data.
unsigned define_associated_field_significance(Varinfo info) override
Request processing of an associated field significance variable (B31021).
unsigned define_delayed_replication_factor(Varinfo info) override
Request processing, according to info, of a data variabile that is significant for controlling the en...
void define_bitmap(unsigned bitmap_size) override
Request processing of a data present bitmap.
unsigned define_bitmap_delayed_replication_factor(Varinfo info) override
Request processing of a delayed replication factor variable used to encode the size of a bitmap.
void define_variable_with_associated_field(Varinfo info) override
Request processing, according to info, of a data variable.
virtual int decode_c03_refval_override(unsigned bits)=0
Decode the given number of bits a signed integer, to use as a new value for B table reference value.
virtual void decode_and_add_b_value(Varinfo info)=0
Decode a B-table value and add its value(s) to the target subset(s)
virtual void decode_and_add_raw_character_data(Varinfo info)=0
Decode raw character data described by code and add it to the target subset(s)
Input & in
Input buffer.
Definition decoder.h:45
virtual void decode_and_add_b_value_with_associated_field(Varinfo info, const bulletin::AssociatedField &field)=0
Decode a B-table value with associated field, and add its value(s) to the target subset(s)
virtual Varinfo lookup_info(unsigned pos) const =0
Return information about a value previously stored at the given position.
virtual const Var & decode_and_add_to_all(Varinfo info)=0
Decode and add the same value to all datasets, return a reference to one of the variables added.
virtual void print_last_attribute_added(FILE *out, Varcode code, unsigned pos)=0
Print the value(s) of the last attributes(s) with the given code added to out.
virtual Var decode_uniform_b_value(Varinfo info)=0
Decode a value that must always be the same across all datasets.
virtual void print_last_variable_added(FILE *out)=0
Print the value(s) of the last variable(s) added to out.
virtual const Subset & reference_subset() const =0
Return the reference to a subset that is receiving the data currently decoded.
virtual void decode_and_set_attribute(Varinfo info, unsigned pos)=0
Decode an attribute with the given description, and add it to data at position pos.
FILE * verbose_output
If set, be verbose and print a trace of decoding to the given file.
Definition decoder.h:26
Input in
Input data.
Definition decoder.h:16
bool conf_add_undef_attrs
True if undefined attributes are added to the output, else false.
Definition decoder.h:22
size_t expected_subsets
Number of expected subsets (read in decode_header, used in decode_data)
Definition decoder.h:20
unsigned optional_section_length
Optional section length decoded from the message.
Definition decoder.h:24
int decode_c03_refval_override(unsigned bits) override
Decode the given number of bits a signed integer, to use as a new value for B table reference value.
const Subset & reference_subset() const override
Return the reference to a subset that is receiving the data currently decoded.
Subset & out
Subset where decoded variables go.
Definition decoder.h:120
void decode_and_add_b_value(Varinfo info) override
Decode a B-table value and add its value(s) to the target subset(s)
Varinfo lookup_info(unsigned pos) const override
Return information about a value previously stored at the given position.
void decode_and_add_b_value_with_associated_field(Varinfo info, const bulletin::AssociatedField &field) override
Decode a B-table value with associated field, and add its value(s) to the target subset(s)
void print_last_attribute_added(FILE *out, Varcode code, unsigned pos) override
Print the value(s) of the last attributes(s) with the given code added to out.
void decode_and_set_attribute(Varinfo info, unsigned pos) override
Decode an attribute with the given description, and add it to data at position pos.
Var decode_uniform_b_value(Varinfo info) override
Decode a value that must always be the same across all datasets.
const Var & decode_and_add_to_all(Varinfo info) override
Decode and add the same value to all datasets, return a reference to one of the variables added.
void decode_and_add_raw_character_data(Varinfo info) override
Decode raw character data described by code and add it to the target subset(s)
void print_last_variable_added(FILE *out) override
Print the value(s) of the last variable(s) added to out.
void define_variable_with_associated_field(Varinfo info) override
Request processing, according to info, of a data variable.
unsigned indent
Current indent level.
Definition decoder.h:206
unsigned define_associated_field_significance(Varinfo info) override
Request processing of an associated field significance variable (B31021).
void run_d_expansion(Varcode code) override
Executes the expansion of code, which has been put on top of the opcode stack.
void c_modifier(Varcode code, Opcodes &next) override
Notify of a C modifier.
void define_substituted_value(unsigned pos) override
Request processing of a substituted value corresponding to position pos in the list or previous varia...
void define_c03_refval_override(Varcode code) override
Request processing of a new value for the reference value of the given B code.
void define_bitmap(unsigned bitmap_size) override
Request processing of a data present bitmap.
unsigned define_bitmap_delayed_replication_factor(Varinfo info) override
Request processing of a delayed replication factor variable used to encode the size of a bitmap.
void r_replication(Varcode code, Varcode delayed_code, const Opcodes &ops) override
Handle a replicated section.
unsigned define_delayed_replication_factor(Varinfo info) override
Request processing, according to info, of a data variabile that is significant for controlling the en...
unsigned indent_step
How many spaces in an indentation level.
Definition decoder.h:209
void print_lead(Varcode code)
Print line lead (indentation and formatted code)
void b_variable(Varcode code) override
Notify of a B variable entry.
void define_attribute(Varinfo info, unsigned pos) override
Request processing of an attribute encoded with info, related to the variable as position pos in the ...
void define_raw_character_data(Varcode code) override
Request processing of C05yyy raw character data.
void define_variable(Varinfo info) override
Request processing, according to info, of a data variable.
Definition associated_fields.h:13
Interpreter for data descriptor sections.
Definition interpreter.h:26