libdballe 9.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
10namespace dballe {
11
15class Cursor : public std::enable_shared_from_this<Cursor>
16{
17public:
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
56class CursorStation : public Cursor
57{
58public:
62 virtual DBValues get_values() const = 0;
63};
64
67{
68public:
70 virtual wreport::Varcode get_varcode() const = 0;
71
73 virtual wreport::Var get_var() const = 0;
74};
75
77class CursorData : public Cursor
78{
79public:
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
97class CursorSummary : public Cursor
98{
99public:
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
117class CursorMessage : public Cursor
118{
119public:
120 virtual std::shared_ptr<Message> get_message() const = 0;
121};
122
123}
124#endif
Cursor iterating over data values.
Definition: cursor.h:78
virtual Datetime get_datetime() const =0
Get the datetime.
virtual Level get_level() const =0
Get the level.
virtual Trange get_trange() const =0
Get the time range.
virtual wreport::Varcode get_varcode() const =0
Get the variable code.
virtual wreport::Var get_var() const =0
Get the variable.
Cursor iterating over messages.
Definition: cursor.h:118
Cursor iterating over station data values.
Definition: cursor.h:67
virtual wreport::Var get_var() const =0
Get the variable.
virtual wreport::Varcode get_varcode() const =0
Get the variable code.
Cursor iterating over stations.
Definition: cursor.h:57
virtual DBValues get_values() const =0
Get the station data values.
Cursor iterating over summary entries.
Definition: cursor.h:98
virtual DatetimeRange get_datetimerange() const =0
Get the datetime range.
virtual Trange get_trange() const =0
Get the time range.
virtual size_t get_count() const =0
Get the count of elements.
virtual wreport::Varcode get_varcode() const =0
Get the variable code.
virtual Level get_level() const =0
Get the level.
Base class for cursors that iterate over DB query results.
Definition: cursor.h:16
virtual DBStation get_station() const =0
Get the whole station data in a single call.
virtual int remaining() const =0
Get the number of rows still to be fetched.
virtual void discard()=0
Discard the results that have not been read yet.
virtual bool next()=0
Get a new item from the results of a query.
virtual bool has_value() const =0
Check if the cursor points to a valid value.
uint16_t Varcode
Definition: types.h:851
Collection of DBValue objects, indexed by wreport::Varcode.
Definition: values.h:192
Range of datetimes.
Definition: types.h:295
Date and time.
Definition: types.h:165
Vertical level or layer.
Definition: types.h:625
Information on how a value has been sampled or computed with regards to time.
Definition: types.h:687
Structures used as input to database insert functions.