OpenASIP  2.0
Matcher.hh
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.hh
26  *
27  * Declaration 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 #ifndef TTA_MATCHER_HH
35 #define TTA_MATCHER_HH
36 
37 
38 #include "CostDBEntry.hh"
39 #include "CostDBEntryKey.hh"
40 #include "EntryKeyFieldProperty.hh"
41 
42 
43 /**
44  * Interface for searching database entries.
45  *
46  * Search is based only on the information of one specific field of
47  * the entries. Using the interface for queries requires at first a
48  * QuickFilter() call and then a Filter() call.
49  */
50 class Matcher {
51 public:
52  Matcher(const EntryKeyFieldProperty* type);
53  virtual ~Matcher();
54 
55  /**
56  * Filters out unnecessary entries in linear time.
57  *
58  * @param searchKey Search key.
59  * @param components Entries from which to find. Updated to contain
60  * entries that matched the search request.
61  */
62  virtual void quickFilter(
63  const CostDBEntryKey& searchKey,
64  CostDBTypes::EntryTable& components) = 0;
65 
66  /**
67  * Searches for database entries that match the search key.
68  */
69  virtual void filter(const CostDBEntryKey&, CostDBTypes::EntryTable&) = 0;
70 
71 protected:
72  const EntryKeyFieldProperty* fieldType() const;
74  const EntryKeyFieldProperty* type,
75  const CostDBEntry& entry1,
76  const CostDBEntry& entry2) const;
77 
78 private:
79  /// Copying not allowed.
80  Matcher(const Matcher&);
81  /// Assignment not allowed.
82  Matcher& operator=(const Matcher&);
83 
84  /// Type of the field on which filtering is applied to.
86 };
87 
88 #include "Matcher.icc"
89 
90 #endif
EntryKeyFieldProperty
Definition: EntryKeyFieldProperty.hh:47
Matcher::Matcher
Matcher(const EntryKeyFieldProperty *type)
Definition: Matcher.cc:44
Matcher::~Matcher
virtual ~Matcher()
Definition: Matcher.cc:51
CostDBTypes::EntryTable
std::vector< CostDBEntry * > EntryTable
Table of database entries.
Definition: CostDBTypes.hh:111
Matcher::operator=
Matcher & operator=(const Matcher &)
Assignment not allowed.
Matcher.icc
Matcher::filter
virtual void filter(const CostDBEntryKey &, CostDBTypes::EntryTable &)=0
Matcher::fieldType
const EntryKeyFieldProperty * fieldType() const
Matcher::fieldType_
const EntryKeyFieldProperty * fieldType_
Type of the field on which filtering is applied to.
Definition: Matcher.hh:85
CostDBEntry
Definition: CostDBEntry.hh:52
Matcher::onlyThisFieldDiffers
bool onlyThisFieldDiffers(const EntryKeyFieldProperty *type, const CostDBEntry &entry1, const CostDBEntry &entry2) const
Definition: Matcher.cc:64
CostDBEntry.hh
Matcher::quickFilter
virtual void quickFilter(const CostDBEntryKey &searchKey, CostDBTypes::EntryTable &components)=0
CostDBEntryKey.hh
Matcher
Definition: Matcher.hh:50
CostDBEntryKey
Definition: CostDBEntryKey.hh:52
EntryKeyFieldProperty.hh