libdballe  6.8
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/core/file.h>
24 #include <dballe/core/record.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 namespace dbadb {
35 
50 const char* parse_op_report(DB& db, const char* name=NULL);
51 
52 }
53 
54 class Dbadb
55 {
56 protected:
57  DB& db;
58 
59 public:
60  Dbadb(DB& db) : db(db) {}
61 
63  int do_dump(const Record& query, FILE* out);
64 
66  int do_stations(const Record& query, FILE* out);
67 
69  int do_export_dump(const Record& query, FILE* out);
70 
72  int do_import(const std::list<std::string>& fnames, Reader& reader, int import_flags=0, const char* forced_repmemo=NULL);
73 
75  int do_import(const std::string& fname, Reader& reader, int import_flags=0, const char* forced_repmemo=NULL);
76 
78  int do_export(const Record& query, File& file, const char* output_template=NULL, const char* forced_repmemo=NULL);
79 };
80 
81 
82 }
83 }
84 
85 #endif
int do_export_dump(const Record &query, FILE *out)
Export messages and dump their contents to the given file descriptor.
int do_export(const Record &query, File &file, const char *output_template=NULL, const char *forced_repmemo=NULL)
Export messages writing them to the givne file.
Definition: processor.h:153
Definition: dbadb.h:54
File I/O for files containing meterorological messages.
DB-All.E record.
Definition: record.h:102
Definition: cmdline.h:34
int do_import(const std::list< std::string > &fnames, Reader &reader, int import_flags=0, const char *forced_repmemo=NULL)
Import the given files.
Definition: file.h:46
int do_stations(const Record &query, FILE *out)
Query stations in the database and output results as arbitrary human readable text.
Definition: db.h:181
Implement a storage object for a group of related observation data.
int do_dump(const Record &query, FILE *out)
Query data in the database and output results as arbitrary human readable text.