libdballe  5.18
dbadb.h
00001 /*
00002  * Copyright (C) 2005--2011  ARPA-SIM <urpsim@smr.arpa.emr.it>
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  * GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00016  *
00017  * Author: Enrico Zini <enrico@enricozini.com>
00018  */
00019 
00020 #ifndef DBALLE_CMDLINE_DBADB_H
00021 #define DBALLE_CMDLINE_DBADB_H
00022 
00023 #include <dballe/core/file.h>
00024 #include <dballe/core/record.h>
00025 #include <dballe/cmdline/processor.h>
00026 #include <list>
00027 #include <cstdio>
00028 
00029 namespace dballe {
00030 struct DB;
00031 
00032 namespace cmdline {
00033 
00034 namespace dbadb {
00035 
00050 const char* parse_op_report(DB& db, const char* name=NULL);
00051 
00052 }
00053 
00054 class Dbadb
00055 {
00056 protected:
00057     DB& db;
00058 
00059 public:
00060     Dbadb(DB& db) : db(db) {}
00061 
00063     int do_dump(const Record& query, FILE* out);
00064 
00066     int do_stations(const Record& query, FILE* out);
00067 
00069     int do_export_dump(const Record& query, FILE* out);
00070 
00072     int do_import(const std::list<std::string>& fnames, Reader& reader, int import_flags=0, const char* forced_repmemo=NULL);
00073 
00075     int do_import(const std::string& fname, Reader& reader, int import_flags=0, const char* forced_repmemo=NULL);
00076 
00078     int do_export(const Record& query, File& file, const char* output_template=NULL, const char* forced_repmemo=NULL);
00079 };
00080 
00081 
00082 }
00083 }
00084 
00085 #endif