libdballe
5.18
Main Page
Modules
Data Structures
Files
File List
Globals
dballe
core
matcher.h
1
/*
2
* dballe/matcher - Local query match infrastructure
3
*
4
* Copyright (C) 2009--2010 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, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License along
17
* with this program; if not, write to the Free Software Foundation, Inc.,
18
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
*
20
* Author: Enrico Zini <enrico@enricozini.com>
21
*/
22
23
#ifndef DBALLE_CORE_MATCHER_H
24
#define DBALLE_CORE_MATCHER_H
25
26
#include <memory>
27
28
namespace
dballe {
29
struct
Record;
30
31
namespace
matcher {
32
33
enum
Result {
34
MATCH_YES,
// Item matches
35
MATCH_NO,
// Item does not match
36
MATCH_NA
// Match not applicable to this item
37
};
38
39
}
40
48
struct
Matched
49
{
50
virtual
~
Matched
() {}
51
57
virtual
matcher::Result
match_var_id
(
int
val)
const
;
58
64
virtual
matcher::Result
match_station_id
(
int
val)
const
;
65
71
virtual
matcher::Result
match_station_wmo
(
int
block,
int
station=-1)
const
;
72
79
virtual
matcher::Result
match_date
(
const
int
* min,
const
int
* max)
const
;
80
87
virtual
matcher::Result
match_coords
(
int
latmin,
int
latmax,
int
lonmin,
int
lonmax)
const
;
88
94
virtual
matcher::Result
match_rep_memo
(
const
char
* memo)
const
;
95
102
static
matcher::Result
date_in_range
(
const
int
* date,
const
int
* min,
const
int
* max);
103
110
static
matcher::Result
int_in_range
(
int
val,
int
min,
int
max);
111
};
112
113
struct
Matcher
114
{
115
virtual
~
Matcher
() {}
116
117
virtual
matcher::Result match(
const
Matched
& item)
const
= 0;
118
virtual
void
to_record(
dballe::Record
& query)
const
= 0;
119
120
static
std::auto_ptr<Matcher> create(
const
dballe::Record
& query);
121
};
122
123
}
124
125
/* vim:set ts=4 sw=4: */
126
#endif
Generated on Wed Mar 19 2014 05:22:59 for libdballe by
1.8.1.2