libwreport  3.15
subset.h
1 #ifndef WREPORT_SUBSET_H
2 #define WREPORT_SUBSET_H
3 
4 #include <wreport/var.h>
5 #include <vector>
6 
7 namespace wreport {
8 struct Tables;
9 
13 struct Subset : public std::vector<Var>
14 {
16  const Tables* tables;
17 
24  Subset(const Tables& tables);
25  Subset(const Subset& subset) = default;
26  Subset(Subset&& subset)
27  : std::vector<Var>(move(subset)), tables(subset.tables)
28  {
29  }
30  ~Subset();
31  Subset& operator=(const Subset&) = default;
32  Subset& operator=(Subset&& s);
33 
35  void store_variable(const Var& var);
36 
38  void store_variable(Var&& var);
39 
49  void store_variable(Varcode code, const Var& var);
50 
59  void store_variable_i(Varcode code, int val);
60 
69  void store_variable_d(Varcode code, double val);
70 
79  void store_variable_c(Varcode code, const char* val);
80 
82  void store_variable_undef(Varcode code);
83 
85  void store_variable_undef(Varinfo info);
86 
99  int append_dpb(Varcode ccode, unsigned size, Varcode attr);
100 
109  void append_fixed_dpb(Varcode ccode, int size);
110 
112  void print(FILE* out) const;
113 
125  unsigned diff(const Subset& s2) const;
126 
127 protected:
129  void append_c_with_dpb(Varcode ccode, int count, const char* bitmap);
130 };
131 
132 }
133 #endif
void store_variable_c(Varcode code, const char *val)
Store a new variable in the message, providing its value as a string.
void store_variable(const Var &var)
Store a decoded variable in the message, to be encoded later.
A physical variable.
Definition: var.h:23
STL namespace.
void print(FILE *out) const
Dump the contents of this subset.
unsigned diff(const Subset &s2) const
Compute the differences between two wreport subsets.
const Tables * tables
Tables used for creating variables in this subset.
Definition: subset.h:16
Subset(const Tables &tables)
Create a new BUFR/CREX subset.
Collection of BUFR/CREX tables used to work on a bulletin.
Definition: tables.h:17
void store_variable_d(Varcode code, double val)
Store a new variable in the message, providing its value as a double.
void store_variable_i(Varcode code, int val)
Store a new variable in the message, providing its value as an int.
uint16_t Varcode
Holds the WMO variable code of a variable.
Definition: varinfo.h:57
void append_fixed_dpb(Varcode ccode, int size)
Append a fixed-size data present bitmap with all zeros.
void store_variable_undef(Varcode code)
Store a new, undefined variable in the message.
Information about a variable.
Definition: varinfo.h:135
int append_dpb(Varcode ccode, unsigned size, Varcode attr)
Compute and append a data present bitmap.
String functions.
Definition: benchmark.h:13
Represent a BUFR/CREX data subset as a list of decoded variables.
Definition: subset.h:13
void append_c_with_dpb(Varcode ccode, int count, const char *bitmap)
Append a C operator with a count long bitmap.