OpenASIP 2.2
Loading...
Searching...
No Matches
CostDatabase.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 CostDatabase.hh
26 *
27 * Declaration of CostDatabase 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_COST_DATABASE_HH
35#define TTA_COST_DATABASE_HH
36
37
38#include <vector>
39#include <map>
40#include <string>
41#include "CompilerWarnings.hh"
42IGNORE_CLANG_WARNING("-Wkeyword-macro")
43#include <boost/regex.hpp>
45
46#include "CostDBTypes.hh"
47#include "Exception.hh"
48
49namespace HDB {
50 class HDBManager;
51}
52
53class CostDBEntry;
54class SearchStrategy;
57class CostDBEntryKey;
59
60
61/**
62 * Stores database entries and search strategy for making queries.
63 */
65public:
66 static CostDatabase& instance(const HDB::HDBManager& hdb);
67 virtual ~CostDatabase();
68
70 void buildRegisterFiles(const std::string& rfEstimatorPluginName);
71 void buildFunctionUnits(const std::string& fuEstimatorPluginName);
72 void buildBuses(const std::string& busEstimatorPluginName);
73 void buildSockets(const std::string& socketEstimatorPluginName);
76 bool isBusesBuilt();
77 bool isSocketsBuilt();
78
79 void insertEntry(CostDBEntry* entry);
80 void setSearchStrategy(SearchStrategy* strategy);
82 const CostDBEntryKey& searchKey,
83 const CostDBTypes::MatchTypeTable& match) const;
84
85private:
86 /// CostDatabase must be created with instance() method.
87 CostDatabase(const HDB::HDBManager& hdb);
88
89 /// Finds string matches using regular expressions.
90 boost::smatch getValues(const std::string& text, const std::string& regex);
91
92 /// Value type for map of search types.
93 typedef std::pair<
95 /// Map of database entries according to entry type.
96 typedef std::map<
98 /// Search type for each entry type.
99 typedef std::map<
101
102 /// Search strategy used for queries.
104 /// Database entries.
106 /// HDB used for creating cost database.
108 /// Flag to note is register files built
110 /// Flag to note is function units built
112 /// Flag to note is buses built
114 /// Flag to note is sockets built
116
117 /// Unique instance of the class.
119 /// Registry of CostDatabases.
121 /// Copying not allowed.
123 /// Assignment not allowed.
125};
126
127#endif
#define POP_CLANG_DIAGS
#define IGNORE_CLANG_WARNING(X)
std::vector< MatchType * > MatchTypeTable
Table of types of match.
std::vector< CostDBEntry * > EntryTable
Table of database entries.
CostDatabase(const CostDatabase &)
Copying not allowed.
boost::smatch getValues(const std::string &text, const std::string &regex)
Finds string matches using regular expressions.
void buildBuses(const std::string &busEstimatorPluginName)
static CostDatabase & instance(const HDB::HDBManager &hdb)
void buildSockets(const std::string &socketEstimatorPluginName)
void setSearchStrategy(SearchStrategy *strategy)
void buildRegisterFiles(const std::string &rfEstimatorPluginName)
void buildFunctionUnits(const std::string &fuEstimatorPluginName)
void buildDefaultCostDatabase()
static CostDatabase * instance_
Unique instance of the class.
CostDatabaseRegistry * registry_
Registry of CostDatabases.
bool busesBuilt_
Flag to note is buses built.
std::map< const EntryKeyProperty *, CostDBTypes::MatchTypeTable > MatchTypeMap
Search type for each entry type.
bool isSocketsBuilt()
bool isRegisterFilesBuilt()
CostDatabase & operator=(const CostDatabase &)
Assignment not allowed.
virtual ~CostDatabase()
std::map< const EntryKeyProperty *, CostDBTypes::EntryTable > EntryMap
Map of database entries according to entry type.
bool socketsBuilt_
Flag to note is sockets built.
bool functionUnitsBuilt_
Flag to note is function units built.
void insertEntry(CostDBEntry *entry)
bool registerFilesBuilt_
Flag to note is register files built.
bool isBusesBuilt()
const HDB::HDBManager & hdb_
HDB used for creating cost database.
EntryMap entries_
Database entries.
CostDBTypes::EntryTable search(const CostDBEntryKey &searchKey, const CostDBTypes::MatchTypeTable &match) const
bool isFunctionUnitsBuilt()
std::pair< const EntryKeyProperty *, CostDBTypes::MatchTypeTable > MatchTypeMapType
Value type for map of search types.
SearchStrategy * searchStrategy_
Search strategy used for queries.