libdballe  7.29
v7/sqlite/levtr.h
1 #ifndef DBALLE_DB_V7_SQLITE_LEVTRV7_H
2 #define DBALLE_DB_V7_SQLITE_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 sqlite {
21 struct DB;
22 
26 struct SQLiteLevTr : public v7::LevTr
27 {
28 protected:
33 
42 
43  void _dump(std::function<void(int, const Level&, const Trange&)> out) override;
44 
45 public:
47  SQLiteLevTr(const LevTr&) = delete;
48  SQLiteLevTr(const LevTr&&) = delete;
49  SQLiteLevTr& operator=(const SQLiteLevTr&) = delete;
50  ~SQLiteLevTr();
51 
52  void prefetch_ids(const std::set<int>& ids, std::function<void(int, const LevTrDesc&)> dest) override;
53  void prefetch_same_level(int id, std::function<void(int, const LevTrDesc&)> dest) override;
54  levtrs_t::iterator lookup_id(State& st, int id) override;
55  levtrs_t::iterator obtain_id(State& state, const LevTrDesc& desc) override;
56 };
57 
58 
59 }
60 }
61 }
62 }
63 #endif
dballe::sql::SQLiteConnection & conn
DB connection.
Definition: v7/sqlite/levtr.h:32
Cache intermediate results during a database transaction, to avoid hitting the database multiple time...
Definition: state.h:140
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.
levtrs_t::iterator lookup_id(State &st, int id) override
Look up a LevTr from the database given its ID.
Vertical level or layer.
Definition: types.h:532
Functions used to connect to DB-All.e and insert, query and delete data.
dballe::sql::SQLiteStatement * sstm
Precompiled select statement.
Definition: v7/sqlite/levtr.h:35
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
dballe::sql::SQLiteStatement * istm
Precompiled insert statement.
Definition: v7/sqlite/levtr.h:39
levtrs_t::iterator obtain_id(State &state, const LevTrDesc &desc) override
Look up a LevTr from the database given its description.
Precompiled queries to manipulate the lev_tr table.
Definition: v7/sqlite/levtr.h:26
SQLite statement.
Definition: sqlite.h:89
dballe::sql::SQLiteStatement * sdstm
Precompiled select data statement.
Definition: v7/sqlite/levtr.h:37
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.
dballe::sql::SQLiteStatement * dstm
Precompiled delete statement.
Definition: v7/sqlite/levtr.h:41
Definition: state.h:58
Database connection.
Definition: sqlite.h:34