OpenASIP  2.0
CostDBEntry.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 CostDBEntry.hh
26  *
27  * Declaration of CostDBEntry 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_COSTDB_ENTRY_HH
35 #define TTA_COSTDB_ENTRY_HH
36 
37 
38 #include <string>
39 
40 #include "CostDBEntryKey.hh"
41 #include "CostDBEntryStats.hh"
42 #include "EntryKeyField.hh"
43 #include "EntryKeyFieldProperty.hh"
44 #include "Exception.hh"
45 
46 
47 /**
48  * Represents an entry containing a key and statistics.
49  *
50  * Key means the properties of an entry that are used as a search key.
51  */
52 class CostDBEntry {
53 public:
56  const CostDBEntry& entry1,
57  const CostDBEntry& entry2,
58  const EntryKeyField& weighter);
59  virtual ~CostDBEntry();
60  CostDBEntry* copy() const;
61 
63  EntryKeyField keyFieldOfType(std::string type) const;
64  const EntryKeyProperty* type() const;
65 
66  void replaceField(EntryKeyField* newField);
67  int fieldCount() const;
68  const EntryKeyField& field(int index) const;
69  bool isEqualKey(const CostDBEntry& entry) const;
70 
71  void addStatistics(CostDBEntryStats* newStats);
72  int statisticsCount() const;
73  const CostDBEntryStats& statistics(int index) const;
74 
75 private:
76  /// Type definition for a table of statistics.
77  typedef std::vector<CostDBEntryStats*> StatsTable;
78 
79  /// Key of the entry.
81  /// Statistics of the entry.
83 
84  /// Copying not allowed.
85  CostDBEntry(const CostDBEntry&);
86  /// Assignment not allowed.
88 };
89 
90 #endif
CostDBEntry::replaceField
void replaceField(EntryKeyField *newField)
Definition: CostDBEntry.cc:192
CostDBEntry::statisticsCount
int statisticsCount() const
Definition: CostDBEntry.cc:224
EntryKeyFieldProperty
Definition: EntryKeyFieldProperty.hh:47
Exception.hh
CostDBEntry::fieldCount
int fieldCount() const
Definition: CostDBEntry.cc:169
CostDBEntry::addStatistics
void addStatistics(CostDBEntryStats *newStats)
Definition: CostDBEntry.cc:213
EntryKeyField
Definition: EntryKeyField.hh:45
CostDBEntry::copy
CostDBEntry * copy() const
Definition: CostDBEntry.cc:120
CostDBEntryStats.hh
CostDBEntry::entryStats_
StatsTable entryStats_
Statistics of the entry.
Definition: CostDBEntry.hh:82
CostDBEntry::StatsTable
std::vector< CostDBEntryStats * > StatsTable
Type definition for a table of statistics.
Definition: CostDBEntry.hh:77
CostDBEntry
Definition: CostDBEntry.hh:52
CostDBEntry::type
const EntryKeyProperty * type() const
Definition: CostDBEntry.cc:137
CostDBEntry::entryKey_
CostDBEntryKey * entryKey_
Key of the entry.
Definition: CostDBEntry.hh:80
EntryKeyProperty
Definition: EntryKeyProperty.hh:57
CostDBEntry::operator=
CostDBEntry & operator=(const CostDBEntry &)
Assignment not allowed.
CostDBEntry::statistics
const CostDBEntryStats & statistics(int index) const
Definition: CostDBEntry.cc:236
CostDBEntry::~CostDBEntry
virtual ~CostDBEntry()
Definition: CostDBEntry.cc:99
CostDBEntryKey.hh
EntryKeyField.hh
CostDBEntryKey
Definition: CostDBEntryKey.hh:52
CostDBEntry::keyFieldOfType
EntryKeyField keyFieldOfType(const EntryKeyFieldProperty &type) const
Definition: CostDBEntry.cc:148
CostDBEntry::field
const EntryKeyField & field(int index) const
Definition: CostDBEntry.cc:182
CostDBEntryStats
Definition: CostDBEntryStats.hh:46
EntryKeyFieldProperty.hh
CostDBEntry::CostDBEntry
CostDBEntry(CostDBEntryKey *key)
Definition: CostDBEntry.cc:44
CostDBEntry::isEqualKey
bool isEqualKey(const CostDBEntry &entry) const
Definition: CostDBEntry.cc:203