libdballe  5.18
arrayfile.h
Go to the documentation of this file.
00001 /*
00002  * dballe/core/arrayfile - File I/O from in-memory vector<Rawmsg>
00003  *
00004  * Copyright (C) 2012  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 DBALLE_CORE_ARRAYFILE_H
00023 #define DBALLE_CORE_ARRAYFILE_H
00024 
00030 #include <dballe/core/file.h>
00031 #include <dballe/core/rawmsg.h>
00032 #include <vector>
00033 
00034 namespace dballe {
00035 
00036 class ArrayFile : public File
00037 {
00038 protected:
00039     Encoding file_type;
00040 
00041 public:
00042     std::vector<Rawmsg> msgs;
00043     unsigned current;
00044 
00045     ArrayFile(Encoding type);
00046     virtual ~ArrayFile();
00047 
00048     virtual Encoding type() const throw ();
00049     virtual bool read(Rawmsg& msg);
00050     virtual void write(const Rawmsg& msg);
00051 };
00052 
00053 } // namespace dballe
00054 
00055 /* vim:set ts=4 sw=4: */
00056 #endif