libdballe
7.6
|
Standard dballe::Query implementation. More...
#include <query.h>
Public Member Functions | |
std::unique_ptr< dballe::Query > | clone () const override |
Return a copy of this query. | |
unsigned | get_modifiers () const |
DatetimeRange | get_datetimerange () const override |
Get the Datetime bounds set in this query. | |
void | set_datetimerange (const DatetimeRange &dt) override |
Set the Datetime range for this query. | |
LatRange | get_latrange () const override |
Get the range of latitudes to be matched. | |
void | set_latrange (const LatRange &lr) override |
Set the range of latitudes to be matched. | |
LonRange | get_lonrange () const override |
Get the range of longitudes to be matched. | |
void | set_lonrange (const LonRange &lr) override |
Set the range of longitudes to be matched. | |
Level | get_level () const override |
Get the level to be matched. | |
void | set_level (const Level &level) override |
Set the level to be matched. | |
Trange | get_trange () const override |
Get the time range to be matched. | |
void | set_trange (const Trange &trange) override |
Set the level to be matched. | |
void | clear () override |
Clear the contents of the query, making it match all data. | |
void | set_from_record (const dballe::Record &rec) override |
Set the query values from the contents of a Record. | |
void | set_from_test_string (const std::string &s) |
Set a record from a ", "-separated string of assignments. More... | |
bool | is_subquery (const dballe::Query &other) const override |
Return true if this query matches a subset of the given query. More... | |
void | foreach_key (std::function< void(const char *, wreport::Var &&)> dest) const override |
Generate a sequence of dba_keyword and Var for all contents of the query that can be represented in a record. | |
void | print (FILE *out) const override |
Print the query contents to stderr. | |
void | serialize (JSONWriter &out) const |
Send the contents to a JSONWriter. | |
Static Public Member Functions | |
static unsigned | parse_modifiers (const dballe::Record &rec) |
Parse the query=* modifiers specification inside the record, returning the ORed flags. | |
static unsigned | parse_modifiers (const char *str) |
Parse the modifiers specification given a query=* string, returning the ORed flags. | |
static const Query & | downcast (const dballe::Query &query) |
Return a reference to query downcasted as core::Query. More... | |
static Query & | downcast (dballe::Query &query) |
Return a reference to query downcasted as core::Query. More... | |
![]() | |
static std::unique_ptr< Query > | create () |
Create a new Query. | |
static std::unique_ptr< Query > | from_record (const Record &rec) |
Create a new Query. | |
Data Fields | |
uint32_t | want_missing = 0 |
Set a bit a 1 with WANT_MISSING_* constants to specify that the query wants results in which the corresponding field is set to a missing value. | |
int | ana_id = MISSING_INT |
int | prio_min = MISSING_INT |
int | prio_max = MISSING_INT |
std::string | rep_memo |
int | mobile = MISSING_INT |
Ident | ident |
LatRange | latrange |
LonRange | lonrange |
DatetimeRange | datetime |
Level | level |
Trange | trange |
std::set< wreport::Varcode > | varcodes |
std::string | query |
std::string | ana_filter |
std::string | data_filter |
std::string | attr_filter |
int | limit = MISSING_INT |
int | block = MISSING_INT |
int | station = MISSING_INT |
Standard dballe::Query implementation.
|
static |
Return a reference to query downcasted as core::Query.
Throws an exception if query is not a core::Query.
|
static |
Return a reference to query downcasted as core::Query.
Throws an exception if query is not a core::Query.
|
overridevirtual |
Return true if this query matches a subset of the given query.
In other words, it returns true if this query is the same as other, plus zero or more extra fields set, or zero or more ranges narrowed.
Implements dballe::Query.
void dballe::core::Query::set_from_test_string | ( | const std::string & | s | ) |
Set a record from a ", "-separated string of assignments.
The implementation is not efficient and the method is not safe for any input, since ", " could appear in a station identifier. It is however useful to quickly create test queries for unit testing.