1 #ifndef DBA_MSG_CODEC_H
2 #define DBA_MSG_CODEC_H
4 #include <dballe/file.h>
5 #include <dballe/message.h>
44 bool operator==(
const Options& o)
const {
return simplified == o.simplified; }
45 bool operator!=(
const Options& o)
const {
return simplified != o.simplified; }
48 void print(FILE* out);
61 Importer(
const Options& opts);
72 Messages
from_binary(
const BinaryMessage& msg)
const;
86 virtual bool foreach_decoded(
const BinaryMessage& msg, std::function<
bool(std::unique_ptr<Message>&&)> dest)
const = 0;
124 void print(FILE* out);
158 virtual std::unique_ptr<wreport::Bulletin>
make_bulletin()
const;
static std::unique_ptr< Exporter > create(File::Encoding type, const Options &opts=Options())
Instantiate the right importer for the given type.
Encoding
Supported encodings.
Definition: file.h:21
virtual std::unique_ptr< wreport::Bulletin > to_bulletin(const Messages &msgs) const =0
Export to a Bulletin.
virtual Messages from_bulletin(const wreport::Bulletin &msg) const =0
Import a decoded BUFR/CREX message.
static Options from_string(const std::string &s)
Opposite of to_string: create an Options from a string.
Options()
Create new Options initialised with default values.
Definition: codec.h:120
virtual bool foreach_decoded(const BinaryMessage &msg, std::function< bool(std::unique_ptr< Message > &&)> dest) const =0
Decode a message from its raw encoded representation, calling dest on each resulting Message...
virtual std::string to_binary(const Messages &msgs) const =0
Encode a message.
Message importer.
Definition: codec.h:33
std::string to_string() const
Generate a string summary of export options.
void print(FILE *out)
Print a summary of the options to out.
virtual std::unique_ptr< wreport::Bulletin > make_bulletin() const
Create a bulletin that works with this exporter.
int centre
Originating centre.
Definition: codec.h:113
std::string template_name
Name of template to use for output (leave empty to autodetect)
Definition: codec.h:111
int subcentre
Originating subcentre.
Definition: codec.h:115
static std::unique_ptr< Importer > create(File::Encoding type, const Options &opts=Options())
Instantiate the right importer for the given type.
void print(FILE *out)
Print a summary of the options to out.
Ordered collection of messages.
Definition: message.h:67
int application
Originating application ID.
Definition: codec.h:117
Options()
Create new Options initialised with default values.
Definition: codec.h:41
Message exporter.
Definition: codec.h:105
std::string to_string() const
Generate a string summary of import options.
Messages from_binary(const BinaryMessage &msg) const
Decode a message from its raw encoded representation.