libwreport  2.4
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