libdballe  7.29
v6/postgresql/station.h
1 #ifndef DBALLE_DB_V6_POSTGRESQL_V6_STATION_H
2 #define DBALLE_DB_V6_POSTGRESQL_V6_STATION_H
3 
4 #include <dballe/db/v6/station.h>
5 #include <dballe/sql/fwd.h>
6 #include <functional>
7 #include <memory>
8 
9 namespace wreport {
10 struct Var;
11 }
12 
13 namespace dballe {
14 namespace db {
15 namespace v6 {
16 namespace postgresql {
17 
18 class StationBase : public v6::Station
19 {
20 protected:
25 
27  bool maybe_get_id(int lat, int lon, const char* ident, int* id);
28 
29  StationBase(const StationBase&) = delete;
30  StationBase(const StationBase&&) = delete;
31  StationBase& operator=(const StationBase&) = delete;
32 
33 public:
35  ~StationBase();
36 
45  int get_id(int lat, int lon, const char* ident=nullptr) override;
46 
55  int obtain_id(int lat, int lon, const char* ident=nullptr, bool* inserted=NULL) override;
56 
57  void get_station_vars(int id_station, int id_report, std::function<void(std::unique_ptr<wreport::Var>)> dest) override;
58 
59  void add_station_vars(int id_station, Record& rec) override;
60 
64  void dump(FILE* out) override;
65 };
66 
68 {
69 public:
72 };
73 
74 }
75 }
76 }
77 }
78 #endif
Database connection.
Definition: postgresql.h:240
dballe::sql::PostgreSQLConnection & conn
DB connection.
Definition: v6/postgresql/station.h:24
void dump(FILE *out) override
Dump the entire contents of the table to an output stream.
Key/value store where keys are strings and values are wreport variables.
Definition: record.h:17
Forward declarations for public dballe/sql names.
int get_id(int lat, int lon, const char *ident=nullptr) override
Get the station ID given latitude, longitude and mobile identifier.
Definition: v6/postgresql/station.h:18
Definition: v6/postgresql/station.h:67
bool maybe_get_id(int lat, int lon, const char *ident, int *id)
Lookup the ID of a station, returning true if it was found, false if not.
int obtain_id(int lat, int lon, const char *ident=nullptr, bool *inserted=NULL) override
Get the station ID given latitude, longitude and mobile identifier.
void get_station_vars(int id_station, int id_report, std::function< void(std::unique_ptr< wreport::Var >)> dest) override
Export station variables.
Definition: v6/station.h:19
void add_station_vars(int id_station, Record &rec) override
Add all station variables (without attributes) to rec.