OpenASIP  2.0
HDBBrowserInfoPanel.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 HDBBrowserInfoPanel.cc
26  *
27  * Implementation of HDBBrowserInfoPanel class.
28  *
29  * @author Veli-Pekka Jääskeläinen 2006 (vjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #include <iostream>
34 #include <string>
35 #include <sstream>
36 #include "HDBBrowserInfoPanel.hh"
37 #include "HDBEditor.hh"
38 #include "HDBBrowserWindow.hh"
39 #include "WxConversion.hh"
40 #include "HDBToHtml.hh"
41 #include "Application.hh"
42 
43 using namespace HDB;
44 
45 /**
46  * The Constructor.
47  *
48  * @param parent Parent window of the panel.
49  * @param id Window ientifier for the panel.
50  */
51 HDBBrowserInfoPanel::HDBBrowserInfoPanel(wxWindow* parent, wxWindowID id) :
52  wxHtmlWindow(parent, id),
53  htmlGen_(NULL) {
54 }
55 
56 /**
57  * The Destructor.
58  */
60  if (htmlGen_ != NULL) {
61  delete htmlGen_;
62  htmlGen_ = NULL;
63  }
64 }
65 
66 void
67 HDBBrowserInfoPanel::OnLinkClicked(const wxHtmlLinkInfo& link) {
68  wxString href = link.GetHref();
69  wxGetApp().browser()->openLink(href);
70 }
71 
72 /**
73  * Sets the HDB.
74  *
75  * @param hdb HDB to generate html from.
76  */
77 void
79  if (htmlGen_ != NULL) {
80  delete htmlGen_;
81  }
82  htmlGen_ = new HDBToHtml(hdb);
83 }
84 
85 /**
86  * Clears the panel contents.
87  */
88 void
90  SetPage(_T("<html><body></body></html>"));
91 }
92 
93 /**
94  * Displays details of an FU entry in the panel.
95  *
96  * @param id ID of the FU entry.
97  */
98 void
100  assert(htmlGen_ != NULL);
101  std::stringstream stream;
102  htmlGen_->fuEntryToHtml(id, stream);
103  std::string page = stream.str();
104  SetPage(WxConversion::toWxString(page));
105 }
106 
107 
108 /**
109  * Displays details of a RF entry in the panel.
110  *
111  * @param id ID of the register file entry.
112  */
113 void
115  assert(htmlGen_ != NULL);
116  std::stringstream stream;
117  htmlGen_->rfEntryToHtml(id, stream);
118  std::string page = stream.str();
119  SetPage(WxConversion::toWxString(page));
120 }
121 
122 /**
123  * Displays details of a bus entry in the panel.
124  *
125  * @param id ID of the bus entry.
126  */
127 void
129  assert(htmlGen_ != NULL);
130  std::stringstream stream;
131  htmlGen_->busEntryToHtml(id, stream);
132  std::string page = stream.str();
133  SetPage(WxConversion::toWxString(page));
134 }
135 
136 /**
137  * Displays details of a socket entry in the panel.
138  *
139  * @param id ID of the socket entry.
140  */
141 void
143  assert(htmlGen_ != NULL);
144  std::stringstream stream;
145  htmlGen_->socketEntryToHtml(id, stream);
146  std::string page = stream.str();
147  SetPage(WxConversion::toWxString(page));
148 }
149 
150 
151 /**
152  * Displays details of an FU architecture in the panel.
153  *
154  * @param id ID of the FU architecture.
155  */
156 void
158  assert(htmlGen_ != NULL);
159  std::stringstream stream;
160  htmlGen_->fuArchToHtml(id, stream);
161  std::string page = stream.str();
162  SetPage(WxConversion::toWxString(page));
163 }
164 
165 /**
166  * Displays details of a RF architecture in the panel.
167  *
168  * @param id ID of the register file architecture.
169  */
170 void
172  assert(htmlGen_ != NULL);
173  std::stringstream stream;
174  htmlGen_->rfArchToHtml(id, stream);
175  std::string page = stream.str();
176  SetPage(WxConversion::toWxString(page));
177 }
178 
179 
180 /**
181  * Displays details of an FU implementation in the panel.
182  *
183  * @param id ID of the FU implementation.
184  */
185 void
187  assert(htmlGen_ != NULL);
188  std::stringstream stream;
189  htmlGen_->fuImplToHtml(id, stream);
190  std::string page = stream.str();
191  SetPage(WxConversion::toWxString(page));
192 }
193 
194 
195 /**
196  * Displays details of a RF implementation in the panel.
197  *
198  * @param id ID of the RF implementation.
199  */
200 void
202  assert(htmlGen_ != NULL);
203  std::stringstream stream;
204  htmlGen_->rfImplToHtml(id, stream);
205  std::string page = stream.str();
206  SetPage(WxConversion::toWxString(page));
207 }
208 
209 /**
210  * Displays details of a cost function plugin in the panel.
211  *
212  * @param id ID of the cost function plugin.
213  */
214 void
216  assert(htmlGen_ != NULL);
217  std::stringstream stream;
218  htmlGen_->costFunctionPluginToHtml(id, stream);
219  std::string page = stream.str();
220  SetPage(WxConversion::toWxString(page));
221 }
222 
223 /**
224  * Displays details of a FUGEN oparation in the panel.
225  *
226  * @param id ID of the FUGEN operation plugin.
227  */
228 void
230  assert(htmlGen_ != NULL);
231  std::stringstream stream;
233  std::string page = stream.str();
234  SetPage(WxConversion::toWxString(page));
235 }
236 
237 /**
238  * Displays details of a FUGEN resource in the panel.
239  *
240  * @param id ID of the FUGEN resource plugin.
241  */
242 void
244  assert(htmlGen_ != NULL);
245  std::stringstream stream;
247  std::string page = stream.str();
248  SetPage(WxConversion::toWxString(page));
249 }
HDBToHtml::rfArchToHtml
void rfArchToHtml(RowID id, std::ostream &stream)
Definition: HDBToHtml.cc:469
HDBBrowserInfoPanel::displayRFEntry
void displayRFEntry(RowID id)
Definition: HDBBrowserInfoPanel.cc:114
HDBBrowserInfoPanel::displayRFImplementation
void displayRFImplementation(RowID id)
Definition: HDBBrowserInfoPanel.cc:201
WxConversion::toWxString
static wxString toWxString(const std::string &source)
HDBToHtml::costFunctionPluginToHtml
void costFunctionPluginToHtml(RowID id, std::ostream &stream)
Definition: HDBToHtml.cc:900
HDBBrowserWindow.hh
HDB
Definition: CostDatabase.hh:49
HDBEditor.hh
HDBToHtml.hh
HDBBrowserInfoPanel::OnLinkClicked
virtual void OnLinkClicked(const wxHtmlLinkInfo &link)
Definition: HDBBrowserInfoPanel.cc:67
HDBBrowserInfoPanel::displayFUEntry
void displayFUEntry(RowID id)
Definition: HDBBrowserInfoPanel.cc:99
RowID
int RowID
Type definition of row ID in relational databases.
Definition: DBTypes.hh:37
HDBToHtml::busEntryToHtml
void busEntryToHtml(RowID id, std::ostream &stream)
Definition: HDBToHtml.cc:250
HDBToHtml::rfEntryToHtml
void rfEntryToHtml(RowID id, std::ostream &stream)
Definition: HDBToHtml.cc:177
HDBToHtml::fuArchToHtml
void fuArchToHtml(RowID id, std::ostream &stream)
Definition: HDBToHtml.cc:328
HDBBrowserInfoPanel::~HDBBrowserInfoPanel
virtual ~HDBBrowserInfoPanel()
Definition: HDBBrowserInfoPanel.cc:59
HDBBrowserInfoPanel::displayFUImplementation
void displayFUImplementation(RowID id)
Definition: HDBBrowserInfoPanel.cc:186
HDBBrowserInfoPanel::setHDB
void setHDB(const HDB::HDBManager &hdb)
Definition: HDBBrowserInfoPanel.cc:78
HDBBrowserInfoPanel::displayOperationImplementationResource
void displayOperationImplementationResource(RowID id)
Definition: HDBBrowserInfoPanel.cc:243
assert
#define assert(condition)
Definition: Application.hh:86
HDBToHtml::OperationImplementationToHtml
void OperationImplementationToHtml(RowID id, std::ostream &stream)
Definition: HDBToHtml.cc:986
HDBBrowserInfoPanel::displayCostFunctionPlugin
void displayCostFunctionPlugin(RowID id)
Definition: HDBBrowserInfoPanel.cc:215
Application.hh
HDB::HDBManager
Definition: HDBManager.hh:82
HDBBrowserInfoPanel::displayRFArchitecture
void displayRFArchitecture(RowID id)
Definition: HDBBrowserInfoPanel.cc:171
HDBToHtml::fuImplToHtml
void fuImplToHtml(RowID id, std::ostream &stream)
Definition: HDBToHtml.cc:539
HDBBrowserInfoPanel::displayFUArchitecture
void displayFUArchitecture(RowID id)
Definition: HDBBrowserInfoPanel.cc:157
HDBBrowserInfoPanel.hh
HDBToHtml::rfImplToHtml
void rfImplToHtml(RowID id, std::ostream &stream)
Definition: HDBToHtml.cc:720
HDBBrowserInfoPanel::displaySocketEntry
void displaySocketEntry(RowID id)
Definition: HDBBrowserInfoPanel.cc:142
HDBBrowserInfoPanel::displayOperationImplementation
void displayOperationImplementation(RowID id)
Definition: HDBBrowserInfoPanel.cc:229
HDBToHtml::fuEntryToHtml
void fuEntryToHtml(RowID id, std::ostream &stream)
Definition: HDBToHtml.cc:103
HDBBrowserInfoPanel::HDBBrowserInfoPanel
HDBBrowserInfoPanel(wxWindow *parent, wxWindowID id)
Definition: HDBBrowserInfoPanel.cc:51
WxConversion.hh
HDBBrowserInfoPanel::htmlGen_
HDBToHtml * htmlGen_
HDB to HTML generator.
Definition: HDBBrowserInfoPanel.hh:73
HDBBrowserInfoPanel::clear
void clear()
Definition: HDBBrowserInfoPanel.cc:89
HDBToHtml
Definition: HDBToHtml.hh:47
HDBToHtml::socketEntryToHtml
void socketEntryToHtml(RowID id, std::ostream &stream)
Definition: HDBToHtml.cc:289
HDBToHtml::OperationImplementationResourceToHtml
void OperationImplementationResourceToHtml(RowID id, std::ostream &stream)
Definition: HDBToHtml.cc:1003
HDBBrowserInfoPanel::displayBusEntry
void displayBusEntry(RowID id)
Definition: HDBBrowserInfoPanel.cc:128