libwreport  3.38
vartable.h
1 #ifndef WREPORT_VARTABLE_H
2 #define WREPORT_VARTABLE_H
3 
4 #include <wreport/varinfo.h>
5 #include <filesystem>
6 #include <string>
7 #include <functional>
8 #include <wreport/fwd.h>
9 
10 namespace wreport {
11 
30 class Vartable
31 {
32 public:
33  virtual ~Vartable();
34 
36  [[deprecated("Use path instead")]] virtual std::string pathname() const = 0;
37 
46  virtual Varinfo query(Varcode code) const = 0;
47 
49  virtual bool contains(Varcode code) const = 0;
50 
67  virtual Varinfo query_altered(Varcode code, int new_scale, unsigned new_bit_len, int new_bit_ref) const = 0;
68 
76  virtual bool iterate(std::function<bool(Varinfo)> dest) const = 0;
77 
84  [[deprecated("Use load_bufr(filesystem::path& instead")]] static const Vartable* load_bufr(const std::string& pathname);
85  static const Vartable* load_bufr(const std::filesystem::path& pathname);
86  static const Vartable* load_bufr(const char* pathname);
87 
94  [[deprecated("Use load_crex(filesystem::path& instead")]] static const Vartable* load_crex(const std::string& pathname);
95  static const Vartable* load_crex(const std::filesystem::path& pathname);
96  static const Vartable* load_crex(const char* pathname);
97 
99  static const Vartable* get_bufr(const BufrTableID& id);
100 
102  static const Vartable* get_crex(const CrexTableID& id);
103 
105  static const Vartable* get_bufr(const std::string& basename);
106 
108  static const Vartable* get_crex(const std::string& basename);
109 
111  virtual std::filesystem::path path() const = 0;
112 };
113 
114 }
115 
116 #endif
virtual Varinfo query(Varcode code) const =0
Query the Vartable.
Identifying information for one distinct instance of CREX tables.
Definition: tableinfo.h:43
virtual std::string pathname() const =0
Return the pathname of the file from which this table has been loaded.
static const Vartable * get_crex(const CrexTableID &id)
Find a CREX table.
static const Vartable * load_crex(const std::string &pathname)
Return a CREX vartable, by file name.
Identifying information for one distinct instance of BUFR tables.
Definition: tableinfo.h:13
Holds a variable information table.
Definition: vartable.h:30
uint16_t Varcode
Holds the WMO variable code of a variable.
Definition: fwd.h:12
Information about a variable.
Definition: varinfo.h:138
static const Vartable * load_bufr(const std::string &pathname)
Return a BUFR vartable, by file name.
virtual std::filesystem::path path() const =0
Return the pathname of the file from which this table has been loaded.
virtual bool contains(Varcode code) const =0
Check if the code can be resolved to a varinfo.
String functions.
Definition: benchmark.h:13
Implement fast access to information about WMO variables.
static const Vartable * get_bufr(const BufrTableID &id)
Find a BUFR table.
virtual bool iterate(std::function< bool(Varinfo)> dest) const =0
Iterate the whole contents of the table.
virtual Varinfo query_altered(Varcode code, int new_scale, unsigned new_bit_len, int new_bit_ref) const =0
Query an altered version of the vartable.