1 #ifndef DBALLE_CORE_ENQ_H 2 #define DBALLE_CORE_ENQ_H 5 #include <dballe/fwd.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)
137 if (var && var->
isset())
144 if (key[0] !=
'B' || len != 6)
148 if (code != value.
code())
152 if (var && var->
isset())
157 template <
typename Values>
void search_alias_values(
const Values& values)
161 if (var && var->
isset())
168 if (code != value.
code())
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)
wreport::Varcode code() const
Return the varcode of the variable, or 0 if no variable has been set.
Common base types used by most of DB-All.e code.
Class passed to key-value accessors to set values in an invoker-defined way.
Definition: core/enq.h:17
void set_var_value(const wreport::Var &var) override
Set the value using the value of the given variable.
Definition: core/enq.h:269
Station information.
Definition: types.h:878
wreport::Varcode resolve_varcode(const std::string &name)
Resolve a variable name to a varcode proper, dealing with aliases and validation. ...
const wreport::Var * maybe_var(wreport::Varcode code) const
Lookup a variable, returning nullptr if not found.
Coordinates.
Definition: types.h:371
Information on how a value has been sampled or computed with regards to time.
Definition: types.h:688
Vertical level or layer.
Definition: types.h:624
A station identifier, that can be any string (including the empty string) or a missing value...
Definition: types.h:750
static double lon_from_int(int lon)
Convert a longitude from the internal integer representation.
static void throwf(const char *fmt,...) WREPORT_THROWF_ATTRS(1
virtual void set_var_value(const wreport::Var &var)=0
Set the value using the value of the given variable.
#define WR_STRING_TO_VAR(str)
Definition: core/enq.h:176
void set_var_value(const wreport::Var &var) override
Set the value using the value of the given variable.
Definition: core/enq.h:219
Date and time.
Definition: types.h:163
Container for a wreport::Var pointer.
Definition: value.h:18
static double lat_from_int(int lat)
Convert a latitude from the internal integer representation.
Structures used as input to database insert functions.
Shortcut functions to work with wreport::Var in DB-All.e.
Collection of Value objects, indexed by wreport::Varcode.
Definition: values.h:215
static void throwf(const char *fmt,...) WREPORT_THROWF_ATTRS(1
Definition: core/enq.h:226