OpenASIP  2.0
AddIUFromHDBDialog.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 AddRFFromHDBDialog.hh
26  *
27  * Declaration of AddRFFromHDBDialog 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_IU_FROM_HDB_DIALOG_HH
34 #define TTA_ADD_IU_FROM_HDB_DIALOG_HH
35 
36 #include <map>
37 #include <wx/wx.h>
38 #include <wx/listctrl.h>
39 #include "Machine.hh"
40 
41 class Model;
42 
43 struct ListItemData {
44  int id;
45  int width;
46  int size;
47  int readPorts;
48  int latency;
49  int hdbId;
50  wxString path;
51 };
52 
53 namespace HDB {
54  class RFArchitecture;
55 }
56 
57 /**
58  * Dialog for adding immediate unit architectures directly from HDB to the
59  * current machine.
60  */
61 class AddIUFromHDBDialog : public wxDialog {
62 public:
63  AddIUFromHDBDialog(wxWindow* parent, Model* model);
64  virtual ~AddIUFromHDBDialog();
65 
66 private:
67  virtual bool TransferDataToWindow();
68  wxSizer* createContents(wxWindow* parent, bool call_fit, bool set_sizer);
69  void onListSelectionChange(wxListEvent& event);
70  void onAdd(wxCommandEvent& event);
71  void onClose(wxCommandEvent& event);
72  bool loadHDB(const std::string& path);
73  void onColumnClick(wxListEvent& event);
74  void setColumnImage(int col, int image);
75 
76  /// Model of the current adf file.
78  /// Immediate slot list widget.
79  wxListCtrl* list_;
80  /// Map of iu architectures displayed in the dialog list.
81  std::map<int, HDB::RFArchitecture*> iuArchitectures_;
82 
84  bool sortASC_;
85 
86  enum {
87  ID_LIST = 10000,
91  };
92 
93  /// Default size for the IU, if the size is parameterized in the HDB.
94  static const int DEFAULT_SIZE;
95  /// Default width for the IU, if the size is parameterized in the HDB.
96  static const int DEFAULT_WIDTH;
97  /// Default extension mode for the immediate unit.
99  /// File filter for HDB files.
100  static const wxString HDB_FILE_FILTER;
101 
102  DECLARE_EVENT_TABLE()
103 };
104 #endif
AddIUFromHDBDialog::~AddIUFromHDBDialog
virtual ~AddIUFromHDBDialog()
Definition: AddIUFromHDBDialog.cc:174
AddIUFromHDBDialog::loadHDB
bool loadHDB(const std::string &path)
Definition: AddIUFromHDBDialog.cc:241
HDB
Definition: CostDatabase.hh:49
AddIUFromHDBDialog::onAdd
void onAdd(wxCommandEvent &event)
Definition: AddIUFromHDBDialog.cc:330
AddIUFromHDBDialog
Definition: AddIUFromHDBDialog.hh:61
AddIUFromHDBDialog::DEFAULT_EXTENSION_MODE
static const TTAMachine::Machine::Extension DEFAULT_EXTENSION_MODE
Default extension mode for the immediate unit.
Definition: AddIUFromHDBDialog.hh:98
AddIUFromHDBDialog::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition: AddIUFromHDBDialog.cc:402
AddIUFromHDBDialog::DEFAULT_WIDTH
static const int DEFAULT_WIDTH
Default width for the IU, if the size is parameterized in the HDB.
Definition: AddIUFromHDBDialog.hh:96
AddIUFromHDBDialog::HDB_FILE_FILTER
static const wxString HDB_FILE_FILTER
File filter for HDB files.
Definition: AddIUFromHDBDialog.hh:100
AddIUFromHDBDialog::model_
Model * model_
Model of the current adf file.
Definition: AddIUFromHDBDialog.hh:77
ListItemData::size
int size
Definition: AddIUFromHDBDialog.hh:46
ListItemData::readPorts
int readPorts
Definition: AddIUFromHDBDialog.hh:47
AddIUFromHDBDialog::setColumnImage
void setColumnImage(int col, int image)
Definition: AddIUFromHDBDialog.cc:465
ListItemData::latency
int latency
Definition: AddFUFromHDBDialog.hh:49
AddIUFromHDBDialog::list_
wxListCtrl * list_
Immediate slot list widget.
Definition: AddIUFromHDBDialog.hh:79
AddIUFromHDBDialog::onColumnClick
void onColumnClick(wxListEvent &event)
Definition: AddIUFromHDBDialog.cc:436
AddIUFromHDBDialog::sortColumn_
int sortColumn_
Definition: AddIUFromHDBDialog.hh:83
ListItemData::id
int id
Definition: AddFUFromHDBDialog.hh:48
AddIUFromHDBDialog::sortASC_
bool sortASC_
Definition: AddIUFromHDBDialog.hh:84
Machine.hh
AddIUFromHDBDialog::ID_LINE
@ ID_LINE
Definition: AddIUFromHDBDialog.hh:90
AddIUFromHDBDialog::ID_CLOSE
@ ID_CLOSE
Definition: AddIUFromHDBDialog.hh:89
AddIUFromHDBDialog::AddIUFromHDBDialog
AddIUFromHDBDialog(wxWindow *parent, Model *model)
Definition: AddIUFromHDBDialog.cc:133
AddIUFromHDBDialog::TransferDataToWindow
virtual bool TransferDataToWindow()
Definition: AddIUFromHDBDialog.cc:185
Model
Definition: Model.hh:50
AddIUFromHDBDialog::ID_LIST
@ ID_LIST
Definition: AddIUFromHDBDialog.hh:87
ListItemData
Definition: AddFUFromHDBDialog.hh:47
AddIUFromHDBDialog::iuArchitectures_
std::map< int, HDB::RFArchitecture * > iuArchitectures_
Map of iu architectures displayed in the dialog list.
Definition: AddIUFromHDBDialog.hh:81
AddIUFromHDBDialog::ID_ADD
@ ID_ADD
Definition: AddIUFromHDBDialog.hh:88
ListItemData::width
int width
Definition: AddIUFromHDBDialog.hh:45
TTAMachine::Machine::Extension
Extension
Definition: Machine.hh:80
AddIUFromHDBDialog::onListSelectionChange
void onListSelectionChange(wxListEvent &event)
Definition: AddIUFromHDBDialog.cc:317
ListItemData::path
wxString path
Definition: AddFUFromHDBDialog.hh:52
ListItemData::hdbId
int hdbId
Definition: AddFUFromHDBDialog.hh:51
AddIUFromHDBDialog::DEFAULT_SIZE
static const int DEFAULT_SIZE
Default size for the IU, if the size is parameterized in the HDB.
Definition: AddIUFromHDBDialog.hh:94
AddIUFromHDBDialog::onClose
void onClose(wxCommandEvent &event)
Definition: AddIUFromHDBDialog.cc:388