libdballe  7.7
dbadb.h
1 /*
2  * Copyright (C) 2005--2011 ARPA-SIM <urpsim@smr.arpa.emr.it>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16  *
17  * Author: Enrico Zini <enrico@enricozini.com>
18  */
19 
20 #ifndef DBALLE_CMDLINE_DBADB_H
21 #define DBALLE_CMDLINE_DBADB_H
22 
23 #include <dballe/file.h>
24 #include <dballe/core/query.h>
25 #include <dballe/cmdline/processor.h>
26 #include <list>
27 #include <cstdio>
28 
29 namespace dballe {
30 struct DB;
31 
32 namespace cmdline {
33 
34 class Dbadb
35 {
36 protected:
37  DB& db;
38 
39 public:
40  Dbadb(DB& db) : db(db) {}
41 
43  int do_dump(const Query& query, FILE* out);
44 
46  int do_stations(const Query& query, FILE* out);
47 
49  int do_export_dump(const Query& query, FILE* out);
50 
52  int do_import(const std::list<std::string>& fnames, Reader& reader, int import_flags=0, const char* forced_repmemo=NULL);
53 
55  int do_import(const std::string& fname, Reader& reader, int import_flags=0, const char* forced_repmemo=NULL);
56 
58  int do_export(const Query& query, File& file, const char* output_template=NULL, const char* forced_repmemo=NULL);
59 };
60 
61 
62 }
63 }
64 
65 #endif
int do_dump(const Query &query, FILE *out)
Query data in the database and output results as arbitrary human readable text.
Definition: processor.h:133
Definition: dbadb.h:34
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
int do_stations(const Query &query, FILE *out)
Query stations in the database and output results as arbitrary human readable text.
int do_import(const std::list< std::string > &fnames, Reader &reader, int import_flags=0, const char *forced_repmemo=NULL)
Import the given files.
int do_export(const Query &query, File &file, const char *output_template=NULL, const char *forced_repmemo=NULL)
Export messages writing them to the givne file.
Definition: db.h:182
Query used to filter DB-All.e data.
Definition: query.h:14
int do_export_dump(const Query &query, FILE *out)
Export messages and dump their contents to the given file descriptor.
File object for doing I/O on binary message streams.
Definition: file.h:17