1 #ifndef DBA_MSG_CODEC_H
2 #define DBA_MSG_CODEC_H
4 #include <dballe/file.h>
5 #include <dballe/message.h>
43 bool operator==(
const Options& o)
const {
return simplified == o.simplified; }
44 bool operator!=(
const Options& o)
const {
return simplified != o.simplified; }
47 void print(FILE* out);
60 Importer(
const Options& opts);
71 Messages
from_binary(
const BinaryMessage& msg)
const;
85 virtual bool foreach_decoded(
const BinaryMessage& msg, std::function<
bool(std::unique_ptr<Message>&&)> dest)
const = 0;
90 virtual Messages
from_bulletin(
const wreport::Bulletin& msg)
const = 0;
120 : centre(MISSING_INT), subcentre(MISSING_INT), application(MISSING_INT) {}
123 void print(FILE* out);
157 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:20
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:119
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:32
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.
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
int centre
Originating centre.
Definition: codec.h:112
std::string template_name
Name of template to use for output (leave empty to autodetect)
Definition: codec.h:110
int subcentre
Originating subcentre.
Definition: codec.h:114
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:64
Definition: conversion.h:6
int application
Originating application ID.
Definition: codec.h:116
Options()
Create new Options initialised with default values.
Definition: codec.h:40
Message exporter.
Definition: codec.h:104
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.