libdballe  7.19
commonapi.h
1 #ifndef FDBA_COMMONAPI_H
2 #define FDBA_COMMONAPI_H
3 
4 #include "simple.h"
5 #include <dballe/core/record.h>
6 
7 namespace dballe {
8 namespace fortran {
9 
15 {
16 public:
17  enum AttrState {
24  };
25 
26 protected:
27  enum {
28  PERM_ANA_RO = (1 << 0),
29  PERM_ANA_WRITE = (1 << 1),
30  PERM_DATA_RO = (1 << 2),
31  PERM_DATA_ADD = (1 << 3),
32  PERM_DATA_WRITE = (1 << 4),
33  PERM_ATTR_RO = (1 << 5),
34  PERM_ATTR_WRITE = (1 << 6)
35  };
36 
37  int perms;
38  core::Record input;
39  bool station_context = false;
40  core::Record output;
41  core::Record qcinput;
42  core::Record qcoutput;
43  int qc_iter;
44  int qc_count;
45 
46  AttrState attr_state;
47 
48  // Varcode of the variable referred to by the next attribute operations
49  wreport::Varcode attr_varid;
50 
51  // Reference ID of the variable referred to by the next attribute operations
52  int attr_reference_id;
53 
54  // Last string returned by one of the spiega* functions, held here so
55  // that we can deallocate it when needed.
56  std::string cached_spiega;
57 
61  void set_permissions(const char* anaflag, const char* dataflag, const char* attrflag);
62 
67  Record& choose_input_record(const char*& param);
68 
73  Record& choose_output_record(const char*& param);
74 
76  void read_qc_list(std::vector<wreport::Varcode>& res_arr) const;
77 
78 public:
80  virtual ~CommonAPIImplementation();
81 
82  void test_input_to_output() override;
83  int enqi(const char* param) override;
84  signed char enqb(const char* param) override;
85  float enqr(const char* param) override;
86  double enqd(const char* param) override;
87  const char* enqc(const char* param) override;
88  void seti(const char* param, int value) override;
89  void setb(const char* param, signed char value) override;
90  void setr(const char* param, float value) override;
91  void setd(const char* param, double value) override;
92  void setc(const char* param, const char* value) override;
93  void setcontextana() override;
94  void enqlevel(int& ltype1, int& l1, int& ltype2, int& l2) override;
95  void setlevel(int ltype1, int l1, int ltype2, int l2) override;
96  void enqtimerange(int& ptype, int& p1, int& p2) override;
97  void settimerange(int ptype, int p1, int p2) override;
98  void enqdate(int& year, int& month, int& day, int& hour, int& min, int& sec) override;
99  void setdate(int year, int month, int day, int hour, int min, int sec) override;
100  void setdatemin(int year, int month, int day, int hour, int min, int sec) override;
101  void setdatemax(int year, int month, int day, int hour, int min, int sec) override;
102  void unset(const char* param) override;
103  void unsetall() override;
104  void unsetb() override;
105  const char* spiegal(int ltype1, int l1, int ltype2, int l2) override;
106  const char* spiegat(int ptype, int p1, int p2) override;
107  const char* spiegab(const char* varcode, const char* value) override;
108  const char* ancora() override;
109  void fatto() override;
110 
111  AttrState test_get_attr_state() const { return attr_state; }
112 };
113 
114 }
115 }
116 #endif
Record & choose_input_record(const char *&param)
Choose the input record to use for param.
Common implementation of the set* and enq* machinery using input and output records.
Definition: commonapi.h:14
Key/value store where keys are strings and values are wreport variables.
Definition: record.h:16
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
Record & choose_output_record(const char *&param)
Choose the output record to use for param.
C++ implementation for the Fortran API.
Definition: simple.h:15
DB-All.E record.
Definition: core/record.h:81
AttrState
Definition: commonapi.h:17
uint16_t Varcode
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.
After a set *context_id or *var_related.
Definition: commonapi.h:23
After a dammelo.
Definition: commonapi.h:19
After a prendilo.
Definition: commonapi.h:21
void set_permissions(const char *anaflag, const char *dataflag, const char *attrflag)
Set the permission bits, parsing the flags and doing consistency checks.
Implement a storage object for a group of related observation data.