libdballe  9.11
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 <wreport/var.h>
7 #include <string>
8 #include <functional>
9 #include <memory>
10 
11 namespace dballe {
12 
14 class Query
15 {
16 public:
17  Query() {}
18  Query(const Query&) = default;
19  Query(Query&&) = default;
20  virtual ~Query() {}
21 
22  Query& operator=(const Query& o) = default;
23  Query& operator=(Query&& o) = default;
24 
26  virtual DatetimeRange get_datetimerange() const = 0;
27 
29  virtual void set_datetimerange(const DatetimeRange& dt) = 0;
30 
32  virtual LatRange get_latrange() const = 0;
33 
35  virtual void set_latrange(const LatRange& latrange) = 0;
36 
38  virtual LonRange get_lonrange() const = 0;
39 
41  virtual void set_lonrange(const LonRange& lonrange) = 0;
42 
44  virtual Level get_level() const = 0;
45 
47  virtual void set_level(const Level& level) = 0;
48 
50  virtual Trange get_trange() const = 0;
51 
53  virtual void set_trange(const Trange& trange) = 0;
54 
56  virtual void clear() = 0;
57 
64  virtual bool is_subquery(const Query& other) const = 0;
65 
66 #if 0
67 
71  virtual void foreach_key(std::function<void(const char*, wreport::Var&&)> dest) const = 0;
72 #endif
73 
75  virtual void print(FILE* out) const = 0;
76 
78  virtual std::unique_ptr<Query> clone() const = 0;
79 
81  static std::unique_ptr<Query> create();
82 
84  virtual bool empty() const = 0;
85 };
86 
87 }
88 #endif
Common base types used by most of DB-All.e code.
static std::unique_ptr< Query > create()
Create a new Query.
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 bool is_subquery(const Query &other) const =0
Return true if this query matches a subset of the given query.
Information on how a value has been sampled or computed with regards to time.
Definition: types.h:686
Definition: cmdline.h:18
virtual bool empty() const =0
Check if the query is empty, that is, it queries everything.
Vertical level or layer.
Definition: types.h:624
virtual void set_trange(const Trange &trange)=0
Set the level to be matched.
virtual std::unique_ptr< Query > clone() const =0
Return a copy of this query.
Range of datetimes.
Definition: types.h:294
virtual DatetimeRange get_datetimerange() const =0
Get the Datetime bounds set in this query.
virtual void set_level(const Level &level)=0
Set the level to be matched.
Range of latitudes.
Definition: types.h:467
virtual void clear()=0
Clear the contents of the query, making it match all data.
virtual LatRange get_latrange() const =0
Get the range of latitudes to be matched.
Range of longitudes.
Definition: types.h:551
virtual Level get_level() const =0
Get the level to be matched.
virtual void set_latrange(const LatRange &latrange)=0
Set the range of latitudes to be matched.
Query used to filter DB-All.e data.
Definition: query.h:14
virtual void set_lonrange(const LonRange &lonrange)=0
Set the range of longitudes to be matched.
virtual LonRange get_lonrange() const =0
Get the range of longitudes to be matched.
virtual Trange get_trange() const =0
Get the time range to be matched.