1#ifndef DBALLE_MSG_WR_CODEC_H
2#define DBALLE_MSG_WR_CODEC_H
4#include <dballe/core/fwd.h>
5#include <dballe/exporter.h>
6#include <dballe/importer.h>
7#include <dballe/msg/msg.h>
31 std::vector<std::shared_ptr<dballe::Message>>
49 std::function<
bool(std::shared_ptr<dballe::Message>)> dest)
const;
52class BufrImporter :
public WRImporter
57 virtual ~BufrImporter();
59 Encoding
encoding()
const override {
return Encoding::BUFR; }
62 std::function<
bool(std::shared_ptr<dballe::Message>)>
66class CrexImporter :
public WRImporter
71 virtual ~CrexImporter();
73 Encoding
encoding()
const override {
return Encoding::CREX; }
76 std::function<
bool(std::shared_ptr<dballe::Message>)>
92 std::unique_ptr<wreport::Bulletin>
93 to_bulletin(
const std::vector<std::shared_ptr<dballe::Message>>& msgs)
102class BufrExporter :
public WRExporter
106 dballe::ExporterOptions::defaults);
107 virtual ~BufrExporter();
109 std::string to_binary(
const Messages& msgs)
const override;
113class CrexExporter :
public WRExporter
117 dballe::ExporterOptions::defaults);
118 virtual ~CrexExporter();
120 std::string to_binary(
const Messages& msgs)
const override;
126struct TemplateRegistry;
134 void add(wreport::Varcode code,
const msg::Context* ctx,
136 void add(wreport::Varcode code,
const msg::Context* ctx,
137 wreport::Varcode srccode)
const;
138 void add(wreport::Varcode code,
const msg::Context* ctx)
const;
139 void add(wreport::Varcode code,
const Values& values)
const;
140 void add(wreport::Varcode code,
const Values& values,
142 void add(wreport::Varcode code,
const Shortcut& shortcut)
const;
143 void add(wreport::Varcode code, wreport::Varcode srccode,
145 void add(wreport::Varcode code,
const wreport::Var* var)
const;
147 void do_station_name(wreport::Varcode dstcode)
const;
152 void do_ecmwf_past_wtr()
const;
153 void do_station_height()
const;
155 void do_D01001()
const;
156 void do_D01004()
const;
158 void do_D01011()
const;
160 int do_D01012()
const;
162 void do_D01013()
const;
164 void do_D01021()
const;
165 void do_D01022()
const;
167 void do_D01023()
const;
171 const Messages& msgs;
177 : opts(opts), msgs(msgs)
182 virtual const char* name()
const = 0;
183 virtual const char* description()
const = 0;
187struct TemplateFactory
189 typedef std::function<std::unique_ptr<Template>(
193 unsigned data_category = MISSING_INT;
195 std::string description;
196 factory_func factory;
198 TemplateFactory(
unsigned data_category, std::string name,
199 std::string description, factory_func factory)
200 : data_category(data_category), name(name), description(description),
211 void register_factory(
unsigned data_category,
const std::string& name,
212 const std::string& desc,
213 TemplateFactory::factory_func fac);
Binary message.
Definition file.h:135
Definition exporter.h:111
Definition importer.h:147
Options to control message export.
Definition exporter.h:25
Options to control message import.
Definition importer.h:25
static const ImporterOptions defaults
Default importer options.
Definition importer.h:52
Storage for related physical data.
Definition msg.h:134
std::unique_ptr< wreport::Bulletin > make_bulletin() const override
Create a bulletin that works with this exporter.
Encoding encoding() const override
Return the encoding for this importer.
Definition wr_codec.h:59
Store an array of physical data all on the same level.
Definition context.h:24
std::unique_ptr< wreport::Bulletin > make_bulletin() const override
Create a bulletin that works with this exporter.
Encoding encoding() const override
Return the encoding for this importer.
Definition wr_codec.h:73
std::unique_ptr< wreport::Bulletin > to_bulletin(const std::vector< std::shared_ptr< dballe::Message > > &msgs) const override
Import a decoded BUFR/CREX message.
std::unique_ptr< wr::Template > infer_template(const Messages &msgs) const
Infer a template name from the message contents.
std::vector< std::shared_ptr< dballe::Message > > from_bulletin(const wreport::Bulletin &msg) const override
Import a decoded BUFR/CREX message.
bool foreach_decoded_bulletin(const wreport::Bulletin &msg, std::function< bool(std::shared_ptr< dballe::Message >)> dest) const
Build Message objects a decoded bulletin, calling dest on each resulting Message.
Definition wr_codec.h:129
const wreport::Var * find_station_var(wreport::Varcode code) const
Find a variable in c_station, or nullptr if not found.
Vertical level or layer.
Definition types.h:625
Information on how a value has been sampled or computed with regards to time.
Definition types.h:689
Collection of Value objects, indexed by wreport::Varcode.
Definition values.h:216
Definition shortcuts.h:12
Definition wr_codec.h:188
Definition wr_codec.h:207