libdballe 9.6
|
Standard dballe::Query implementation. More...
#include <query.h>
Public Member Functions | |
bool | operator== (const Query &o) const |
void | validate () |
Check the query fields for consistency, and fill in missing values: | |
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. | |
bool | empty () const override |
Check if the query is empty, that is, it queries everything. | |
void | set_from_string (const char *str) |
Set a value in the record according to an assignment encoded in a string. | |
void | set_from_test_string (const std::string &s) |
Set a record from a ", "-separated string of assignments. | |
bool | is_subquery (const dballe::Query &other) const override |
Return true if this query matches a subset of the given query. | |
void | print (FILE *out) const override |
Print the query contents to stderr. | |
void | serialize (JSONWriter &out) const |
Send the contents to a JSONWriter. | |
virtual DatetimeRange | get_datetimerange () const =0 |
Get the Datetime bounds set in this query. | |
virtual void | set_datetimerange (const DatetimeRange &dt)=0 |
Set the Datetime range for this query. | |
virtual LatRange | get_latrange () const =0 |
Get the range of latitudes to be matched. | |
virtual void | set_latrange (const LatRange &latrange)=0 |
Set the range of latitudes to be matched. | |
virtual LonRange | get_lonrange () const =0 |
Get the range of longitudes to be matched. | |
virtual void | set_lonrange (const LonRange &lonrange)=0 |
Set the range of longitudes to be matched. | |
virtual Level | get_level () const =0 |
Get the level to be matched. | |
virtual void | set_level (const Level &level)=0 |
Set the level to be matched. | |
virtual Trange | get_trange () const =0 |
Get the time range to be matched. | |
virtual void | set_trange (const Trange &trange)=0 |
Set the level to be matched. | |
virtual void | clear ()=0 |
Clear the contents of the query, making it match all data. | |
virtual bool | is_subquery (const Query &other) const =0 |
Return true if this query matches a subset of the given query. | |
virtual void | print (FILE *out) const =0 |
Print the query contents to stderr. | |
virtual std::unique_ptr< Query > | clone () const =0 |
Return a copy of this query. | |
virtual bool | empty () const =0 |
Check if the query is empty, that is, it queries everything. | |
Static Public Member Functions | |
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. | |
static Query & | downcast (dballe::Query &query) |
Return a reference to query downcasted as core::Query. | |
static Query | from_json (core::json::Stream &in) |
![]() | |
static std::unique_ptr< Query > | create () |
Create a new Query. | |
Public Attributes | |
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 | priomin = MISSING_INT |
int | priomax = MISSING_INT |
std::string | report |
int | mobile = MISSING_INT |
Ident | ident |
LatRange | latrange |
LonRange | lonrange |
DatetimeRange | dtrange |
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 |
Protected Member Functions | |
void | setf (const char *key, unsigned len, const char *val) |
void | unset (const char *key, unsigned len) |
Standard dballe::Query implementation.
|
overridevirtual |
Clear the contents of the query, making it match all data.
Implements dballe::Query.
|
overridevirtual |
Return a copy of this query.
Implements dballe::Query.
|
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 |
Check if the query is empty, that is, it queries everything.
Implements dballe::Query.
|
inlineoverridevirtual |
Get the Datetime bounds set in this query.
Implements dballe::Query.
|
inlineoverridevirtual |
Get the range of latitudes to be matched.
Implements dballe::Query.
|
inlineoverridevirtual |
Get the level to be matched.
Implements dballe::Query.
|
inlineoverridevirtual |
Get the range of longitudes to be matched.
Implements dballe::Query.
|
inlineoverridevirtual |
Get the time range to be matched.
Implements dballe::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.
|
overridevirtual |
Print the query contents to stderr.
Implements dballe::Query.
|
inlineoverridevirtual |
Set the Datetime range for this query.
Implements dballe::Query.
void dballe::core::Query::set_from_string | ( | const char * | str | ) |
Set a value in the record according to an assignment encoded in a string.
String can use keywords, aliases and varcodes. Examples: ana_id=3, name=Bologna, B12012=32.4
In case of numeric parameter, a hyphen ("-") means MISSING_INT (e.g., leveltype2=-
).
str | The string containing the assignment. |
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.
|
inlineoverridevirtual |
Set the range of latitudes to be matched.
Implements dballe::Query.
|
inlineoverridevirtual |
Set the level to be matched.
Implements dballe::Query.
|
inlineoverridevirtual |
Set the range of longitudes to be matched.
Implements dballe::Query.
|
inlineoverridevirtual |
Set the level to be matched.
Implements dballe::Query.
void dballe::core::Query::validate | ( | ) |
Check the query fields for consistency, and fill in missing values: