1 #ifndef DBALLE_CORE_RECORD_H 2 #define DBALLE_CORE_RECORD_H 9 #include <dballe/record.h> 12 #include <dballe/core/matcher.h> 44 DBA_KEY_MONTHMAX = 21,
45 DBA_KEY_MONTHMIN = 22,
54 DBA_KEY_LEVELTYPE1 = 31,
56 DBA_KEY_LEVELTYPE2 = 33,
58 DBA_KEY_PINDICATOR = 35,
63 DBA_KEY_CONTEXT_ID = 40,
65 DBA_KEY_ANA_FILTER = 42,
66 DBA_KEY_DATA_FILTER = 43,
67 DBA_KEY_ATTR_FILTER = 44,
69 DBA_KEY_VAR_RELATED = 46,
73 std::ostream& operator<<(std::ostream& o,
dba_keyword k);
88 std::vector<wreport::Var*> m_vars;
150 std::unique_ptr<dballe::Record>
clone()
const override;
154 void clear()
override;
156 void seti(
const char* key,
int val)
override;
157 void setd(
const char* key,
double val)
override;
158 void setc(
const char* key,
const char* val)
override;
159 void sets(
const char* key,
const std::string& val)
override;
160 void setf(
const char* key,
const char* val)
override;
170 void unset(
const char* name)
override;
171 const wreport::Var*
get(
const char* key)
const override;
175 void foreach_key_ref(std::function<
void(
const char*,
const wreport::Var&)> dest)
const override;
176 void foreach_key_copy(std::function<
void(
const char*, std::unique_ptr<wreport::Var>&&)> dest)
const override;
177 void print(FILE* out)
const override;
226 const std::vector<wreport::Var*>&
vars()
const;
303 matcher::Result match_var_id(
int val)
const override;
304 matcher::Result match_station_id(
int val)
const override;
305 matcher::Result match_station_wmo(
int block,
int station=-1)
const override;
306 matcher::Result match_datetime(
const DatetimeRange& range)
const override;
307 matcher::Result match_coords(
const LatRange& latrange,
const LonRange& lonrange)
const override;
308 matcher::Result match_rep_memo(
const char* memo)
const override;
std::string to_string() const
Encode in a one-liner of comma-separated assignments.
std::unique_ptr< dballe::Record > clone() const override
Return a copy of this record.
static const Record & downcast(const dballe::Record &query)
Return a reference to record downcasted as core::Record.
void set_datetime(const Datetime &dt) override
Set year, month, day, hour, min, sec.
void set_level(const Level &lev) override
Set leveltype1, l1, leveltype2, l2.
Definition: core/record.h:296
void setc(const char *key, const char *val) override
Set a key to a string value.
Common interface for things that are matched.
Definition: matcher.h:31
void set_from_test_string(const std::string &s)
Set a record from a ", "-separated string of assignments.
bool contains(const dballe::Record &subset) const override
Return true if all elements of subset are present in this record, with the same value.
void set_from_string(const char *str)
Set a value in the record according to an assignment encoded in a string.
int find_item(wreport::Varcode code) const
Find an item by wreport::Varcode, returning -1 if not found.
Create wreport variables from the DB-All.e B table.
Coordinates.
Definition: types.h:337
Information on how a value has been sampled or computed with regards to time.
Definition: types.h:587
static wreport::Varinfo keyword_info(dba_keyword keyword)
Return informations about a keyword.
static dba_keyword keyword_byname(const char *tag)
Get the dba_keyword corresponding to the given name.
Key/value store where keys are strings and values are wreport variables.
Definition: record.h:16
void set_to_difference(const Record &source1, const Record &source2)
Set the record to contain only those fields that change source1 into source2.
void print(FILE *out) const override
Print the contents of this record to the given stream.
void set_lonrange(const LonRange &lr) override
Set lonmin, lonmax.
Level get_level() const
Compose a Level out of the leveltype1...l2 values.
bool iter_keys(std::function< bool(dba_keyword, const wreport::Var &)> f) const
Iterate all keys in the record, calling f on them.
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
void unset(const char *name) override
Remove/unset a key from the record.
void sets(const char *key, const std::string &val) override
Set a key to a string value.
void set_coords(const Coords &c) override
Set lat, lon.
const wreport::Var * key_peek(dba_keyword parameter) const
Look at the value of a parameter.
DB-All.E record.
Definition: core/record.h:81
void remove_item(wreport::Varcode code)
Remove an item by wreport::Varcode.
void setd(const char *key, double val) override
Set a key to a double value.
Vertical level or layer.
Definition: types.h:532
wreport::Var & get_item(wreport::Varcode code)
Find an item by wreport::Varcode, raising an exception if not found.
dba_keyword
Keyword used to quickly access context and query information from a record.
Definition: core/record.h:21
void add(const dballe::Record &source) override
Copy all data from the record source into dest.
void set_latrange(const LatRange &lr) override
Set latmin, latmax.
Range of datetimes.
Definition: types.h:272
Trange get_trange() const
Compose a Trange out of the pindicator...p2 values.
void set_var(const wreport::Var &var) override
Set var.code() == var.value()
void seti(const char *key, int val) override
Set a key to an integer value.
Range of latitudes.
Definition: types.h:407
bool equals(const dballe::Record &rec) const override
Check if two records are the same.
const wreport::Var * var_peek(wreport::Varcode code) const
Look at the value of a variable.
void clear() override
Remove all contents from the record.
wreport::Var & obtain(const char *key)
Return the Var for a key, creating it if it is missing.
Date and time.
Definition: types.h:158
DatetimeRange get_datetimerange() const
Compose a DatetimeRange out of the yearmin...secmax values.
void set_datetimerange(const DatetimeRange &range) override
Set datetime-min and datetime-max values.
void setf(const char *key, const char *val) override
Set a key to a string value.
const std::vector< wreport::Var * > & vars() const
Return the varcode-sorted vector with the variables.
void var_unset(wreport::Varcode code)
Remove a parameter from the record.
void set_var_acquire(std::unique_ptr< wreport::Var > &&var) override
Set var.code() == var.
Range of longitudes.
Definition: types.h:481
static dba_keyword keyword_byname_len(const char *tag, int len)
Get the dba_keyword corresponding to the given name.
static const char * keyword_name(dba_keyword keyword)
Return the name of a dba_keyword.
void key_unset(dba_keyword parameter)
Remove a parameter from the record.
void set_trange(const Trange &tr) override
Set pindicator, p1, p2.
void clear_vars() override
Remove all Bxxyyy keys from the record, leaving the rest intact.
Datetime get_datetime() const
Compose a Datetime out of the year...sec values.