libwreport  2.4
subset.h
Go to the documentation of this file.
00001 /*
00002  * wreport/subset - Data subset for BUFR and CREX messages
00003  *
00004  * Copyright (C) 2005--2011  ARPA-SIM <urpsim@smr.arpa.emr.it>
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00018  *
00019  * Author: Enrico Zini <enrico@enricozini.com>
00020  */
00021 
00022 #ifndef WREPORT_SUBSET_H
00023 #define WREPORT_SUBSET_H
00024 
00030 #include <wreport/var.h>
00031 #include <wreport/vartable.h>
00032 #include <wreport/dtable.h>
00033 #include <vector>
00034 
00035 namespace wreport {
00036 
00040 struct Subset : public std::vector<Var>
00041 {
00043     const Vartable* btable;
00044 
00051     Subset(const Vartable* btable);
00052     ~Subset();
00053 
00055     void store_variable(const Var& var);
00056 
00066     void store_variable(Varcode code, const Var& var);
00067 
00076     void store_variable_i(Varcode code, int val);
00077 
00086     void store_variable_d(Varcode code, double val);
00087 
00096     void store_variable_c(Varcode code, const char* val);
00097 
00104     void store_variable_undef(Varcode code);
00105 
00118     int append_dpb(Varcode ccode, unsigned size, Varcode attr);
00119 
00128     void append_fixed_dpb(Varcode ccode, int size);
00129 
00131     void print(FILE* out) const;
00132 
00144     unsigned diff(const Subset& s2) const;
00145 
00146 protected:
00148     void append_c_with_dpb(Varcode ccode, int count, const char* bitmap);
00149 };
00150 
00151 }
00152 
00153 /* vim:set ts=4 sw=4: */
00154 #endif