/usr/include/wreport/subset.h is in libwreport-dev 2.14-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | /*
* wreport/subset - Data subset for BUFR and CREX messages
*
* Copyright (C) 2005--2011 ARPA-SIM <urpsim@smr.arpa.emr.it>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author: Enrico Zini <enrico@enricozini.com>
*/
#ifndef WREPORT_SUBSET_H
#define WREPORT_SUBSET_H
/** @file
* @ingroup bufrex
* Handling of a BUFR/CREX data subset as a list of decoded variables.
*/
#include <wreport/var.h>
#include <wreport/vartable.h>
#include <wreport/dtable.h>
#include <vector>
namespace wreport {
/**
* Represent a BUFR/CREX data subset as a list of decoded variables
*/
struct Subset : public std::vector<Var>
{
/// dba_vartable used to lookup B table codes
const Vartable* btable;
/**
* Create a new BUFR/CREX subset.
*
* @param btable
* Reference to the B table to use to create variables.
*/
Subset(const Vartable* btable);
~Subset();
/// Store a decoded variable in the message, to be encoded later.
void store_variable(const Var& var);
/**
* Store a new variable in the message, copying it from an already existing
* variable.
*
* @param code
* The Varcode of the variable to add. See @ref varinfo.h
* @param var
* The variable holding the value for the variable to add.
*/
void store_variable(Varcode code, const Var& var);
/**
* Store a new variable in the message, providing its value as an int
*
* @param code
* The Varcode of the variable to add. See @ref vartable.h
* @param val
* The value for the variable
*/
void store_variable_i(Varcode code, int val);
/**
* Store a new variable in the message, providing its value as a double
*
* @param code
* The Varcode of the variable to add. See @ref vartable.h
* @param val
* The value for the variable
*/
void store_variable_d(Varcode code, double val);
/**
* Store a new variable in the message, providing its value as a string
*
* @param code
* The Varcode of the variable to add. See @ref vartable.h
* @param val
* The value for the variable
*/
void store_variable_c(Varcode code, const char* val);
/**
* Store a new, undefined variable in the message
*
* @param code
* The Varcode of the variable to add. See @ref vartable.h
*/
void store_variable_undef(Varcode code);
/**
* Compute and append a data present bitmap
*
* @param ccode
* The C code that uses this bitmap
* @param size
* The size of the bitmap
* @param attr
* The code of the attribute that the bitmap will represent. See @ref vartable.h
* @return
* The number of attributes that will be encoded (for which the dpb has '+')
*/
int append_dpb(Varcode ccode, unsigned size, Varcode attr);
/**
* Append a fixed-size data present bitmap with all zeros
*
* @param ccode
* The C code that uses this bitmap
* @param size
* The size of the bitmap
*/
void append_fixed_dpb(Varcode ccode, int size);
/// Dump the contents of this subset
void print(FILE* out) const;
/**
* Compute the differences between two wreport subsets
*
* Details of the differences found will be formatted using the notes
* system (@see notes.h).
*
* @param s2
* The subset to compare with this one
* @returns
* The number of differences found
*/
unsigned diff(const Subset& s2) const;
protected:
/// Append a C operator with a \a count long bitmap
void append_c_with_dpb(Varcode ccode, int count, const char* bitmap);
};
}
/* vim:set ts=4 sw=4: */
#endif
|