libdballe  5.18
aof_codec.h
Go to the documentation of this file.
1 /*
2  * dballe/aof_codec - AOF import
3  *
4  * Copyright (C) 2005--2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * Author: Enrico Zini <enrico@enricozini.com>
20  */
21 
22 #ifndef DBALLE_AOF_CODEC_H
23 #define DBALLE_AOF_CODEC_H
24 
48 #include <dballe/msg/codec.h>
49 #include <stdint.h>
50 
51 namespace dballe {
52 struct Msg;
53 
54 namespace msg {
55 
56 class AOFImporter : public Importer
57 {
58 protected:
59  // Message-specific code
60  static void read_synop(const uint32_t* obs, int obs_len, Msg& msg);
61  static void read_flight(const uint32_t* obs, int obs_len, Msg& msg);
62  static void read_satob(const uint32_t* obs, int obs_len, Msg& msg);
63  static void read_dribu(const uint32_t* obs, int obs_len, Msg& msg);
64  static void read_temp(const uint32_t* obs, int obs_len, Msg& msg);
65  static void read_pilot(const uint32_t* obs, int obs_len, Msg& msg);
66  static void read_satem(const uint32_t* obs, int obs_len, Msg& msg);
67 
69  static void parse_st_block_station(const uint32_t* obs, Msg& msg);
71  static void parse_altitude(const uint32_t* obs, Msg& msg);
73  static void parse_st_ident(const uint32_t* obs, Msg& msg);
79  static int parse_lat_lon_datetime(const uint32_t* obs, Msg& msg);
81  static void parse_weather_group(const uint32_t* obs, Msg& msg, int hour);
83  static void parse_general_cloud_group(const uint32_t* obs, Msg& msg);
85  static void parse_cloud_group(uint32_t val, int* ns, int* c, int* h);
86 
87 
88 public:
89  AOFImporter(const Options& opts=Options());
90  virtual ~AOFImporter();
91 
102  virtual void from_rawmsg(const Rawmsg& msg, Msgs& msgs) const;
103 
107  virtual void from_bulletin(const wreport::Bulletin& msg, Msgs& msgs) const;
108 
119  static void get_category(const Rawmsg& msg, int* category, int* subcategory);
120 
129  static void dump(const Rawmsg& msg, FILE* out);
130 };
131 
132 } // namespace msg
133 } // namespace dballe
134 
135 /* vim:set ts=4 sw=4: */
136 #endif