libwreport  2.9
subset.h
Go to the documentation of this file.
1 /*
2  * wreport/subset - Data subset for BUFR and CREX messages
3  *
4  * Copyright (C) 2005--2011 ARPA-SIM <urpsim@smr.arpa.emr.it>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * Author: Enrico Zini <enrico@enricozini.com>
20  */
21 
22 #ifndef WREPORT_SUBSET_H
23 #define WREPORT_SUBSET_H
24 
30 #include <wreport/var.h>
31 #include <wreport/vartable.h>
32 #include <wreport/dtable.h>
33 #include <vector>
34 
35 namespace wreport {
36 
40 struct Subset : public std::vector<Var>
41 {
43  const Vartable* btable;
44 
51  Subset(const Vartable* btable);
52  ~Subset();
53 
55  void store_variable(const Var& var);
56 
66  void store_variable(Varcode code, const Var& var);
67 
76  void store_variable_i(Varcode code, int val);
77 
86  void store_variable_d(Varcode code, double val);
87 
96  void store_variable_c(Varcode code, const char* val);
97 
104  void store_variable_undef(Varcode code);
105 
118  int append_dpb(Varcode ccode, unsigned size, Varcode attr);
119 
128  void append_fixed_dpb(Varcode ccode, int size);
129 
131  void print(FILE* out) const;
132 
144  unsigned diff(const Subset& s2) const;
145 
146 protected:
148  void append_c_with_dpb(Varcode ccode, int count, const char* bitmap);
149 };
150 
151 }
152 
153 /* vim:set ts=4 sw=4: */
154 #endif
void store_variable_c(Varcode code, const char *val)
Store a new variable in the message, providing its value as a string.
Subset(const Vartable *btable)
Create a new BUFR/CREX subset.
void store_variable(const Var &var)
Store a decoded variable in the message, to be encoded later.
unsigned diff(const Subset &s2) const
Compute the differences between two wreport subsets.
Implement wreport::Var, an encapsulation of a measured variable.
Holds a wreport variable.
Definition: var.h:50
const Vartable * btable
dba_vartable used to lookup B table codes
Definition: subset.h:43
Implement fast access to information about WMO variables.
void store_variable_d(Varcode code, double val)
Store a new variable in the message, providing its value as a double.
Holds a variable information table.
Definition: vartable.h:84
void store_variable_i(Varcode code, int val)
Store a new variable in the message, providing its value as an int.
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.
int append_dpb(Varcode ccode, unsigned size, Varcode attr)
Compute and append a data present bitmap.
short unsigned int Varcode
Holds the WMO variable code of a variable.
Definition: varinfo.h:78
Represent a BUFR/CREX data subset as a list of decoded variables.
Definition: subset.h:40
void print(FILE *out) const
Dump the contents of this subset.
Implement fast access to information about WMO expansion tables D.
void append_c_with_dpb(Varcode ccode, int count, const char *bitmap)
Append a C operator with a count long bitmap.