/usr/include/dballe/msg/msgs.h is in libdballe-dev 6.8-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 | /*
* msg/msgs - Hold a group of similar Msg
*
* 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 DBA_MSG_MSGS_H
#define DBA_MSG_MSGS_H
/** @file
* @ingroup msg
* Dynamic array of dba_msg
*/
#include <dballe/msg/msg.h>
#include <vector>
#include <memory>
namespace dballe {
struct CSVReader;
/** Dynamic array of dba_msg */
struct Msgs : public std::vector<Msg*>
{
Msgs();
Msgs(const Msgs& msgs);
~Msgs();
Msgs& operator=(const Msgs& msgs);
/**
* Append a copy of the message to the array.
*
* @param msg
* The message to append.
*/
void acquire(const Msg& msg);
/**
* Append a message to the array, taking over its memory management.
*
* @param msg
* The message to append. The Msgs will take over memory
* management for it.
*/
void acquire(std::auto_ptr<Msg> msg);
/**
* Remove all messages
*/
void clear();
/**
* Read data from a CSV input.
*
* Reading stops when Report changes.
*
* @return true if some CSV data has been read, false on EOF
*/
bool from_csv(CSVReader& in);
/**
* Output in CSV format
*/
void to_csv(std::ostream& out) const;
/**
* Dump all the contents of the message to the given stream
*
* @param out
* The stream to dump the contents of the dba_msg to.
*/
void print(FILE* out) const;
/**
* Compute the differences between two Msgs
*
* Details of the differences found will be formatted using the notes
* system (@see notes.h).
*
* @param msgs
* Msgs to compare to
* @returns
* The number of differences found
*/
unsigned diff(const Msgs& msgs) const;
};
namespace msg {
struct AcquireMessages : public MsgConsumer
{
Msgs& out;
AcquireMessages(Msgs& out) : out(out) {}
void operator()(std::auto_ptr<Msg> msg)
{
out.acquire(msg);
}
};
}
/**
* Match adapter for Msgs
*/
struct MatchedMsgs : public Matched
{
const Msgs& m;
MatchedMsgs(const Msgs& m);
~MatchedMsgs();
virtual matcher::Result match_var_id(int val) const;
virtual matcher::Result match_station_id(int val) const;
virtual matcher::Result match_station_wmo(int block, int station=-1) const;
virtual matcher::Result match_date(const int* min, const int* max) const;
virtual matcher::Result match_coords(int latmin, int latmax, int lonmin, int lonmax) const;
virtual matcher::Result match_rep_memo(const char* memo) const;
};
}
/* vim:set ts=4 sw=4: */
#endif
|