libdballe  7.19
v6/levtr.h
1 #ifndef DBALLE_DB_V6_LEVTR_H
2 #define DBALLE_DB_V6_LEVTR_H
3 
4 #include <dballe/core/defs.h>
5 #include <memory>
6 #include <cstdio>
7 
8 namespace dballe {
9 struct Record;
10 struct Msg;
11 
12 namespace msg {
13 struct Context;
14 }
15 
16 namespace db {
17 namespace v6 {
18 
22 struct LevTr
23 {
24  struct DBRow
25  {
27  int id;
29  int ltype1;
31  int l1;
33  int ltype2;
35  int l2;
37  int pind;
39  int p1;
41  int p2;
42  };
43 
44  virtual ~LevTr();
45 
50  virtual int obtain_id(const Level& lev, const Trange& tr) = 0;
51 
53  virtual const DBRow* read(int id) = 0;
54 
56  virtual void read_all(std::function<void(const DBRow&)> dest) = 0;
57 
59  virtual void dump(FILE* out) = 0;
60 };
61 
62 struct LevTrCache
63 {
64  virtual ~LevTrCache();
65 
71  virtual bool to_rec(int id, Record& rec) = 0;
72 
74  virtual Level to_level(int id) const = 0;
75 
77  virtual Trange to_trange(int id) const = 0;
78 
84  virtual msg::Context* to_msg(int id, Msg& msg) = 0;
85 
87  virtual void invalidate() = 0;
88 
90  virtual void dump(FILE* out) const = 0;
91 
93  static std::unique_ptr<LevTrCache> create(LevTr& levtr);
94 };
95 
96 }
97 }
98 }
99 
100 #endif
101 
Store an array of physical data all on the same level.
Definition: context.h:44
int l1
Level L1 SQL parameter.
Definition: v6/levtr.h:31
Storage for related physical data.
Definition: msg.h:70
int p1
Time range P1 SQL parameter.
Definition: v6/levtr.h:39
Information on how a value has been sampled or computed with regards to time.
Definition: types.h:587
Key/value store where keys are strings and values are wreport variables.
Definition: record.h:16
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
int id
lev_tr ID SQL parameter
Definition: v6/levtr.h:27
int l2
Level L2 SQL parameter.
Definition: v6/levtr.h:35
int ltype2
Second level type SQL parameter.
Definition: v6/levtr.h:33
Definition: v6/levtr.h:62
Vertical level or layer.
Definition: types.h:532
Definition: v6/levtr.h:24
Precompiled queries to manipulate the lev_tr table.
Definition: v6/levtr.h:22
int pind
Time range type SQL parameter.
Definition: v6/levtr.h:37
int p2
Time range P2 SQL parameter.
Definition: v6/levtr.h:41
int ltype1
First level type SQL parameter.
Definition: v6/levtr.h:29
Common definitions.