libdballe  7.29
aof_codec.h
Go to the documentation of this file.
1 #ifndef DBALLE_AOF_CODEC_H
2 #define DBALLE_AOF_CODEC_H
3 
27 #include <dballe/msg/codec.h>
28 #include <stdint.h>
29 
30 namespace dballe {
31 struct Msg;
32 
33 namespace msg {
34 
35 class AOFImporter : public Importer
36 {
37 protected:
38  // Message-specific code
39  static void read_synop(const uint32_t* obs, int obs_len, Msg& msg);
40  static void read_flight(const uint32_t* obs, int obs_len, Msg& msg);
41  static void read_satob(const uint32_t* obs, int obs_len, Msg& msg);
42  static void read_dribu(const uint32_t* obs, int obs_len, Msg& msg);
43  static void read_temp(const uint32_t* obs, int obs_len, Msg& msg);
44  static void read_pilot(const uint32_t* obs, int obs_len, Msg& msg);
45  static void read_satem(const uint32_t* obs, int obs_len, Msg& msg);
46 
48  static void parse_st_block_station(const uint32_t* obs, Msg& msg);
50  static void parse_altitude(const uint32_t* obs, Msg& msg);
52  static void parse_st_ident(const uint32_t* obs, Msg& msg);
58  static int parse_lat_lon_datetime(const uint32_t* obs, Msg& msg);
60  static void parse_weather_group(const uint32_t* obs, Msg& msg, int hour);
62  static void parse_general_cloud_group(const uint32_t* obs, Msg& msg);
64  static void parse_cloud_group(uint32_t val, int* ns, int* c, int* h);
65 
66 
67 public:
68  AOFImporter(const Options& opts=Options());
69  virtual ~AOFImporter();
70 
71  bool foreach_decoded(const BinaryMessage& msg, std::function<bool(std::unique_ptr<Message>&&)> dest) const override;
72 
73  Messages from_bulletin(const wreport::Bulletin& msg) const override;
74 
85  static void get_category(const BinaryMessage& msg, int* category, int* subcategory);
86 
95  static void dump(const BinaryMessage& msg, FILE* out);
96 };
97 
98 } // namespace msg
99 } // namespace dballe
100 
101 /* vim:set ts=4 sw=4: */
102 #endif
static void parse_altitude(const uint32_t *obs, Msg &msg)
Parse station altitude the Observation Header.
Storage for related physical data.
Definition: msg.h:70
static void dump(const BinaryMessage &msg, FILE *out)
Print the contents of the AOF message.
Definition: codec.h:36
Messages from_bulletin(const wreport::Bulletin &msg) const override
Import a decoded BUFR/CREX message.
static void parse_cloud_group(uint32_t val, int *ns, int *c, int *h)
Parse a bit-packed cloud group in Synop observations.
General codec options.
Message importer.
Definition: codec.h:33
static void parse_st_ident(const uint32_t *obs, Msg &msg)
Parse string ident in the Observation Header.
static void parse_weather_group(const uint32_t *obs, Msg &msg, int hour)
Parse 27 Weather group in Synop observations.
Binary message.
Definition: file.h:132
Ordered collection of messages.
Definition: message.h:67
static void parse_general_cloud_group(const uint32_t *obs, Msg &msg)
Parse 28 General cloud group in Synop observations.
static int parse_lat_lon_datetime(const uint32_t *obs, Msg &msg)
Parse latitude, longitude, date and time in the Observation Header.
static void parse_st_block_station(const uint32_t *obs, Msg &msg)
Parse WMO block and station numbers in the Observation Header.
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: aof_codec.h:35
static void get_category(const BinaryMessage &msg, int *category, int *subcategory)
Get category and subcategory of an AOF message.