libdballe  7.29
v7/levtr.h
1 #ifndef DBALLE_DB_V7_LEVTR_H
2 #define DBALLE_DB_V7_LEVTR_H
3 
4 #include <dballe/core/defs.h>
5 #include <dballe/db/v7/state.h>
6 #include <memory>
7 #include <set>
8 #include <cstdio>
9 #include <functional>
10 
11 namespace dballe {
12 struct Record;
13 struct Msg;
14 
15 namespace msg {
16 struct Context;
17 }
18 
19 namespace db {
20 namespace v7 {
21 
25 struct LevTr
26 {
27 protected:
28  virtual void _dump(std::function<void(int, const Level&, const Trange&)> out) = 0;
29 
30 public:
31  virtual ~LevTr();
32 
36  virtual void prefetch_ids(const std::set<int>& ids, std::function<void(int, const LevTrDesc&)> dest) = 0;
37 
41  virtual void prefetch_same_level(int id, std::function<void(int, const LevTrDesc&)> dest) = 0;
42 
48  msg::Context* to_msg(State& st, int id, Msg& msg);
49 
51  virtual levtrs_t::iterator lookup_id(State& st, int id) = 0;
52 
57  virtual levtrs_t::iterator obtain_id(State& state, const LevTrDesc& desc) = 0;
58 
60  void dump(FILE* out);
61 };
62 
63 }
64 }
65 }
66 #endif
Store an array of physical data all on the same level.
Definition: context.h:44
Storage for related physical data.
Definition: msg.h:70
Cache intermediate results during a database transaction, to avoid hitting the database multiple time...
Definition: state.h:140
virtual levtrs_t::iterator obtain_id(State &state, const LevTrDesc &desc)=0
Look up a LevTr from the database given its description.
Information on how a value has been sampled or computed with regards to time.
Definition: types.h:587
Vertical level or layer.
Definition: types.h:532
virtual void prefetch_same_level(int id, std::function< void(int, const LevTrDesc &)> dest)=0
Given an ID, load LevTr information for all the entries with the same level type. ...
msg::Context * to_msg(State &st, int id, Msg &msg)
Get/create a Context in the Msg for this level/timerange.
Precompiled queries to manipulate the lev_tr table.
Definition: v7/levtr.h:25
virtual levtrs_t::iterator lookup_id(State &st, int id)=0
Look up a LevTr from the database given its ID.
virtual void prefetch_ids(const std::set< int > &ids, std::function< void(int, const LevTrDesc &)> dest)=0
Given a set of IDs, load LevTr information for them and add it to data.
Common definitions.
void dump(FILE *out)
Dump the entire contents of the table to an output stream.
Definition: state.h:58