OpenASIP  2.0
HDBBrowserWindow.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 HDBBrowserWindow.hh
26  *
27  * Declaration of HDBBrowserWindow class.
28  *
29  * @author Veli-Pekka Jääskeläinen 2006 (vjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_HDB_BROWSER_WINDOW_HH
34 #define TTA_HDB_BROWSER_WINDOW_HH
35 
36 #include <map>
37 #include <wx/wx.h>
38 #include <wx/treectrl.h>
39 #include <wx/panel.h>
40 #include "Exception.hh"
41 #include "DBTypes.hh"
42 
44 
45 namespace HDB {
46  class CachedHDBManager;
47 }
48 
49 namespace TTAMachine {
50  class FunctionUnit;
51 }
52 
53 /**
54  * Window for browsing an HDB.
55  *
56  * Displays a tree-view of the HDB, and an info panel which shows details
57  * of the element selected in the tree-view.
58  */
59 class HDBBrowserWindow : public wxPanel {
60 public:
61  HDBBrowserWindow(wxWindow* parent, wxWindowID id);
62  virtual ~HDBBrowserWindow();
63  void setHDBManager(HDB::CachedHDBManager& manager);
64  void update();
65 
70  bool isFUEntrySelected();
71  bool isRFEntrySelected();
72  bool isBusEntrySelected();
73  bool isSocketEntrySelected();
77 
89 
90  void selectRFArchitecture(int id);
91  void selectFUArchitecture(int id);
92  void selectRFImplementation(int id);
93  void selectFUImplementation(int id);
94  void selectFUEntry(int id);
95  void selectRFEntry(int id);
96  void selectBusEntry(int id);
97  void selectSocketEntry(int id);
98  void selectCostFunctionPlugin(int id);
99  void openLink(const wxString& link);
100 
101 private:
102  /// HDB to display in the browser.
104  /// Tree widget displayign the HDB hierarchy.
105  wxTreeCtrl* tree_;
106 
107  void onItemSelected(wxTreeEvent& event);
108  void onRMBClick(wxTreeEvent& event);
109  wxString fuArchLabel(const TTAMachine::FunctionUnit& fu) const;
110 
111  /// Widget window IDs.
112  enum {
113  ID_TREE_VIEW = 20000
114  };
115 
116  /// Map of rf architecture RowIDs to tree item IDs.
117  std::map<RowID, wxTreeItemId> rfArchitectures_;
118  /// Map of rf implementation RowIDs to tree item IDs.
119  std::map<RowID, wxTreeItemId> rfImplementations_;
120  /// Map of fu architecture RowIDs to tree item IDs.
121  std::map<RowID, wxTreeItemId> fuArchitectures_;
122  /// Map of fu implementation RowIDs to tree item IDs.
123  std::map<RowID, wxTreeItemId> fuImplementations_;
124  /// Map of fu entry RowIDs to tree item IDs.
125  std::map<RowID, wxTreeItemId> fuEntries_;
126  /// Map of rf entry RowIDs to tree item IDs.
127  std::map<RowID, wxTreeItemId> rfEntries_;
128  /// Map of bus entry RowIDs to tree item IDs.
129  std::map<RowID, wxTreeItemId> busEntries_;
130  /// Map of socket entry RowIDs to tree item IDs.
131  std::map<RowID, wxTreeItemId> socketEntries_;
132  /// Map of cost function plugin RowIDs to tree item IDs.
133  std::map<RowID, wxTreeItemId> costPlugins_;
134 
135  /// Info panel widget for displaying the selected element information.
137 
138  DECLARE_EVENT_TABLE()
139 };
140 
141 #endif
HDBBrowserWindow::update
void update()
Definition: HDBBrowserWindow.cc:109
HDBBrowserWindow::fuArchLabel
wxString fuArchLabel(const TTAMachine::FunctionUnit &fu) const
Definition: HDBBrowserWindow.cc:864
HDBBrowserWindow::fuImplementations_
std::map< RowID, wxTreeItemId > fuImplementations_
Map of fu implementation RowIDs to tree item IDs.
Definition: HDBBrowserWindow.hh:123
HDB
Definition: CostDatabase.hh:49
HDBBrowserWindow
Definition: HDBBrowserWindow.hh:59
HDBBrowserWindow::selectRFArchitecture
void selectRFArchitecture(int id)
Definition: HDBBrowserWindow.cc:724
Exception.hh
HDBBrowserWindow::isRFArchitectureSelected
bool isRFArchitectureSelected()
Definition: HDBBrowserWindow.cc:353
HDBBrowserWindow::rfEntries_
std::map< RowID, wxTreeItemId > rfEntries_
Map of rf entry RowIDs to tree item IDs.
Definition: HDBBrowserWindow.hh:127
HDBBrowserWindow::selectBusEntry
void selectBusEntry(int id)
Definition: HDBBrowserWindow.cc:679
HDBBrowserWindow::isRFImplementationSelected
bool isRFImplementationSelected()
Definition: HDBBrowserWindow.cc:376
HDBBrowserWindow::manager_
HDB::CachedHDBManager * manager_
HDB to display in the browser.
Definition: HDBBrowserWindow.hh:103
HDBBrowserWindow::rfImplementations_
std::map< RowID, wxTreeItemId > rfImplementations_
Map of rf implementation RowIDs to tree item IDs.
Definition: HDBBrowserWindow.hh:119
HDBBrowserWindow::HDBBrowserWindow
HDBBrowserWindow(wxWindow *parent, wxWindowID id)
Definition: HDBBrowserWindow.cc:70
RowID
int RowID
Type definition of row ID in relational databases.
Definition: DBTypes.hh:37
HDBBrowserWindow::rfArchitectures_
std::map< RowID, wxTreeItemId > rfArchitectures_
Map of rf architecture RowIDs to tree item IDs.
Definition: HDBBrowserWindow.hh:117
HDBBrowserWindow::selectFUImplementation
void selectFUImplementation(int id)
Definition: HDBBrowserWindow.cc:739
HDBBrowserWindow::selectRFImplementation
void selectRFImplementation(int id)
Definition: HDBBrowserWindow.cc:754
HDB::CachedHDBManager
Definition: CachedHDBManager.hh:63
HDBBrowserWindow::isSocketEntrySelected
bool isSocketEntrySelected()
Definition: HDBBrowserWindow.cc:417
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
HDBBrowserWindow::selectFUEntry
void selectFUEntry(int id)
Definition: HDBBrowserWindow.cc:649
DBTypes.hh
HDBBrowserWindow::selectedOperationImplementationResource
RowID selectedOperationImplementationResource()
Definition: HDBBrowserWindow.cc:632
HDBBrowserWindow::isBusEntrySelected
bool isBusEntrySelected()
Definition: HDBBrowserWindow.cc:407
HDBBrowserWindow::onItemSelected
void onItemSelected(wxTreeEvent &event)
Definition: HDBBrowserWindow.cc:782
HDBBrowserWindow::isFUEntrySelected
bool isFUEntrySelected()
Definition: HDBBrowserWindow.cc:387
HDBBrowserWindow::busEntries_
std::map< RowID, wxTreeItemId > busEntries_
Map of bus entry RowIDs to tree item IDs.
Definition: HDBBrowserWindow.hh:129
HDBBrowserWindow::selectCostFunctionPlugin
void selectCostFunctionPlugin(int id)
Definition: HDBBrowserWindow.cc:769
HDBBrowserWindow::selectedFUArchitecture
RowID selectedFUArchitecture()
Definition: HDBBrowserWindow.cc:466
HDBBrowserWindow::isOperationImplementationResourceSelected
bool isOperationImplementationResourceSelected()
Definition: HDBBrowserWindow.cc:439
HDBBrowserWindow::fuEntries_
std::map< RowID, wxTreeItemId > fuEntries_
Map of fu entry RowIDs to tree item IDs.
Definition: HDBBrowserWindow.hh:125
HDBBrowserWindow::selectedCostFunctionPlugin
RowID selectedCostFunctionPlugin()
Definition: HDBBrowserWindow.cc:598
HDBBrowserWindow::~HDBBrowserWindow
virtual ~HDBBrowserWindow()
Definition: HDBBrowserWindow.cc:89
HDBBrowserWindow::socketEntries_
std::map< RowID, wxTreeItemId > socketEntries_
Map of socket entry RowIDs to tree item IDs.
Definition: HDBBrowserWindow.hh:131
HDBBrowserInfoPanel
Definition: HDBBrowserInfoPanel.hh:49
HDBBrowserWindow::selectedRFImplementation
RowID selectedRFImplementation()
Definition: HDBBrowserWindow.cc:517
HDBBrowserWindow::costPlugins_
std::map< RowID, wxTreeItemId > costPlugins_
Map of cost function plugin RowIDs to tree item IDs.
Definition: HDBBrowserWindow.hh:133
HDBBrowserWindow::infoPanel_
HDBBrowserInfoPanel * infoPanel_
Info panel widget for displaying the selected element information.
Definition: HDBBrowserWindow.hh:136
HDBBrowserWindow::selectedOperationImplementation
RowID selectedOperationImplementation()
Definition: HDBBrowserWindow.cc:614
HDBBrowserWindow::selectedFUImplementation
RowID selectedFUImplementation()
Definition: HDBBrowserWindow.cc:500
HDBBrowserWindow::selectSocketEntry
void selectSocketEntry(int id)
Definition: HDBBrowserWindow.cc:694
HDBBrowserWindow::tree_
wxTreeCtrl * tree_
Tree widget displayign the HDB hierarchy.
Definition: HDBBrowserWindow.hh:105
HDBBrowserWindow::selectRFEntry
void selectRFEntry(int id)
Definition: HDBBrowserWindow.cc:664
HDBBrowserWindow::selectedRFEntry
RowID selectedRFEntry()
Definition: HDBBrowserWindow.cc:549
HDBBrowserWindow::openLink
void openLink(const wxString &link)
Definition: HDBBrowserWindow.cc:892
HDBBrowserWindow::selectedBusEntry
RowID selectedBusEntry()
Definition: HDBBrowserWindow.cc:565
HDBBrowserWindow::isFUArchitectureSelected
bool isFUArchitectureSelected()
Definition: HDBBrowserWindow.cc:343
HDBBrowserWindow::selectFUArchitecture
void selectFUArchitecture(int id)
Definition: HDBBrowserWindow.cc:709
HDBBrowserWindow::selectedSocketEntry
RowID selectedSocketEntry()
Definition: HDBBrowserWindow.cc:581
HDBBrowserWindow::isOperationImplementationSelected
bool isOperationImplementationSelected()
Definition: HDBBrowserWindow.cc:453
HDBBrowserWindow::onRMBClick
void onRMBClick(wxTreeEvent &event)
Definition: HDBBrowserWindow.cc:832
HDBBrowserWindow::ID_TREE_VIEW
@ ID_TREE_VIEW
Definition: HDBBrowserWindow.hh:113
TTAMachine
Definition: Assembler.hh:48
HDBBrowserWindow::setHDBManager
void setHDBManager(HDB::CachedHDBManager &manager)
Definition: HDBBrowserWindow.cc:99
HDBBrowserWindow::isFUImplementationSelected
bool isFUImplementationSelected()
Definition: HDBBrowserWindow.cc:364
HDBBrowserWindow::isCostFunctionPluginSelected
bool isCostFunctionPluginSelected()
Definition: HDBBrowserWindow.cc:428
HDBBrowserWindow::fuArchitectures_
std::map< RowID, wxTreeItemId > fuArchitectures_
Map of fu architecture RowIDs to tree item IDs.
Definition: HDBBrowserWindow.hh:121
HDBBrowserWindow::selectedFUEntry
RowID selectedFUEntry()
Definition: HDBBrowserWindow.cc:533
HDBBrowserWindow::isRFEntrySelected
bool isRFEntrySelected()
Definition: HDBBrowserWindow.cc:397
HDBBrowserWindow::selectedRFArchitecture
RowID selectedRFArchitecture()
Definition: HDBBrowserWindow.cc:483