1 #ifndef DBALLE_MSG_WR_CODEC_H
2 #define DBALLE_MSG_WR_CODEC_H
5 #include <wreport/varinfo.h>
43 bool foreach_decoded_bulletin(
const wreport::Bulletin& msg, std::function<
bool(std::unique_ptr<Message>&&)> dest)
const;
91 virtual std::unique_ptr<wreport::Bulletin>
make_bulletin()
const;
101 virtual std::unique_ptr<wreport::Bulletin>
make_bulletin()
const;
106 struct TemplateRegistry;
111 virtual void setupBulletin(wreport::Bulletin& bulletin);
112 virtual void to_subset(
const Msg& msg, wreport::Subset& subset);
114 void add(wreport::Varcode code,
const msg::Context* ctx,
int shortcut)
const;
115 void add(wreport::Varcode code,
const msg::Context* ctx, wreport::Varcode srccode)
const;
116 void add(wreport::Varcode code,
const msg::Context* ctx)
const;
117 void add(wreport::Varcode code,
int shortcut)
const;
118 void add(wreport::Varcode code, wreport::Varcode srccode,
const Level& level,
const Trange& trange)
const;
119 void add(wreport::Varcode code,
const wreport::Var* var)
const;
121 void do_station_name(wreport::Varcode dstcode)
const;
126 void do_ecmwf_past_wtr()
const;
127 void do_station_height()
const;
129 void do_D01001()
const;
130 void do_D01004()
const;
132 void do_D01011()
const;
134 int do_D01012()
const;
136 void do_D01013()
const;
138 void do_D01021()
const;
139 void do_D01022()
const;
141 void do_D01023()
const;
149 wreport::Subset* subset = 0;
152 : opts(opts), msgs(msgs) {}
155 virtual const char* name()
const = 0;
156 virtual const char* description()
const = 0;
157 virtual void to_bulletin(wreport::Bulletin& bulletin);
164 unsigned data_category = MISSING_INT;
166 std::string description;
167 factory_func factory;
169 TemplateFactory(
unsigned data_category, std::string name, std::string description, factory_func factory)
170 : data_category(data_category), name(name), description(description), factory(factory) {}
178 void register_factory(
179 unsigned data_category,
180 const std::string& name,
181 const std::string& desc,
182 TemplateFactory::factory_func fac);
Store an array of physical data all on the same level.
Definition: context.h:44
bool foreach_decoded(const BinaryMessage &msg, std::function< bool(std::unique_ptr< Message > &&)> dest) const override
Decode a message from its raw encoded representation, calling dest on each resulting Message...
Definition: wr_codec.h:160
Definition: wr_codec.h:21
virtual std::unique_ptr< wreport::Bulletin > make_bulletin() const
Create a bulletin that works with this exporter.
Storage for related physical data.
Definition: msg.h:133
virtual std::string to_binary(const Messages &msgs) const
Encode a message.
Information on how a value has been sampled or computed with regards to time.
Definition: types.h:565
Message importer.
Definition: codec.h:32
bool foreach_decoded_bulletin(const wreport::Bulletin &msg, std::function< bool(std::unique_ptr< Message > &&)> dest) const
Decode a message from its decoded bulletin, calling dest on each resulting Msg.
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
Definition: wr_codec.h:173
Vertical level or layer.
Definition: types.h:515
Definition: wr_codec.h:108
Messages from_bulletin(const wreport::Bulletin &msg) const override
Import a decoded BUFR/CREX message.
virtual std::unique_ptr< wreport::Bulletin > make_bulletin() const
Create a bulletin that works with this exporter.
Binary message.
Definition: file.h:131
Definition: wr_codec.h:55
Ordered collection of messages.
Definition: message.h:64
Definition: wr_codec.h:94
Definition: conversion.h:6
Definition: wr_codec.h:46
Definition: wr_codec.h:84
bool foreach_decoded(const BinaryMessage &msg, std::function< bool(std::unique_ptr< Message > &&)> dest) const override
Decode a message from its raw encoded representation, calling dest on each resulting Message...
std::unique_ptr< wreport::Bulletin > to_bulletin(const Messages &msgs) const override
Import a decoded BUFR/CREX message.
Message exporter.
Definition: codec.h:104
Definition: wr_codec.h:68
virtual std::string to_binary(const Messages &msgs) const
Encode a message.
const wreport::Var * find_station_var(wreport::Varcode code) const
Find a variable in c_station, or nullptr if not found.
std::unique_ptr< wr::Template > infer_template(const Messages &msgs) const
Infer a template name from the message contents.