libdballe  7.21
v7/station.h
1 #ifndef DBALLE_DB_V7_STATION_H
2 #define DBALLE_DB_V7_STATION_H
3 
4 #include <dballe/sql/fwd.h>
5 #include <dballe/db/v7/state.h>
6 #include <memory>
7 #include <cstdio>
8 
9 namespace wreport {
10 struct Var;
11 }
12 
13 namespace dballe {
14 struct Record;
15 
16 namespace db {
17 namespace v7 {
18 
19 struct Station
20 {
21 protected:
22  virtual bool maybe_get_id(const StationDesc& st, int* id) = 0;
23  virtual void _dump(std::function<void(int, int, const Coords& coords, const char* ident)> out) = 0;
24 
25 public:
27  //static std::unique_ptr<Station> create(Connection& conn);
28 
29  virtual ~Station();
30 
36  virtual stations_t::iterator lookup_id(State& st, int id) = 0;
37 
43  virtual stations_t::iterator get_id(State& st, const StationDesc& desc);
44 
50  virtual stations_t::iterator obtain_id(State& st, const StationDesc& desc) = 0;
51 
55  void dump(FILE* out);
56 
60  virtual void get_station_vars(int id_station, std::function<void(std::unique_ptr<wreport::Var>)> dest) = 0;
61 
68  virtual void add_station_vars(int id_station, Record& rec) = 0;
69 };
70 
71 }
72 }
73 }
74 #endif
75 
Definition: state.h:32
Cache intermediate results during a database transaction, to avoid hitting the database multiple time...
Definition: state.h:140
Coordinates.
Definition: types.h:337
Key/value store where keys are strings and values are wreport variables.
Definition: record.h:16
Forward declarations for public dballe/sql names.
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
Definition: v7/station.h:19