libdballe 9.13
postgresql/station.h
1#ifndef DBALLE_DB_V7_POSTGRESQL_STATION_H
2#define DBALLE_DB_V7_POSTGRESQL_STATION_H
3
4#include <dballe/db/v7/station.h>
5#include <functional>
6#include <memory>
7
8namespace wreport {
9struct Var;
10}
11
12namespace dballe {
13namespace db {
14namespace v7 {
15namespace postgresql {
16
20class PostgreSQLStation : public v7::Station
21{
22protected:
27
28 void
29 _dump(std::function<void(int, int, const Coords& coords, const char* ident)>
30 out) override;
31
32public:
33 PostgreSQLStation(v7::Transaction& tr,
35 ~PostgreSQLStation();
36 PostgreSQLStation(const PostgreSQLStation&) = delete;
37 PostgreSQLStation(const PostgreSQLStation&&) = delete;
38 PostgreSQLStation& operator=(const PostgreSQLStation&) = delete;
39
40 DBStation lookup(Tracer<>& trc, int id_station) override;
41 int maybe_get_id(Tracer<>& trc, const dballe::DBStation& st) override;
42 int insert_new(Tracer<>& trc, const dballe::DBStation& desc) override;
44 Tracer<>& trc, int id_station,
45 std::function<void(std::unique_ptr<wreport::Var>)> dest) override;
46 void add_station_vars(Tracer<>& trc, int id_station,
47 DBValues& values) override;
48 void
49 run_station_query(Tracer<>& trc, const v7::StationQueryBuilder& qb,
50 std::function<void(const dballe::DBStation&)>) override;
51};
52
53} // namespace postgresql
54} // namespace v7
55} // namespace db
56} // namespace dballe
57#endif
Smart pointer for trace::Step objects, which calls done() when going out of scope.
Definition db/v7/fwd.h:45
void get_station_vars(Tracer<> &trc, int id_station, std::function< void(std::unique_ptr< wreport::Var >)> dest) override
Export station variables.
int insert_new(Tracer<> &trc, const dballe::DBStation &desc) override
Insert a new station in the database, without checking if it already exists.
dballe::sql::PostgreSQLConnection & conn
DB connection.
Definition postgresql/station.h:26
DBStation lookup(Tracer<> &trc, int id_station) override
Lookup station data by ID.
int maybe_get_id(Tracer<> &trc, const dballe::DBStation &st) override
Get the station ID given latitude, longitude and mobile identifier.
void add_station_vars(Tracer<> &trc, int id_station, DBValues &values) override
Add all station variables (without attributes) to values.
Database connection.
Definition postgresql.h:240
Coordinates.
Definition types.h:372
Definition types.h:940
Collection of DBValue objects, indexed by wreport::Varcode.
Definition values.h:230
Definition qbuilder.h:83
Definition station.h:25
Definition transaction.h:16