OpenASIP 2.2
Loading...
Searching...
No Matches
DesignSpaceExplorerPlugin.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 DesignSpaceExplorerPlugin.hh
26 *
27 * Declaration of DesignSpaceExplorerPlugin class.
28 *
29 * @author Jari Mäntyneva 2007 (jari.mantyneva-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#ifndef TTA_DESIGN_SPACE_EXPLORER_PLUGIN_HH
34#define TTA_DESIGN_SPACE_EXPLORER_PLUGIN_HH
35
36#include <string>
37#include <map>
38
41
42#include "Exception.hh"
43#include "Application.hh"
44
45
46
47/**
48 * A base interface for all classes that implement pluggable
49 * design space explorer algorithms.
50 *
51 * Plugins are allowed to store state data to itself, thus, the plugin
52 * instances are not allowed to be "recycled" for multiple uses, but a
53 * new instance should be created always.
54 */
56public:
57
59
60 virtual bool requiresStartingPointArchitecture() const = 0;
61 virtual bool producesArchitecture() const = 0;
62 virtual bool requiresHDB() const = 0;
63 virtual bool requiresSimulationData() const = 0;
64 virtual bool requiresApplication() const { return true; }
65
66 typedef std::pair<std::string,
68 typedef std::map<std::string,
70 typedef std::map<std::string,
72 typedef std::map<std::string,
74
75 virtual void giveParameter(
76 const std::string& name, const std::string& value);
77
78 virtual inline std::string description() const;
79 virtual std::string name() const;
80 virtual void setPluginName(const std::string& pluginName);
81
82 virtual std::vector<RowID> explore(
83 const RowID& startPointConfigurationID,
84 const unsigned int& maxIter = 0);
85
86 virtual bool hasParameter(const std::string& paramName) const;
87
89
90 inline void addParameter(
93 bool compulsory = true,
94 TCEString defaultValue = "",
96
97 template <typename T>
98 void readCompulsoryParameter(const std::string paramName, T& param) const;
99
100 template <typename T>
101 void readOptionalParameter(const std::string paramName, T& param) const;
102
103 template <typename RT>
104 RT parameterValue(const std::string& paramName) const;
105
106 virtual bool booleanValue(const std::string& parameter) const;
107
108protected:
110
111 void checkParameters() const;
112
113 /// the name of the explorer plugin
114 std::string pluginName_;
115 /// Parameters for the plugin.
117};
118
120
121
122/**
123 * Exports the given class as a DesignSpaceExplorer plugin.
124 */
125#define EXPORT_DESIGN_SPACE_EXPLORER_PLUGIN(PLUGIN_NAME__) \
126extern "C" { \
127 DesignSpaceExplorerPlugin* create_explorer_plugin_##PLUGIN_NAME__() { \
128 PLUGIN_NAME__* instance = new PLUGIN_NAME__(); \
129 instance->setPluginName(#PLUGIN_NAME__);\
130 return instance;\
131 }\
132 void delete_explorer_plugin_##PLUGIN_NAME__(\
133 DesignSpaceExplorerPlugin* target) { \
134 delete target;\
135 }\
136}
137
138/**
139 * Defines the description string for the plugin.
140 *
141 * Can be used only inside a plugin class definition.
142 *
143 * @param TEXT__ The description string.
144 */
145#define PLUGIN_DESCRIPTION(TEXT__) \
146public:\
147 virtual std::string description() const { return TEXT__; }
148
149#endif
int RowID
Type definition of row ID in relational databases.
Definition DBTypes.hh:37
ExplorerPluginParameterType
std::map< std::string, ExplorerPluginParameter >::iterator PMIt
virtual std::string description() const
RT parameterValue(const std::string &paramName) const
virtual bool requiresStartingPointArchitecture() const =0
virtual bool requiresHDB() const =0
std::pair< std::string, ExplorerPluginParameter > Parameter
virtual bool requiresSimulationData() const =0
void readCompulsoryParameter(const std::string paramName, T &param) const
virtual bool hasParameter(const std::string &paramName) const
virtual void setPluginName(const std::string &pluginName)
void readOptionalParameter(const std::string paramName, T &param) const
virtual std::string name() const
virtual bool producesArchitecture() const =0
std::map< std::string, ExplorerPluginParameter > ParameterMap
void addParameter(TCEString name, ExplorerPluginParameterType type, bool compulsory=true, TCEString defaultValue="", TCEString description="")
ParameterMap parameters_
Parameters for the plugin.
std::map< std::string, ExplorerPluginParameter >::const_iterator PMCIt
std::string pluginName_
the name of the explorer plugin
virtual std::vector< RowID > explore(const RowID &startPointConfigurationID, const unsigned int &maxIter=0)
virtual bool booleanValue(const std::string &parameter) const
virtual void giveParameter(const std::string &name, const std::string &value)