22 #ifndef DBA_MSG_CODEC_H
23 #define DBA_MSG_CODEC_H
64 bool operator==(
const Options& o)
const {
return simplified == o.simplified; }
65 bool operator!=(
const Options& o)
const {
return simplified != o.simplified; }
68 void print(FILE* out);
81 Importer(
const Options& opts);
92 virtual void from_rawmsg(
const Rawmsg& msg, Msgs& msgs)
const = 0;
97 virtual void from_bulletin(
const wreport::Bulletin& msg, Msgs& msgs)
const = 0;
101 static std::auto_ptr<Importer>
create(Encoding type,
const Options& opts=Options());
127 : centre(MISSING_INT), subcentre(MISSING_INT), application(MISSING_INT) {}
130 void print(FILE* out);
156 virtual void to_bulletin(
const Msgs& msgs, wreport::Bulletin& msg)
const = 0;
164 virtual std::auto_ptr<wreport::Bulletin>
make_bulletin()
const;
168 static std::auto_ptr<Exporter>
create(Encoding type,
const Options& opts=Options());
virtual void from_rawmsg(const Rawmsg &msg, Msgs &msgs) const =0
Decode a message from its raw encoded representation.
static Options from_string(const std::string &s)
Opposite of to_string: create an Options from a string.
static std::auto_ptr< Importer > create(Encoding type, const Options &opts=Options())
Instantiate the right importer for the given type.
Options()
Create new Options initialised with default values.
Definition: codec.h:126
Message importer.
Definition: codec.h:53
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 void to_rawmsg(const Msgs &msgs, Rawmsg &msg) const =0
Encode a message.
int centre
Originating centre.
Definition: codec.h:119
std::string template_name
Name of template to use for output (leave empty to autodetect)
Definition: codec.h:117
int subcentre
Originating subcentre.
Definition: codec.h:121
void print(FILE *out)
Print a summary of the options to out.
virtual std::auto_ptr< wreport::Bulletin > make_bulletin() const
Create a bulletin that works with this exporter.
static std::auto_ptr< Exporter > create(Encoding type, const Options &opts=Options())
Instantiate the right importer for the given type.
virtual void to_bulletin(const Msgs &msgs, wreport::Bulletin &msg) const =0
Export to a Bulletin.
In-memory storage of an encoded weather report.
Definition: conversion.h:31
Dynamic array of dba_msg.
Definition: msgs.h:38
Annotated string buffer for encoded messages.
Definition: rawmsg.h:38
int application
Originating application ID.
Definition: codec.h:123
Options()
Create new Options initialised with default values.
Definition: codec.h:61
Message exporter.
Definition: codec.h:111
std::string to_string() const
Generate a string summary of import options.
virtual void from_bulletin(const wreport::Bulletin &msg, Msgs &msgs) const =0
Import a decoded BUFR/CREX message.