libdballe  7.7
Public Member Functions | Static Public Member Functions | Data Fields | Static Public Attributes
dballe::core::Query Struct Reference

Standard dballe::Query implementation. More...

#include <query.h>

Inheritance diagram for dballe::core::Query:
dballe::Query

Public Member Functions

std::unique_ptr< dballe::Queryclone () 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 Querydowncast (const dballe::Query &query)
 Return a reference to query downcasted as core::Query. More...
 
static Querydowncast (dballe::Query &query)
 Return a reference to query downcasted as core::Query. More...
 
- Static Public Member Functions inherited from dballe::Query
static std::unique_ptr< Querycreate ()
 Create a new Query.
 
static std::unique_ptr< Queryfrom_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
 

Static Public Attributes

static const uint32_t WANT_MISSING_IDENT = (1 << 0)
 
static const uint32_t WANT_MISSING_LTYPE1 = (1 << 1)
 
static const uint32_t WANT_MISSING_L1 = (1 << 2)
 
static const uint32_t WANT_MISSING_LTYPE2 = (1 << 3)
 
static const uint32_t WANT_MISSING_L2 = (1 << 4)
 
static const uint32_t WANT_MISSING_PIND = (1 << 5)
 
static const uint32_t WANT_MISSING_P1 = (1 << 6)
 
static const uint32_t WANT_MISSING_P2 = (1 << 7)
 

Detailed Description

Standard dballe::Query implementation.

Member Function Documentation

static const Query& dballe::core::Query::downcast ( const dballe::Query query)
static

Return a reference to query downcasted as core::Query.

Throws an exception if query is not a core::Query.

static Query& dballe::core::Query::downcast ( dballe::Query query)
static

Return a reference to query downcasted as core::Query.

Throws an exception if query is not a core::Query.

bool dballe::core::Query::is_subquery ( const dballe::Query other) const
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.


The documentation for this struct was generated from the following file: