libdballe  6.8
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
dballe::fortran::CommonAPIImplementation Class Reference

Common implementation of the set* and enq* machinery using input and output records. More...

#include <commonapi.h>

Inheritance diagram for dballe::fortran::CommonAPIImplementation:
dballe::fortran::API dballe::fortran::DbAPI dballe::fortran::MsgAPI

Public Types

enum  AttrState { ATTR_DAMMELO = 1, ATTR_PRENDILO = 2, ATTR_REFERENCE = 3 }
 

Public Member Functions

virtual void test_input_to_output ()
 
virtual int enqi (const char *param)
 Read one integer value from the output record. More...
 
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
 
- Public Member Functions inherited from dballe::fortran::API
virtual void scopa (const char *repinfofile=0)=0
 Reset the database contents, loading default report informations from a file. More...
 
virtual void remove_all ()=0
 Remove all data from the database. More...
 
virtual int quantesono ()=0
 Count the number of elements in the anagraphical storage, and start a new anagraphical query. More...
 
virtual void elencamele ()=0
 Iterate through the anagraphical data. More...
 
virtual int voglioquesto ()=0
 Submit a query to the database. More...
 
virtual const char * dammelo ()=0
 Iterate through the query results data. More...
 
virtual void prendilo ()=0
 Insert a new item in the database. More...
 
virtual void dimenticami ()=0
 Remove all selected items from the database. More...
 
virtual void messages_open_input (const char *filename, const char *mode, Encoding format, bool simplified=true)=0
 Open a BUFR/CREX/AOF file for reading. More...
 
virtual void messages_open_output (const char *filename, const char *mode, Encoding format)=0
 Open a BUFR/CREX/AOF file for writing. More...
 
virtual bool messages_read_next ()=0
 Read the next message and import it in the database. More...
 
virtual void messages_write_next (const char *template_name=0)=0
 Export the currently selected data to the output message.
 
virtual int voglioancora ()=0
 Retrieve QC informations from the last variable returned by dammelo(). More...
 
virtual void critica ()=0
 Insert new QC informations for a variable of the current record. More...
 
virtual void scusa ()=0
 Remove QC informations for a variable of the current record. More...
 

Protected Types

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

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.
 

Protected Attributes

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

- 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
 

Detailed Description

Common implementation of the set* and enq* machinery using input and output records.

Member Enumeration Documentation

Enumerator
ATTR_DAMMELO 

After a dammelo.

ATTR_PRENDILO 

After a prendilo.

ATTR_REFERENCE 

After a set *context_id or *var_related.

Member Function Documentation

virtual const char* dballe::fortran::CommonAPIImplementation::ancora ( )
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.

Record& dballe::fortran::CommonAPIImplementation::choose_input_record ( const char *&  param)
protected

Choose the input record to use for param.

Also, adjust param to remove a leading '*' if present.

Record& dballe::fortran::CommonAPIImplementation::choose_output_record ( const char *&  param)
protected

Choose the output record to use for param.

Also, adjust param to remove a leading '*' if present.

virtual signed char dballe::fortran::CommonAPIImplementation::enqb ( const char *  param)
virtual

Read one byte 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

Implements dballe::fortran::API.

virtual const char* dballe::fortran::CommonAPIImplementation::enqc ( const char *  param)
virtual

Read one character 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

Implements dballe::fortran::API.

virtual double dballe::fortran::CommonAPIImplementation::enqd ( const char *  param)
virtual

Read one real*8 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

Implements dballe::fortran::API.

virtual void dballe::fortran::CommonAPIImplementation::enqdate ( int &  year,
int &  month,
int &  day,
int &  hour,
int &  min,
int &  sec 
)
virtual

Shortcut function to read date information.

Parameters
handleHandle to a DBALLE session
Return values
yearYear from the output record
monthMonth the output record
dayDay the output record
hourHour the output record
minMinute the output record
secSecond the output record
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual int dballe::fortran::CommonAPIImplementation::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

Implements dballe::fortran::API.

Reimplemented in dballe::fortran::DbAPI.

virtual void dballe::fortran::CommonAPIImplementation::enqlevel ( int &  ltype1,
int &  l1,
int &  ltype2,
int &  l2 
)
virtual

Shortcut function to read level data.

Parameters
handleHandle to a DBALLE session
Return values
ltypeLevel type from the output record
l1L1 from the output record
l2L2 from the output record
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual float dballe::fortran::CommonAPIImplementation::enqr ( const char *  param)
virtual

Read one real 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

Implements dballe::fortran::API.

virtual void dballe::fortran::CommonAPIImplementation::enqtimerange ( int &  ptype,
int &  p1,
int &  p2 
)
virtual

Shortcut function to read time range data.

Parameters
handleHandle to a DBALLE session
Return values
ptypeP indicator from the output record
p1P1 from the output record
p2P2 from the output record
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual void dballe::fortran::CommonAPIImplementation::setb ( const char *  param,
signed char  value 
)
virtual

Set one byte value into the input record.

Parameters
handleHandle to a DBALLE session
parameterParameter to set. 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
valueThe value to assign to the parameter
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual void dballe::fortran::CommonAPIImplementation::setc ( const char *  param,
const char *  value 
)
virtual

Set one character value into the input record.

Parameters
handleHandle to a DBALLE session
parameterParameter to set. 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
valueThe value to assign to the parameter
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual void dballe::fortran::CommonAPIImplementation::setcontextana ( )
virtual

Shortcut function to set query parameters to the anagraphical context.

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

Implements dballe::fortran::API.

virtual void dballe::fortran::CommonAPIImplementation::setd ( const char *  param,
double  value 
)
virtual

Set one real*8 value into the input record.

Parameters
handleHandle to a DBALLE session
parameterParameter to set. 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
valueThe value to assign to the parameter
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual void dballe::fortran::CommonAPIImplementation::setdate ( int  year,
int  month,
int  day,
int  hour,
int  min,
int  sec 
)
virtual

Shortcut function to set date information.

Parameters
handleHandle to a DBALLE session
yearYear to set in the input record
monthMonth to set in the input
dayDay to set in the input
hourHour to set in the input
minMinute to set in the input
secSecond to set in the input
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual void dballe::fortran::CommonAPIImplementation::setdatemax ( int  year,
int  month,
int  day,
int  hour,
int  min,
int  sec 
)
virtual

Shortcut function to set maximum date for a query.

Parameters
handleHandle to a DBALLE session
yearMaximum year to set in the query
monthMaximum month to set in the query
dayMaximum day to set in the query
hourMaximum hour to set in the query
minMaximum minute to set in the query
secMaximum second to set in the query
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual void dballe::fortran::CommonAPIImplementation::setdatemin ( int  year,
int  month,
int  day,
int  hour,
int  min,
int  sec 
)
virtual

Shortcut function to set minimum date for a query.

Parameters
handleHandle to a DBALLE session
yearMinimum year to set in the query
monthMinimum month to set in the query
dayMinimum day to set in the query
hourMinimum hour to set in the query
minMinimum minute to set in the query
secMinimum second to set in the query
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual void dballe::fortran::CommonAPIImplementation::seti ( const char *  param,
int  value 
)
virtual

Set one integer value into the input record.

Parameters
handleHandle to a DBALLE session
parameterParameter to set. 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
valueThe value to assign to the parameter
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual void dballe::fortran::CommonAPIImplementation::setlevel ( int  ltype1,
int  l1,
int  ltype2,
int  l2 
)
virtual

Shortcut function to set level data.

Parameters
handleHandle to a DBALLE session
ltypeLevel type to set in the input record
l1L1 to set in the input record
l2L2 to set in the input record
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual void dballe::fortran::CommonAPIImplementation::setr ( const char *  param,
float  value 
)
virtual

Set one real value into the input record.

Parameters
handleHandle to a DBALLE session
parameterParameter to set. 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
valueThe value to assign to the parameter
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual void dballe::fortran::CommonAPIImplementation::settimerange ( int  ptype,
int  p1,
int  p2 
)
virtual

Shortcut function to set time range data.

Parameters
handleHandle to a DBALLE session
ptypeP indicator to set in the input record
p1P1 to set in the input record
p2P2 to set in the input record
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual void dballe::fortran::CommonAPIImplementation::unset ( const char *  param)
virtual

Remove one parameter from the input record.

Parameters
handleHandle to a DBALLE session
parameterParameter to remove. 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
Returns
The error indicator for the function

Implements dballe::fortran::API.

virtual void dballe::fortran::CommonAPIImplementation::unsetall ( )
virtual

Remove all parameters from the input record.

Parameters
handleHandle to a DBALLE session

Implements dballe::fortran::API.

virtual void dballe::fortran::CommonAPIImplementation::unsetb ( )
virtual

Remove all B* parameters from the input record.

Parameters
handleHandle to a DBALLE session

Implements dballe::fortran::API.


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