libdballe  7.29
v7/postgresql/levtr.h
1 #ifndef DBALLE_DB_V7_POSTGRESQL_LEVTRV7_H
2 #define DBALLE_DB_V7_POSTGRESQL_LEVTRV7_H
3 
4 #include <dballe/db/db.h>
5 #include <dballe/db/v7/levtr.h>
6 #include <dballe/sql/fwd.h>
7 #include <cstdio>
8 #include <memory>
9 
10 namespace dballe {
11 struct Record;
12 struct Msg;
13 
14 namespace msg {
15 struct Context;
16 }
17 
18 namespace db {
19 namespace v7 {
20 namespace postgresql {
21 struct DB;
22 
26 struct PostgreSQLLevTr : public v7::LevTr
27 {
28 protected:
30 
31  void _dump(std::function<void(int, const Level&, const Trange&)> out) override;
32 
33 public:
35  PostgreSQLLevTr(const LevTr&) = delete;
36  PostgreSQLLevTr(const LevTr&&) = delete;
37  PostgreSQLLevTr& operator=(const PostgreSQLLevTr&) = delete;
38  ~PostgreSQLLevTr();
39 
40  void prefetch_ids(const std::set<int>& ids, std::function<void(int, const LevTrDesc&)> dest) override;
41  void prefetch_same_level(int id, std::function<void(int, const LevTrDesc&)> dest) override;
42  levtrs_t::iterator lookup_id(State& st, int id) override;
43  levtrs_t::iterator obtain_id(State& state, const LevTrDesc& desc) override;
44 };
45 
46 
47 }
48 }
49 }
50 }
51 #endif
Database connection.
Definition: postgresql.h:240
Cache intermediate results during a database transaction, to avoid hitting the database multiple time...
Definition: state.h:140
void prefetch_ids(const std::set< int > &ids, std::function< void(int, const LevTrDesc &)> dest) override
Given a set of IDs, load LevTr information for them and add it to data.
Information on how a value has been sampled or computed with regards to time.
Definition: types.h:587
Forward declarations for public dballe/sql names.
Precompiled queries to manipulate the lev_tr table.
Definition: v7/postgresql/levtr.h:26
Vertical level or layer.
Definition: types.h:532
Functions used to connect to DB-All.e and insert, query and delete data.
levtrs_t::iterator lookup_id(State &st, int id) override
Look up a LevTr from the database given its ID.
void prefetch_same_level(int id, std::function< void(int, const LevTrDesc &)> dest) override
Given an ID, load LevTr information for all the entries with the same level type. ...
Precompiled queries to manipulate the lev_tr table.
Definition: v7/levtr.h:25
levtrs_t::iterator obtain_id(State &state, const LevTrDesc &desc) override
Look up a LevTr from the database given its description.
Definition: state.h:58