libdballe  6.8
dbapi.h
1 #ifndef FDBA_DBAPI_H
2 #define FDBA_DBAPI_H
3 
4 /*
5  * Copyright (C) 2005--2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  *
20  * Author: Enrico Zini <enrico@enricozini.com>
21  */
22 
23 #include "commonapi.h"
24 
25 namespace dballe {
26 struct DB;
27 
28 namespace db {
29 struct Cursor;
30 }
31 
32 namespace fortran {
33 
34 struct InputFile;
35 struct OutputFile;
36 
38 {
39 protected:
40  DB& db;
41  db::Cursor* ana_cur;
42  db::Cursor* query_cur;
43  InputFile* input_file;
44  OutputFile* output_file;
45 
46 public:
47  DbAPI(DB& db, const char* anaflag, const char* dataflag, const char* attrflag);
48  virtual ~DbAPI();
49 
50  virtual int enqi(const char* param);
51 
52  virtual void scopa(const char* repinfofile = 0);
53  virtual void remove_all();
54 
55  virtual int quantesono();
56  virtual void elencamele();
57 
58  virtual int voglioquesto();
59  virtual const char* dammelo();
60 
61  virtual void prendilo();
62  virtual void dimenticami();
63 
64  virtual int voglioancora();
65 
66  virtual void critica();
67  virtual void scusa();
68 
69  virtual void messages_open_input(const char* filename, const char* mode, Encoding format, bool simplified=true);
70  virtual void messages_open_output(const char* filename, const char* mode, Encoding format);
71  virtual bool messages_read_next();
72  virtual void messages_write_next(const char* template_name=0);
73 };
74 
75 }
76 }
77 
78 /* vim:set ts=4 sw=4: */
79 #endif
virtual bool messages_read_next()
Read the next message and import it in the database.
virtual void scusa()
Remove QC informations for a variable of the current record.
Definition: db.h:77
virtual int voglioquesto()
Submit a query to the database.
Common implementation of the set* and enq* machinery using input and output records.
Definition: commonapi.h:35
Definition: dbapi.h:37
virtual int quantesono()
Count the number of elements in the anagraphical storage, and start a new anagraphical query...
virtual void prendilo()
Insert a new item in the database.
virtual void messages_open_input(const char *filename, const char *mode, Encoding format, bool simplified=true)
Open a BUFR/CREX/AOF file for reading.
virtual void messages_open_output(const char *filename, const char *mode, Encoding format)
Open a BUFR/CREX/AOF file for writing.
Definition: cmdline.h:34
virtual const char * dammelo()
Iterate through the query results data.
virtual void scopa(const char *repinfofile=0)
Reset the database contents, loading default report informations from a file.
virtual void remove_all()
Remove all data from the database.
virtual int voglioancora()
Retrieve QC informations from the last variable returned by dammelo().
Definition: db.h:181
virtual void elencamele()
Iterate through the anagraphical data.
virtual void critica()
Insert new QC informations for a variable of the current record.
virtual void messages_write_next(const char *template_name=0)
Export the currently selected data to the output message.
virtual int enqi(const char *param)
Read one integer value from the output record.
virtual void dimenticami()
Remove all selected items from the database.