libwreport  3.10
vartable.h
1 #ifndef WREPORT_VARTABLE_H
2 #define WREPORT_VARTABLE_H
3 
4 #include <wreport/varinfo.h>
5 #include <string>
6 #include <functional>
7 
8 namespace wreport {
9 struct BufrTableID;
10 struct CrexTableID;
11 
30 struct Vartable
31 {
32  virtual ~Vartable();
33 
35  virtual std::string pathname() const = 0;
36 
45  virtual Varinfo query(Varcode code) const = 0;
46 
48  virtual bool contains(Varcode code) const = 0;
49 
64  virtual Varinfo query_altered(Varcode code, int new_scale, unsigned new_bit_len) const = 0;
65 
73  virtual bool iterate(std::function<bool(Varinfo)> dest) const = 0;
74 
81  static const Vartable* load_bufr(const std::string& pathname);
82 
89  static const Vartable* load_crex(const std::string& pathname);
90 
92  static const Vartable* get_bufr(const BufrTableID& id);
93 
95  static const Vartable* get_crex(const CrexTableID& id);
96 
98  static const Vartable* get_bufr(const std::string& basename);
99 
101  static const Vartable* get_crex(const std::string& basename);
102 };
103 
104 }
105 
106 #endif
virtual Varinfo query(Varcode code) const =0
Query the Vartable.
static const Vartable * get_crex(const CrexTableID &id)
Find a CREX table.
Identifying information for one distinct instance of CREX tables.
Definition: tableinfo.h:43
virtual bool iterate(std::function< bool(Varinfo)> dest) const =0
Iterate the whole contents of the table.
virtual std::string pathname() const =0
Return the pathname of the file from which this table has been loaded.
virtual Varinfo query_altered(Varcode code, int new_scale, unsigned new_bit_len) const =0
Query an altered version of the vartable.
static const Vartable * load_bufr(const std::string &pathname)
Return a BUFR vartable, by file name.
virtual bool contains(Varcode code) const =0
Check if the code can be resolved to a varinfo.
static const Vartable * load_crex(const std::string &pathname)
Return a CREX vartable, by file name.
static const Vartable * get_bufr(const BufrTableID &id)
Find a BUFR table.
uint16_t Varcode
Holds the WMO variable code of a variable.
Definition: varinfo.h:57
Information about a variable.
Definition: varinfo.h:135
Implement fast access to information about WMO variables.
Identifying information for one distinct instance of BUFR tables.
Definition: tableinfo.h:14
Holds a variable information table.
Definition: vartable.h:30