/usr/include/wreport/subset.h is in libwreport-dev 3.6-1build2.
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 | #ifndef WREPORT_SUBSET_H
#define WREPORT_SUBSET_H
#include <wreport/var.h>
#include <vector>
namespace wreport {
struct Tables;
/**
* Represent a BUFR/CREX data subset as a list of decoded variables
*/
struct Subset : public std::vector<Var>
{
/// Tables used for creating variables in this subset
const Tables* tables;
/**
* Create a new BUFR/CREX subset.
*
* @param btable
* Reference to the B table to use to create variables.
*/
Subset(const Tables& tables);
Subset(const Subset& subset) = default;
Subset(Subset&& subset)
: std::vector<Var>(move(subset)), tables(subset.tables)
{
}
~Subset();
Subset& operator=(const Subset&) = default;
Subset& operator=(Subset&& s);
/// Store a decoded variable in the message, to be encoded later.
void store_variable(const Var& var);
/// Store a decoded variable in the message, to be encoded later.
void store_variable(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
void store_variable_undef(Varcode code);
/// Store a new, undefined variable in the message
void store_variable_undef(Varinfo info);
/**
* 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);
};
}
#endif
|