libdballe  8.6
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 class Cursor
16 {
17 public:
18  virtual ~Cursor();
19 
27  virtual bool has_value() const = 0;
28 
36  virtual int remaining() const = 0;
37 
44  virtual bool next() = 0;
45 
47  virtual void discard() = 0;
48 
52  virtual DBStation get_station() const = 0;
53 };
54 
56 class CursorStation : public Cursor
57 {
58 public:
62  virtual DBValues get_values() const = 0;
63 };
64 
66 class CursorStationData : public Cursor
67 {
68 public:
70  virtual wreport::Varcode get_varcode() const = 0;
71 
73  virtual wreport::Var get_var() const = 0;
74 };
75 
77 class CursorData : public Cursor
78 {
79 public:
81  virtual wreport::Varcode get_varcode() const = 0;
82 
84  virtual wreport::Var get_var() const = 0;
85 
87  virtual Level get_level() const = 0;
88 
90  virtual Trange get_trange() const = 0;
91 
93  virtual Datetime get_datetime() const = 0;
94 };
95 
97 class CursorSummary : public Cursor
98 {
99 public:
101  virtual Level get_level() const = 0;
102 
104  virtual Trange get_trange() const = 0;
105 
107  virtual wreport::Varcode get_varcode() const = 0;
108 
110  virtual DatetimeRange get_datetimerange() const = 0;
111 
113  virtual size_t get_count() const = 0;
114 };
115 
117 class CursorMessage : public Cursor
118 {
119 public:
120  virtual const Message& get_message() const = 0;
121  virtual std::unique_ptr<Message> detach_message() = 0;
122 };
123 
124 }
125 #endif
dballe::Cursor::next
virtual bool next()=0
Get a new item from the results of a query.
dballe::CursorData::get_varcode
virtual wreport::Varcode get_varcode() const =0
Get the variable code.
dballe::CursorStation
Cursor iterating over stations.
Definition: cursor.h:56
values.h
dballe::CursorSummary
Cursor iterating over summary entries.
Definition: cursor.h:97
dballe::Message
A bulletin that has been decoded and physically interpreted.
Definition: message.h:28
dballe::Cursor
Base class for cursors that iterate over DB query results.
Definition: cursor.h:15
dballe::CursorStation::get_values
virtual DBValues get_values() const =0
Get the station data values.
dballe::Cursor::has_value
virtual bool has_value() const =0
Check if the cursor points to a valid value.
dballe::CursorStationData::get_varcode
virtual wreport::Varcode get_varcode() const =0
Get the variable code.
dballe::CursorSummary::get_trange
virtual Trange get_trange() const =0
Get the time range.
dballe::CursorSummary::get_varcode
virtual wreport::Varcode get_varcode() const =0
Get the variable code.
dballe::Cursor::get_station
virtual DBStation get_station() const =0
Get the whole station data in a single call.
dballe::CursorData::get_var
virtual wreport::Var get_var() const =0
Get the variable.
dballe::Cursor::remaining
virtual int remaining() const =0
Get the number of rows still to be fetched.
dballe::DBStation
Definition: types.h:850
wreport::Varcode
uint16_t Varcode
dballe::DBValues
Collection of DBValue objects, indexed by wreport::Varcode.
Definition: values.h:191
dballe::CursorData::get_trange
virtual Trange get_trange() const =0
Get the time range.
dballe::DatetimeRange
Range of datetimes.
Definition: types.h:294
dballe::Trange
Information on how a value has been sampled or computed with regards to time.
Definition: types.h:686
dballe::CursorSummary::get_level
virtual Level get_level() const =0
Get the level.
dballe::CursorStationData::get_var
virtual wreport::Var get_var() const =0
Get the variable.
dballe::CursorData::get_datetime
virtual Datetime get_datetime() const =0
Get the datetime.
dballe::Level
Vertical level or layer.
Definition: types.h:624
wreport::Var
dballe::CursorStationData
Cursor iterating over station data values.
Definition: cursor.h:66
dballe::CursorSummary::get_datetimerange
virtual DatetimeRange get_datetimerange() const =0
Get the datetime range.
dballe::CursorData
Cursor iterating over data values.
Definition: cursor.h:77
dballe::Cursor::discard
virtual void discard()=0
Discard the results that have not been read yet.
dballe::Datetime
Date and time.
Definition: types.h:164
dballe::CursorMessage
Cursor iterating over messages.
Definition: cursor.h:117
dballe::CursorData::get_level
virtual Level get_level() const =0
Get the level.
dballe::CursorSummary::get_count
virtual size_t get_count() const =0
Get the count of elements.