OpenASIP
2.0
src
applibs
costdb
Matcher.cc
Go to the documentation of this file.
1
/*
2
Copyright (c) 2002-2009 Tampere University.
3
4
This file is part of TTA-Based Codesign Environment (TCE).
5
6
Permission is hereby granted, free of charge, to any person obtaining a
7
copy of this software and associated documentation files (the "Software"),
8
to deal in the Software without restriction, including without limitation
9
the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
and/or sell copies of the Software, and to permit persons to whom the
11
Software is furnished to do so, subject to the following conditions:
12
13
The above copyright notice and this permission notice shall be included in
14
all copies or substantial portions of the Software.
15
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
DEALINGS IN THE SOFTWARE.
23
*/
24
/**
25
* @file Matcher.cc
26
*
27
* Implementation of Matcher class.
28
*
29
* @author Tommi Rantanen 2003 (tommi.rantanen-no.spam-tut.fi)
30
* @author Jari Mäntyneva 2005 (jari.mantyneva-no.spam-tut.fi)
31
* @note rating: red
32
*/
33
34
#include "
Matcher.hh
"
35
36
37
/**
38
* Constructor.
39
*
40
* Marks the field type to which a search is aplied.
41
*
42
* @param type Type of the field.
43
*/
44
Matcher::Matcher
(
const
EntryKeyFieldProperty
* type) :
45
fieldType_(type) {
46
}
47
48
/**
49
* Destructor.
50
*/
51
Matcher::~Matcher
() {
52
}
53
54
/**
55
* Checks if only a specific field of two entries is different and all
56
* other fields have equal values.
57
*
58
* @param type Type of the field.
59
* @param entry1 An entry.
60
* @param entry2 An entry.
61
* @return True if only one field of two entries is different, otherwise false.
62
*/
63
bool
64
Matcher::onlyThisFieldDiffers
(
65
const
EntryKeyFieldProperty
* type,
66
const
CostDBEntry
& entry1,
67
const
CostDBEntry
& entry2)
const
{
68
69
for
(
int
i = 0; i < entry1.
fieldCount
(); i++) {
70
const
EntryKeyField
& j = entry1.
field
(i);
71
72
if
(!j.
isEqual
(entry2.
keyFieldOfType
(*j.
type
())) &&
73
!(j.
type
() == type)) {
74
75
return
false
;
76
}
77
}
78
return
true
;
79
}
EntryKeyFieldProperty
Definition:
EntryKeyFieldProperty.hh:47
Matcher::Matcher
Matcher(const EntryKeyFieldProperty *type)
Definition:
Matcher.cc:44
Matcher::~Matcher
virtual ~Matcher()
Definition:
Matcher.cc:51
CostDBEntry::fieldCount
int fieldCount() const
Definition:
CostDBEntry.cc:169
EntryKeyField
Definition:
EntryKeyField.hh:45
CostDBEntry
Definition:
CostDBEntry.hh:52
EntryKeyField::type
const EntryKeyFieldProperty * type() const
Matcher::onlyThisFieldDiffers
bool onlyThisFieldDiffers(const EntryKeyFieldProperty *type, const CostDBEntry &entry1, const CostDBEntry &entry2) const
Definition:
Matcher.cc:64
CostDBEntry::keyFieldOfType
EntryKeyField keyFieldOfType(const EntryKeyFieldProperty &type) const
Definition:
CostDBEntry.cc:148
CostDBEntry::field
const EntryKeyField & field(int index) const
Definition:
CostDBEntry.cc:182
EntryKeyField::isEqual
bool isEqual(const EntryKeyField &field) const
Definition:
EntryKeyField.cc:92
Matcher.hh
Generated by
1.8.17