libdballe 9.13
query.h
1#ifndef DBALLE_QUERY_H
2#define DBALLE_QUERY_H
3
4#include <dballe/fwd.h>
5#include <dballe/types.h>
6#include <functional>
7#include <memory>
8#include <string>
9#include <wreport/var.h>
10
11namespace dballe {
12
13static constexpr int REQUIRED_MISSING_INT = MISSING_INT - 1;
14
16class Query
17{
18public:
19 Query() {}
20 Query(const Query&) = default;
21 Query(Query&&) = default;
22 virtual ~Query() {}
23
24 Query& operator=(const Query& o) = default;
25 Query& operator=(Query&& o) = default;
26
28 virtual DatetimeRange get_datetimerange() const = 0;
29
31 virtual void set_datetimerange(const DatetimeRange& dt) = 0;
32
34 virtual LatRange get_latrange() const = 0;
35
37 virtual void set_latrange(const LatRange& latrange) = 0;
38
40 virtual LonRange get_lonrange() const = 0;
41
43 virtual void set_lonrange(const LonRange& lonrange) = 0;
44
46 virtual Level get_level() const = 0;
47
49 virtual void set_level(const Level& level) = 0;
50
52 virtual Trange get_trange() const = 0;
53
55 virtual void set_trange(const Trange& trange) = 0;
56
58 virtual void clear() = 0;
59
66 virtual bool is_subquery(const Query& other) const = 0;
67
68#if 0
73 virtual void foreach_key(std::function<void(const char*, wreport::Var&&)> dest) const = 0;
74#endif
75
77 virtual void print(FILE* out) const = 0;
78
80 virtual std::unique_ptr<Query> clone() const = 0;
81
83 static std::unique_ptr<Query> create();
84
86 virtual bool empty() const = 0;
87};
88
89} // namespace dballe
90#endif
virtual std::unique_ptr< Query > clone() const =0
Return a copy of this query.
virtual DatetimeRange get_datetimerange() const =0
Get the Datetime bounds set in this query.
virtual Level get_level() const =0
Get the level to be matched.
virtual void print(FILE *out) const =0
Print the query contents to stderr.
virtual void set_datetimerange(const DatetimeRange &dt)=0
Set the Datetime range for this query.
virtual void set_latrange(const LatRange &latrange)=0
Set the range of latitudes to be matched.
virtual bool empty() const =0
Check if the query is empty, that is, it queries everything.
virtual LatRange get_latrange() const =0
Get the range of latitudes to be matched.
virtual Trange get_trange() const =0
Get the time range to be matched.
virtual bool is_subquery(const Query &other) const =0
Return true if this query matches a subset of the given query.
virtual LonRange get_lonrange() const =0
Get the range of longitudes to be matched.
static std::unique_ptr< Query > create()
Create a new Query.
virtual void set_lonrange(const LonRange &lonrange)=0
Set the range of longitudes to be matched.
virtual void set_level(const Level &level)=0
Set the level to be matched.
virtual void clear()=0
Clear the contents of the query, making it match all data.
virtual void set_trange(const Trange &trange)=0
Set the level to be matched.
Range of datetimes.
Definition types.h:297
Range of latitudes.
Definition types.h:470
Vertical level or layer.
Definition types.h:625
Range of longitudes.
Definition types.h:553
Information on how a value has been sampled or computed with regards to time.
Definition types.h:689
Common base types used by most of DB-All.e code.