libdballe  6.8
Public Member Functions | Protected Attributes
dballe::fortran::DbAPI Class Reference
Inheritance diagram for dballe::fortran::DbAPI:
dballe::fortran::CommonAPIImplementation dballe::fortran::API

Public Member Functions

 DbAPI (DB &db, const char *anaflag, const char *dataflag, const char *attrflag)
 
virtual int enqi (const char *param)
 Read one integer value from the output record. More...
 
virtual void scopa (const char *repinfofile=0)
 Reset the database contents, loading default report informations from a file. More...
 
virtual void remove_all ()
 Remove all data from the database. More...
 
virtual int quantesono ()
 Count the number of elements in the anagraphical storage, and start a new anagraphical query. More...
 
virtual void elencamele ()
 Iterate through the anagraphical data. More...
 
virtual int voglioquesto ()
 Submit a query to the database. More...
 
virtual const char * dammelo ()
 Iterate through the query results data. More...
 
virtual void prendilo ()
 Insert a new item in the database. More...
 
virtual void dimenticami ()
 Remove all selected items from the database. More...
 
virtual int voglioancora ()
 Retrieve QC informations from the last variable returned by dammelo(). More...
 
virtual void critica ()
 Insert new QC informations for a variable of the current record. More...
 
virtual void scusa ()
 Remove QC informations for a variable of the current record. More...
 
virtual void messages_open_input (const char *filename, const char *mode, Encoding format, bool simplified=true)
 Open a BUFR/CREX/AOF file for reading. More...
 
virtual void messages_open_output (const char *filename, const char *mode, Encoding format)
 Open a BUFR/CREX/AOF file for writing. More...
 
virtual bool messages_read_next ()
 Read the next message and import it in the database. More...
 
virtual void messages_write_next (const char *template_name=0)
 Export the currently selected data to the output message.
 
- Public Member Functions inherited from dballe::fortran::CommonAPIImplementation
virtual void test_input_to_output ()
 
virtual signed char enqb (const char *param)
 Read one byte value from the output record. More...
 
virtual float enqr (const char *param)
 Read one real value from the output record. More...
 
virtual double enqd (const char *param)
 Read one real*8 value from the output record. More...
 
virtual const char * enqc (const char *param)
 Read one character value from the output record. More...
 
virtual void seti (const char *param, int value)
 Set one integer value into the input record. More...
 
virtual void setb (const char *param, signed char value)
 Set one byte value into the input record. More...
 
virtual void setr (const char *param, float value)
 Set one real value into the input record. More...
 
virtual void setd (const char *param, double value)
 Set one real*8 value into the input record. More...
 
virtual void setc (const char *param, const char *value)
 Set one character value into the input record. More...
 
virtual void setcontextana ()
 Shortcut function to set query parameters to the anagraphical context. More...
 
virtual void enqlevel (int &ltype1, int &l1, int &ltype2, int &l2)
 Shortcut function to read level data. More...
 
virtual void setlevel (int ltype1, int l1, int ltype2, int l2)
 Shortcut function to set level data. More...
 
virtual void enqtimerange (int &ptype, int &p1, int &p2)
 Shortcut function to read time range data. More...
 
virtual void settimerange (int ptype, int p1, int p2)
 Shortcut function to set time range data. More...
 
virtual void enqdate (int &year, int &month, int &day, int &hour, int &min, int &sec)
 Shortcut function to read date information. More...
 
virtual void setdate (int year, int month, int day, int hour, int min, int sec)
 Shortcut function to set date information. More...
 
virtual void setdatemin (int year, int month, int day, int hour, int min, int sec)
 Shortcut function to set minimum date for a query. More...
 
virtual void setdatemax (int year, int month, int day, int hour, int min, int sec)
 Shortcut function to set maximum date for a query. More...
 
virtual void unset (const char *param)
 Remove one parameter from the input record. More...
 
virtual void unsetall ()
 Remove all parameters from the input record. More...
 
virtual void unsetb ()
 Remove all B* parameters from the input record. More...
 
virtual const char * spiegal (int ltype1, int l1, int ltype2, int l2)
 
virtual const char * spiegat (int ptype, int p1, int p2)
 
virtual const char * spiegab (const char *varcode, const char *value)
 
virtual const char * ancora ()
 Retrieve QC informations from the last variable returned by dammelo(). More...
 
AttrState test_get_attr_state () const
 
enq*

Functions used to read the output values of the DBALLE action routines

set*

Functions used to read the input values for the DBALLE action routines

QC functions

Functions used to manipulate QC data.

All these functions require some context data about the variable, which is automatically available when the variable just came as the result of an dammelo() or has just been inserted with an prendilo().

Protected Attributes

DBdb
 
db::Cursorana_cur
 
db::Cursorquery_cur
 
InputFile * input_file
 
OutputFile * output_file
 
- Protected Attributes inherited from dballe::fortran::CommonAPIImplementation
int perms
 
Record input
 
Record output
 
Record qcinput
 
Record qcoutput
 
int qc_iter
 
int qc_count
 
AttrState attr_state
 
wreport::Varcode attr_varid
 
int attr_reference_id
 
std::string cached_spiega
 

Additional Inherited Members

- Public Types inherited from dballe::fortran::CommonAPIImplementation
enum  AttrState { ATTR_DAMMELO = 1, ATTR_PRENDILO = 2, ATTR_REFERENCE = 3 }
 
- Static Public Attributes inherited from dballe::fortran::API
static const signed char missing_byte
 
static const int missing_int
 
static const float missing_float
 
static const double missing_double
 
- Protected Types inherited from dballe::fortran::CommonAPIImplementation
enum  {
  PERM_ANA_RO = (1 << 0), PERM_ANA_WRITE = (1 << 1), PERM_DATA_RO = (1 << 2), PERM_DATA_ADD = (1 << 3),
  PERM_DATA_WRITE = (1 << 4), PERM_ATTR_RO = (1 << 5), PERM_ATTR_WRITE = (1 << 6)
}
 
- Protected Member Functions inherited from dballe::fortran::CommonAPIImplementation
void set_permissions (const char *anaflag, const char *dataflag, const char *attrflag)
 Set the permission bits, parsing the flags and doing consistency checks.
 
Recordchoose_input_record (const char *&param)
 Choose the input record to use for param. More...
 
Recordchoose_output_record (const char *&param)
 Choose the output record to use for param. More...
 
void read_qc_list (std::vector< wreport::Varcode > &res_arr) const
 Reads the list of QC values to operate on, for dba_voglioancora and dba_scusa.
 

Member Function Documentation

virtual void dballe::fortran::DbAPI::critica ( )
virtual

Insert new QC informations for a variable of the current record.

QC informations inserted are all those set by the functions seti(), setc(), setr(), setd(), using an asterisk in front of the variable name.

Contrarily to prendilo(), this function resets all the QC informations (but only the QC informations) previously set in input, so the values to be inserted need to be explicitly set every time.

This function will fail if the database is open in QC readonly mode, and it will refuse to overwrite existing values if the database is open in QC add mode.

The variable referred by the QC informations can be specified in three ways:

  • by variable code, using ::setc(handle, "*var", "Bxxyyy")
  • by variable id, using ::seti(handle, "*data_id", id)
  • unspecified, will use the last variable returned by ::dammelo
Parameters
handleHandle to a DBALLE session
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual const char* dballe::fortran::DbAPI::dammelo ( )
virtual

Iterate through the query results data.

Every invocation of this function will return a new result, or fill fail with code DBA_ERR_NOTFOUND when there are no more results available.

Parameters
handleHandle to a DBALLE session
Return values
parameterContains the ID of the parameter retrieved by this fetch
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual void dballe::fortran::DbAPI::dimenticami ( )
virtual

Remove all selected items from the database.

This function will fail unless the database is open in data rewrite mode.

Parameters
handleHandle to a DBALLE session
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual void dballe::fortran::DbAPI::elencamele ( )
virtual

Iterate through the anagraphical data.

Every invocation of this function will return a new anagraphical data, or fill fail with code DBA_ERR_NOTFOUND when there are no more anagraphical data available.

Parameters
handleHandle to a DBALLE session
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual int dballe::fortran::DbAPI::enqi ( const char *  param)
virtual

Read one integer value from the output record.

Parameters
handleHandle to a DBALLE session
parameterParameter to query. It can be the code of a WMO variable prefixed by "B" (such as "B01023"); the code of a QC value prefixed by "*B" (such as "*B01023") or a keyword among the ones defined in Keywords used by dba_record
valueWhere the value will be returned
Returns
The error indicator for the function

Reimplemented from dballe::fortran::CommonAPIImplementation.

virtual void dballe::fortran::DbAPI::messages_open_input ( const char *  filename,
const char *  mode,
Encoding  format,
bool  simplified = true 
)
virtual

Open a BUFR/CREX/AOF file for reading.

Each session can only have one input file: if one was previously open, it is closed before opening the new one.

Parameters
filenameThe file name
modeThe opening mode. See the mode parameter of libc's fopen() call for details.
encodingThe file encoding
simplifiedAn argument for configuring the Importers::Options used to create the importer for this file.

Implements dballe::fortran::API.

virtual void dballe::fortran::DbAPI::messages_open_output ( const char *  filename,
const char *  mode,
Encoding  format 
)
virtual

Open a BUFR/CREX/AOF file for writing.

Each session can only have one output file: if one was previously open, it is closed before opening the new one.

Parameters
filenameThe file name
modeThe opening mode. See the mode parameter of libc's fopen() call for details.
encodingThe file encoding

Implements dballe::fortran::API.

virtual bool dballe::fortran::DbAPI::messages_read_next ( )
virtual

Read the next message and import it in the database.

The access mode of the session controls how data is imported.

Returns
True if a message has been imported, false if we have reached the end of file.

Implements dballe::fortran::API.

virtual void dballe::fortran::DbAPI::prendilo ( )
virtual

Insert a new item in the database.

This function will fail if the database is open in data readonly mode, and it will refuse to overwrite existing values if the database is open in data add mode.

If the database is open in pseudoana reuse mode, the pseudoana values provided on input will be used to create a pseudoana record if it is missing, but will be ignored if it is already present. If it is open in pseudoana rewrite mode instead, the pseudoana values on input will be used to replace all the existing pseudoana values.

Parameters
handleHandle to a DBALLE session
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual int dballe::fortran::DbAPI::quantesono ( )
virtual

Count the number of elements in the anagraphical storage, and start a new anagraphical query.

Resulting anagraphical data can be retrieved with elencamele()

Parameters
handleHandle to a DBALLE session
countThe count of elements
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual void dballe::fortran::DbAPI::remove_all ( )
virtual

Remove all data from the database.

The difference with scopa() is that it preserves report information.

Implements dballe::fortran::API.

virtual void dballe::fortran::DbAPI::scopa ( const char *  repinfofile = 0)
virtual

Reset the database contents, loading default report informations from a file.

It only works in rewrite mode.

Parameters
handleHandle to a DBALLE session
repinfofileCSV file with the default report informations. See dba_reset() documentation for the format of the file. If it is NULL or "\0", the system default is used.
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual void dballe::fortran::DbAPI::scusa ( )
virtual

Remove QC informations for a variable of the current record.

The QC informations to be removed are set with:

setc(handle, "*varlist", "*B33021,*B33003");

The variable referred by the QC informations can be specified in three ways:

  • by variable code, using ::setc(handle, "*var", "Bxxyyy")
  • by variable id, using ::seti(handle, "*data_id", id)
  • unspecified, will use the last variable returned by ::dammelo
Parameters
handleHandle to a DBALLE session
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual int dballe::fortran::DbAPI::voglioancora ( )
virtual

Retrieve QC informations from the last variable returned by dammelo().

Parameters
handleHandle to a DBALLE session
Return values
parameterContains the ID of the parameter retrieved by this fetch
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual int dballe::fortran::DbAPI::voglioquesto ( )
virtual

Submit a query to the database.

The query results can be accessed with calls to dammelo.

Parameters
handleHandle to a DBALLE session
Return values
countNumber of values returned by the function
Returns
The error indicator for the function

Implements dballe::fortran::API.


The documentation for this class was generated from the following file: