libdballe  8.3
cursor.h
1 #ifndef DBALLE_CURSOR_H
2 #define DBALLE_CURSOR_H
3 
4 #include <dballe/fwd.h>
5 #include <dballe/values.h>
6 #include <wreport/var.h>
7 #include <memory>
8 #include <vector>
9 
10 namespace dballe {
11 
15 struct Cursor
16 {
17  virtual ~Cursor();
18 
26  virtual int remaining() const = 0;
27 
34  virtual bool next() = 0;
35 
37  virtual void discard() = 0;
38 
42  virtual DBStation get_station() const = 0;
43 };
44 
46 struct CursorStation : public Cursor
47 {
51  virtual DBValues get_values() const = 0;
52 };
53 
55 struct CursorStationData : public Cursor
56 {
58  virtual wreport::Varcode get_varcode() const = 0;
59 
61  virtual wreport::Var get_var() const = 0;
62 };
63 
65 struct CursorData : public Cursor
66 {
68  virtual wreport::Varcode get_varcode() const = 0;
69 
71  virtual wreport::Var get_var() const = 0;
72 
74  virtual Level get_level() const = 0;
75 
77  virtual Trange get_trange() const = 0;
78 
80  virtual Datetime get_datetime() const = 0;
81 };
82 
84 struct CursorSummary : public Cursor
85 {
87  virtual Level get_level() const = 0;
88 
90  virtual Trange get_trange() const = 0;
91 
93  virtual wreport::Varcode get_varcode() const = 0;
94 
96  virtual DatetimeRange get_datetimerange() const = 0;
97 
99  virtual size_t get_count() const = 0;
100 };
101 
103 struct CursorMessage : public Cursor
104 {
105  virtual const Message& get_message() const = 0;
106  virtual std::unique_ptr<Message> detach_message() = 0;
107 };
108 
109 }
110 #endif
Cursor iterating over data values.
Definition: cursor.h:65
virtual DBStation get_station() const =0
Get the whole station data in a single call.
virtual bool next()=0
Get a new item from the results of a query.
Cursor iterating over messages.
Definition: cursor.h:103
virtual int remaining() const =0
Get the number of rows still to be fetched.
Information on how a value has been sampled or computed with regards to time.
Definition: types.h:683
A bulletin that has been decoded and physically interpreted.
Definition: message.h:28
Definition: cmdline.h:18
Collection of DBValue objects, indexed by wreport::Varcode.
Definition: values.h:191
Cursor iterating over summary entries.
Definition: cursor.h:84
Vertical level or layer.
Definition: types.h:621
virtual void discard()=0
Discard the results that have not been read yet.
uint16_t Varcode
Range of datetimes.
Definition: types.h:291
Base class for cursors that iterate over DB query results.
Definition: cursor.h:15
Cursor iterating over station data values.
Definition: cursor.h:55
Cursor iterating over stations.
Definition: cursor.h:46
Date and time.
Definition: types.h:164
Definition: types.h:847
Structures used as input to database insert functions.