libdballe  6.8
arrayfile.h
Go to the documentation of this file.
1 /*
2  * dballe/core/arrayfile - File I/O from in-memory vector<Rawmsg>
3  *
4  * Copyright (C) 2012 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_CORE_ARRAYFILE_H
23 #define DBALLE_CORE_ARRAYFILE_H
24 
30 #include <dballe/core/file.h>
31 #include <dballe/core/rawmsg.h>
32 #include <vector>
33 
34 namespace dballe {
35 
36 class ArrayFile : public File
37 {
38 protected:
39  Encoding file_type;
40 
41 public:
42  std::vector<Rawmsg> msgs;
43  unsigned current;
44 
45  ArrayFile(Encoding type);
46  virtual ~ArrayFile();
47 
48  virtual Encoding type() const throw ();
49  virtual bool read(Rawmsg& msg);
50  virtual void write(const Rawmsg& msg);
51 };
52 
53 } // namespace dballe
54 
55 /* vim:set ts=4 sw=4: */
56 #endif
File I/O for files containing meterorological messages.
Definition: cmdline.h:34
virtual void write(const Rawmsg &msg)
Write the encoded message data to the file.
Definition: file.h:46
Definition: arrayfile.h:36
In-memory storage of an encoded weather report.
Annotated string buffer for encoded messages.
Definition: rawmsg.h:38
virtual Encoding type() const
Get the name of the dba_file.
virtual bool read(Rawmsg &msg)
Read a message from the file.