libdballe  9.11
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/cache.h>
6 #include <dballe/db/v7/fwd.h>
7 #include <dballe/msg/fwd.h>
8 #include <memory>
9 #include <set>
10 #include <cstdio>
11 #include <functional>
12 
13 namespace dballe {
14 namespace db {
15 namespace v7 {
16 
20 struct LevTr
21 {
22 protected:
23  v7::Transaction& tr;
24  LevTrCache cache;
25  virtual void _dump(std::function<void(int, const Level&, const Trange&)> out) = 0;
26 
27 public:
29  virtual ~LevTr();
30 
37  void clear_cache();
38 
42  virtual void prefetch_ids(Tracer<>& trc, const std::set<int>& ids) = 0;
43 
49  impl::msg::Context* to_msg(Tracer<>& trc, int id, impl::Message& msg);
50 
54  const LevTrEntry& lookup_cache(int id);
55 
57  virtual const LevTrEntry* lookup_id(Tracer<>& trc, int id) = 0;
58 
63  virtual int obtain_id(Tracer<>& trc, const LevTrEntry& desc) = 0;
64 
66  void dump(FILE* out);
67 };
68 
69 }
70 }
71 }
72 #endif
Information on how a value has been sampled or computed with regards to time.
Definition: types.h:686
Definition: cmdline.h:18
virtual const LevTrEntry * lookup_id(Tracer<> &trc, int id)=0
Look up a LevTr from the database given its ID.
Definition: cache.h:46
Vertical level or layer.
Definition: types.h:624
Store an array of physical data all on the same level.
Definition: context.h:23
void clear_cache()
Invalidate the LevTrEntry cache.
Definition: cache.h:14
Definition: transaction.h:15
Precompiled queries to manipulate the lev_tr table.
Definition: levtr.h:20
Smart pointer for trace::Step objects, which calls done() when going out of scope.
Definition: db/v7/fwd.h:45
virtual int obtain_id(Tracer<> &trc, const LevTrEntry &desc)=0
Look up a LevTr from the database given its description.
impl::msg::Context * to_msg(Tracer<> &trc, int id, impl::Message &msg)
Get/create a Context in the Msg for this level/timerange.
const LevTrEntry & lookup_cache(int id)
Lookup a LevTr entry from the cache, throwing an exception if it is not found.
virtual void prefetch_ids(Tracer<> &trc, const std::set< int > &ids)=0
Given a set of IDs, load LevTr information for them and add it to the cache.
Common definitions.
Storage for related physical data.
Definition: msg.h:130
void dump(FILE *out)
Dump the entire contents of the table to an output stream.