libdballe  5.18
msgs.h
Go to the documentation of this file.
1 /*
2  * msg/msgs - Hold a group of similar Msg
3  *
4  * Copyright (C) 2005--2011 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 DBA_MSG_MSGS_H
23 #define DBA_MSG_MSGS_H
24 
30 #include <dballe/msg/msg.h>
31 #include <vector>
32 #include <memory>
33 
34 namespace dballe {
35 struct CSVReader;
36 
38 struct Msgs : public std::vector<Msg*>
39 {
40  Msgs();
41  ~Msgs();
42 
49  void acquire(const Msg& msg);
50 
58  void acquire(std::auto_ptr<Msg> msg);
59 
67  bool from_csv(CSVReader& in);
68 
72  void to_csv(std::ostream& out) const;
73 
80  void print(FILE* out) const;
81 
93  unsigned diff(const Msgs& msgs) const;
94 };
95 
99 struct MatchedMsgs : public Matched
100 {
101  const Msgs& m;
102 
103  MatchedMsgs(const Msgs& m);
104  ~MatchedMsgs();
105 
106  virtual matcher::Result match_var_id(int val) const;
107  virtual matcher::Result match_station_id(int val) const;
108  virtual matcher::Result match_station_wmo(int block, int station=-1) const;
109  virtual matcher::Result match_date(const int* min, const int* max) const;
110  virtual matcher::Result match_coords(int latmin, int latmax, int lonmin, int lonmax) const;
111  virtual matcher::Result match_rep_memo(const char* memo) const;
112 };
113 
114 }
115 
116 /* vim:set ts=4 sw=4: */
117 #endif