1#ifndef DBALLE_CORE_ENQ_H
2#define DBALLE_CORE_ENQ_H
23 Enq(
const char* key,
unsigned len) : key(key), len(len) {}
26 [[noreturn]]
void throw_notfound()
33 virtual const char* name()
const = 0;
36 virtual void set_bool(
bool val) = 0;
39 virtual void set_int(
int val) = 0;
42 virtual void set_dballe_int(
int val) = 0;
45 virtual void set_string(
const std::string& val)
51 virtual void set_ident(
const Ident& ident)
57 virtual void set_varcode(wreport::Varcode val)
83 virtual void set_lat(
int lat)
89 virtual void set_lon(
int lon)
95 virtual void set_coords(
const Coords& c)
101 virtual void set_station(
const Station& s)
107 virtual void set_dbstation(
const DBStation& s)
113 virtual void set_datetime(
const Datetime& dt)
119 virtual void set_level(
const Level& dt)
125 virtual void set_trange(
const Trange& dt)
130 template <
typename Values>
bool search_b_values(
const Values& values)
132 if (key[0] !=
'B' || len != 6)
136 const wreport::Var* var = values.maybe_var(code);
137 if (var && var->
isset())
142 bool search_b_value(
const dballe::Value& value)
144 if (key[0] !=
'B' || len != 6)
148 if (code != value.
code())
151 const wreport::Var* var = value.get();
152 if (var && var->
isset())
157 template <
typename Values>
void search_alias_values(
const Values& values)
160 const wreport::Var* var = values.maybe_var(code);
161 if (var && var->
isset())
165 void search_alias_value(
const dballe::Value& value)
168 if (code != value.
code())
170 const wreport::Var* var = value.get();
171 if (var && var->
isset())
181 const char* name()
const override {
return "enqi"; }
183 void set_bool(
bool val)
override
189 void set_int(
int val)
override
195 void set_dballe_int(
int val)
override
197 if (val == MISSING_INT)
203 void set_lat(
int lat)
override
205 if (lat == MISSING_INT)
211 void set_lon(
int lon)
override
213 if (lon == MISSING_INT)
231 const char* name()
const override {
return "enqd"; }
233 void set_bool(
bool val)
override
239 void set_int(
int val)
override
245 void set_dballe_int(
int val)
override
247 if (val == MISSING_INT)
253 void set_lat(
int lat)
override
255 if (lat == MISSING_INT)
261 void set_lon(
int lon)
override
263 if (lon == MISSING_INT)
A station identifier, that can be any string (including the empty string) or a missing value.
Definition types.h:751
wreport::Varcode code() const
Return the varcode of the variable, or 0 if no variable has been set.
static void throwf(const char *fmt,...) WREPORT_THROWF_ATTRS(1
static void throwf(const char *fmt,...) WREPORT_THROWF_ATTRS(1
Shortcut functions to work with wreport::Var in DB-All.e.
static double lon_from_int(int lon)
Convert a longitude from the internal integer representation.
static double lat_from_int(int lat)
Convert a latitude from the internal integer representation.
virtual void set_var_value(const wreport::Var &var)=0
Set the value using the value of the given variable.
Definition core/enq.h:227
void set_var_value(const wreport::Var &var) override
Set the value using the value of the given variable.
Definition core/enq.h:269
Definition core/enq.h:177
void set_var_value(const wreport::Var &var) override
Set the value using the value of the given variable.
Definition core/enq.h:219
Common base types used by most of DB-All.e code.
Structures used as input to database insert functions.
wreport::Varcode resolve_varcode(const char *name)
Resolve a variable name to a varcode proper, dealing with aliases and validation.
#define WR_STRING_TO_VAR(str)