libdballe
5.18
|
00001 /* 00002 * msg/msgs - Hold a group of similar Msg 00003 * 00004 * Copyright (C) 2005--2011 ARPA-SIM <urpsim@smr.arpa.emr.it> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 * 00019 * Author: Enrico Zini <enrico@enricozini.com> 00020 */ 00021 00022 #ifndef DBA_MSG_MSGS_H 00023 #define DBA_MSG_MSGS_H 00024 00030 #include <dballe/msg/msg.h> 00031 #include <vector> 00032 #include <memory> 00033 00034 namespace dballe { 00035 struct CSVReader; 00036 00038 struct Msgs : public std::vector<Msg*> 00039 { 00040 Msgs(); 00041 ~Msgs(); 00042 00049 void acquire(const Msg& msg); 00050 00058 void acquire(std::auto_ptr<Msg> msg); 00059 00067 bool from_csv(CSVReader& in); 00068 00072 void to_csv(std::ostream& out) const; 00073 00080 void print(FILE* out) const; 00081 00093 unsigned diff(const Msgs& msgs) const; 00094 }; 00095 00099 struct MatchedMsgs : public Matched 00100 { 00101 const Msgs& m; 00102 00103 MatchedMsgs(const Msgs& m); 00104 ~MatchedMsgs(); 00105 00106 virtual matcher::Result match_var_id(int val) const; 00107 virtual matcher::Result match_station_id(int val) const; 00108 virtual matcher::Result match_station_wmo(int block, int station=-1) const; 00109 virtual matcher::Result match_date(const int* min, const int* max) const; 00110 virtual matcher::Result match_coords(int latmin, int latmax, int lonmin, int lonmax) const; 00111 virtual matcher::Result match_rep_memo(const char* memo) const; 00112 }; 00113 00114 } 00115 00116 /* vim:set ts=4 sw=4: */ 00117 #endif