OpenASIP  2.0
AddFUFromHDBDialog.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 AddFUFromHDBDialog.hh
26  *
27  * Declaration of AddFUFromHDBDialog 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_ADD_FU_FROM_HDB_DIALOG_HH
34 #define TTA_ADD_FU_FROM_HDB_DIALOG_HH
35 
36 #include <map>
37 #include <vector>
38 #include <string>
39 
40 #include <wx/wx.h>
41 #include <wx/listctrl.h>
42 #include <wx/timer.h>
43 
44 class Model;
45 class wxSearchCtrl;
46 
47 struct ListItemData {
48  int id;
49  int latency;
50  wxString operations;
51  int hdbId;
52  wxString path;
53 };
54 
55 namespace HDB {
56  class FUArchitecture;
57  class HDBManager;
58 }
59 
60 /**
61  * Dialog for adding register file architectures directly from HDB to the
62  * current machine.
63  */
64 class AddFUFromHDBDialog : public wxDialog {
65 public:
66  AddFUFromHDBDialog(wxWindow* parent, Model* model);
67  virtual ~AddFUFromHDBDialog();
68 
69 private:
70  virtual bool TransferDataToWindow();
71  wxSizer* createContents(wxWindow* parent, bool call_fit, bool set_sizer);
72  void onListSelectionChange(wxListEvent& event);
73  void onAdd(wxCommandEvent& event);
74  void onClose(wxCommandEvent& event);
75  bool loadHDB(const HDB::HDBManager& manager);
76  bool acceptToList(
77  const std::string hdbFilePath,
78  const HDB::FUArchitecture& arch,
79  const std::vector<std::string>& filterList);
80  void onFilterChange(wxCommandEvent& event);
81  void onFilterTimeOut(wxTimerEvent& event);
82  void onColumnClick(wxListEvent& event);
83  void setColumnImage(int col, int image);
84 
85  /// Model of the current adf file.
87  /// Immediate slot list widget.
88  wxListCtrl* list_;
89  /// Map of iu architectures displayed in the dialog list.
90  std::map<int, HDB::FUArchitecture*> fuArchitectures_;
91  /// The list filter text control.
92  wxSearchCtrl* filterCtrl_ = nullptr;
93  /// Keywords to filter HDB entries.
94  std::vector<std::string> filterPatterns_;
95  /// Timer to postpone filtering while typing filter patterns.
96  wxTimer filterTimer_;
97 
99  bool sortASC_;
100 
101  enum {
102  ID_LIST = 10000,
109  };
110 
111  /// File filter for HDB files.
112  static const wxString HDB_FILE_FILTER;
113 
114  DECLARE_EVENT_TABLE()
115 };
116 #endif
AddFUFromHDBDialog::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition: AddFUFromHDBDialog.cc:496
HDB::FUArchitecture
Definition: FUArchitecture.hh:55
AddFUFromHDBDialog::setColumnImage
void setColumnImage(int col, int image)
Definition: AddFUFromHDBDialog.cc:565
AddFUFromHDBDialog::acceptToList
bool acceptToList(const std::string hdbFilePath, const HDB::FUArchitecture &arch, const std::vector< std::string > &filterList)
Definition: AddFUFromHDBDialog.cc:308
AddFUFromHDBDialog::onColumnClick
void onColumnClick(wxListEvent &event)
Definition: AddFUFromHDBDialog.cc:536
HDB
Definition: CostDatabase.hh:49
AddFUFromHDBDialog::onListSelectionChange
void onListSelectionChange(wxListEvent &event)
Definition: AddFUFromHDBDialog.cc:374
AddFUFromHDBDialog
Definition: AddFUFromHDBDialog.hh:64
AddFUFromHDBDialog::sortASC_
bool sortASC_
Definition: AddFUFromHDBDialog.hh:99
ListItemData::operations
wxString operations
Definition: AddFUFromHDBDialog.hh:50
AddFUFromHDBDialog::list_
wxListCtrl * list_
Immediate slot list widget.
Definition: AddFUFromHDBDialog.hh:88
AddFUFromHDBDialog::ID_FILTER_LABEL
@ ID_FILTER_LABEL
Definition: AddFUFromHDBDialog.hh:103
AddFUFromHDBDialog::AddFUFromHDBDialog
AddFUFromHDBDialog(wxWindow *parent, Model *model)
Definition: AddFUFromHDBDialog.cc:131
AddFUFromHDBDialog::loadHDB
bool loadHDB(const HDB::HDBManager &manager)
Definition: AddFUFromHDBDialog.cc:229
AddFUFromHDBDialog::onFilterChange
void onFilterChange(wxCommandEvent &event)
Definition: AddFUFromHDBDialog.cc:353
AddFUFromHDBDialog::filterPatterns_
std::vector< std::string > filterPatterns_
Keywords to filter HDB entries.
Definition: AddFUFromHDBDialog.hh:94
ListItemData::latency
int latency
Definition: AddFUFromHDBDialog.hh:49
ListItemData::id
int id
Definition: AddFUFromHDBDialog.hh:48
AddFUFromHDBDialog::model_
Model * model_
Model of the current adf file.
Definition: AddFUFromHDBDialog.hh:86
AddFUFromHDBDialog::TransferDataToWindow
virtual bool TransferDataToWindow()
Definition: AddFUFromHDBDialog.cc:181
AddFUFromHDBDialog::filterCtrl_
wxSearchCtrl * filterCtrl_
The list filter text control.
Definition: AddFUFromHDBDialog.hh:92
AddFUFromHDBDialog::~AddFUFromHDBDialog
virtual ~AddFUFromHDBDialog()
Definition: AddFUFromHDBDialog.cc:172
AddFUFromHDBDialog::ID_CLOSE
@ ID_CLOSE
Definition: AddFUFromHDBDialog.hh:106
AddFUFromHDBDialog::ID_FILTER_TIMER
@ ID_FILTER_TIMER
Definition: AddFUFromHDBDialog.hh:108
HDB::HDBManager
Definition: HDBManager.hh:82
AddFUFromHDBDialog::ID_LIST
@ ID_LIST
Definition: AddFUFromHDBDialog.hh:102
AddFUFromHDBDialog::onClose
void onClose(wxCommandEvent &event)
Definition: AddFUFromHDBDialog.cc:482
Model
Definition: Model.hh:50
AddFUFromHDBDialog::sortColumn_
int sortColumn_
Definition: AddFUFromHDBDialog.hh:98
ListItemData
Definition: AddFUFromHDBDialog.hh:47
AddFUFromHDBDialog::ID_FILTER_TEXTCTRL
@ ID_FILTER_TEXTCTRL
Definition: AddFUFromHDBDialog.hh:104
AddFUFromHDBDialog::ID_ADD
@ ID_ADD
Definition: AddFUFromHDBDialog.hh:105
AddFUFromHDBDialog::filterTimer_
wxTimer filterTimer_
Timer to postpone filtering while typing filter patterns.
Definition: AddFUFromHDBDialog.hh:96
AddFUFromHDBDialog::fuArchitectures_
std::map< int, HDB::FUArchitecture * > fuArchitectures_
Map of iu architectures displayed in the dialog list.
Definition: AddFUFromHDBDialog.hh:90
ListItemData::path
wxString path
Definition: AddFUFromHDBDialog.hh:52
ListItemData::hdbId
int hdbId
Definition: AddFUFromHDBDialog.hh:51
AddFUFromHDBDialog::onAdd
void onAdd(wxCommandEvent &event)
Definition: AddFUFromHDBDialog.cc:387
AddFUFromHDBDialog::HDB_FILE_FILTER
static const wxString HDB_FILE_FILTER
File filter for HDB files.
Definition: AddFUFromHDBDialog.hh:112
AddFUFromHDBDialog::ID_LINE
@ ID_LINE
Definition: AddFUFromHDBDialog.hh:107
AddFUFromHDBDialog::onFilterTimeOut
void onFilterTimeOut(wxTimerEvent &event)
Definition: AddFUFromHDBDialog.cc:365