libdballe  7.29
v7/sqlite/station.h
1 #ifndef DBALLE_DB_V7_SQLITE_STATION_H
2 #define DBALLE_DB_V7_SQLITE_STATION_H
3 
4 #include <dballe/db/v7/station.h>
5 #include <functional>
6 #include <memory>
7 
8 namespace wreport {
9 struct Var;
10 }
11 
12 namespace dballe {
13 namespace db {
14 namespace v7 {
15 namespace sqlite {
16 
20 class SQLiteStation : public v7::Station
21 {
22 protected:
27 
36 
38  bool maybe_get_id(const StationDesc& st, int* id) override;
39 
40  void _dump(std::function<void(int, int, const Coords& coords, const char* ident)> out) override;
41 
42 public:
44  ~SQLiteStation();
45  SQLiteStation(const SQLiteStation&) = delete;
46  SQLiteStation(const SQLiteStation&&) = delete;
47  SQLiteStation& operator=(const SQLiteStation&) = delete;
48 
49  stations_t::iterator lookup_id(State& st, int id) override;
50  stations_t::iterator obtain_id(State& st, const StationDesc& desc) override;
51 
52  void get_station_vars(int id_station, std::function<void(std::unique_ptr<wreport::Var>)> dest) override;
53  void add_station_vars(int id_station, Record& rec) override;
54 };
55 
56 }
57 }
58 }
59 }
60 #endif
dballe::sql::SQLiteStatement * sfstm
Precompiled select fixed station query.
Definition: v7/sqlite/station.h:29
Definition: state.h:32
Cache intermediate results during a database transaction, to avoid hitting the database multiple time...
Definition: state.h:140
void add_station_vars(int id_station, Record &rec) override
Add all station variables (without attributes) to rec.
Coordinates.
Definition: types.h:337
dballe::sql::SQLiteStatement * smstm
Precompiled select mobile station query.
Definition: v7/sqlite/station.h:31
Key/value store where keys are strings and values are wreport variables.
Definition: record.h:17
dballe::sql::SQLiteStatement * istm
Precompiled insert query.
Definition: v7/sqlite/station.h:35
Definition: v7/station.h:20
Precompiled queries to manipulate the station table.
Definition: v7/sqlite/station.h:20
stations_t::iterator obtain_id(State &st, const StationDesc &desc) override
Get the station ID given latitude, longitude and mobile identifier.
void get_station_vars(int id_station, std::function< void(std::unique_ptr< wreport::Var >)> dest) override
Export station variables.
bool maybe_get_id(const StationDesc &st, int *id) override
Lookup the ID of a station, returning true if it was found, false if not.
stations_t::iterator lookup_id(State &st, int id) override
Look up a station give its ID.
SQLite statement.
Definition: sqlite.h:89
dballe::sql::SQLiteConnection & conn
DB connection.
Definition: v7/sqlite/station.h:26
Database connection.
Definition: sqlite.h:34
dballe::sql::SQLiteStatement * sstm
Precompiled select station details query.
Definition: v7/sqlite/station.h:33