OpenASIP  2.0
OperationDialog.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 OperationDialog.hh
26  *
27  * Declaration of OperationDialog class.
28  *
29  * @author Veli-Pekka Jääskeläinen 2004 (vjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_OPERATION_DIALOG_HH
34 #define TTA_OPERATION_DIALOG_HH
35 
36 #include <set>
37 #include <list>
38 #include <wx/wx.h>
39 #include <wx/spinctrl.h>
40 #include <wx/grid.h>
41 
42 namespace TTAMachine {
43  class HWOperation;
44 }
45 
46 /**
47  * Dialog for editing HWOperation properties.
48  */
49 class OperationDialog: public wxDialog {
50 public:
51  OperationDialog(wxWindow* parent, TTAMachine::HWOperation* operation);
53 
54 private:
55  wxSizer* createContents(wxWindow* parent, bool call_fit, bool set_sizer);
56  bool TransferDataToWindow();
57  void initialize();
58  void setTexts();
59 
60  void updateOperandList();
61  void updateResourceGrid();
62  void updateUsageGrid();
63  void updateLatency();
64  void setOperandType(int operand, bool read);
66 
67  void onAddOperand(wxCommandEvent& event);
68  void onDeleteOperand(wxCommandEvent& event);
69  void onBindOperand(wxCommandEvent& event);
70 
71  void onAddResource(wxCommandEvent& event);
72  void onDeleteResource(wxCommandEvent& event);
73  void onOK(wxCommandEvent& event);
74 
75  void onName(wxCommandEvent& event);
76  void onOperandSelection(wxListEvent& event);
77  void onResourceSelection(wxGridRangeSelectEvent& event);
78  void onResourceLClick(wxGridEvent& event);
79  void onOperandLClick(wxGridEvent& event);
80  void onGridLClick(wxGridEvent& event);
81  void onGridRClick(wxGridEvent& event);
82 
83  std::string selectedResource();
84  int operandRow(int operand);
85 
86  /// Operation to edit.
88  /// Name of the operation
89  wxString name_;
90  /// Name of resource to be added.
91  wxString resourceName_;
92  /// Bind list widget.
93  wxListCtrl* bindList_;
94  /// Spin button control for the bind operand.
95  wxSpinCtrl* numberControl_;
96  /// Resource list widget.
97  wxGrid* resourceGrid_;
98  /// Operand usage grid widget.
99  wxGrid* usageGrid_;
100  /// Choice widget for the port to bind.
101  wxChoice* portChoice_;
102  /// Static boxsizer for the resource grid widgets
103  wxStaticBoxSizer* resourceSizer_;
104  /// Static boxsizer for the operand list widgets
105  wxStaticBoxSizer* operandSizer_;
106  /// Static boxsizer for the operand usage grid widgets
107  wxStaticBoxSizer* usageSizer_;
108 
109  /// List of unused resources.
110  std::list<std::string> newResources_;
111 
112  /// List of unused operands.
113  std::set<int> operands_;
114 
115  /// Static text control displaying the operation latency.
116  wxStaticText* latencyText_;
117 
118  /// Width of the resource and operand usage grid columns.
119  static const int GRID_COLUMN_WIDTH;
120  /// Grid marker for resource use.
121  static const wxString USE_MARK;
122  /// Grid marker for a read.
123  static const wxString READ_MARK;
124  /// Grid marker for a write.
125  static const wxString WRITE_MARK;
126 
127  // enumerated IDs for dialog widgets
128  enum {
129  ID_NAME = 10000,
152  };
153 
154  DECLARE_EVENT_TABLE()
155 };
156 
157 #endif
OperationDialog::ID_PORT
@ ID_PORT
Definition: OperationDialog.hh:133
OperationDialog::ID_DELETE_RESOURCE
@ ID_DELETE_RESOURCE
Definition: OperationDialog.hh:146
OperationDialog::newResources_
std::list< std::string > newResources_
List of unused resources.
Definition: OperationDialog.hh:110
OperationDialog::latencyText_
wxStaticText * latencyText_
Static text control displaying the operation latency.
Definition: OperationDialog.hh:116
OperationDialog::ID_LINE
@ ID_LINE
Definition: OperationDialog.hh:138
OperationDialog::ID_LATENCY
@ ID_LATENCY
Definition: OperationDialog.hh:151
TTAMachine::HWOperation
Definition: HWOperation.hh:52
OperationDialog::updateResourceGrid
void updateResourceGrid()
Definition: OperationDialog.cc:312
OperationDialog::operands_
std::set< int > operands_
List of unused operands.
Definition: OperationDialog.hh:113
OperationDialog::ID_ADD_OPERAND
@ ID_ADD_OPERAND
Definition: OperationDialog.hh:135
OperationDialog::OperationDialog
OperationDialog(wxWindow *parent, TTAMachine::HWOperation *operation)
Definition: OperationDialog.cc:100
OperationDialog::ID_LABEL_LATENCY
@ ID_LABEL_LATENCY
Definition: OperationDialog.hh:150
OperationDialog::onOperandLClick
void onOperandLClick(wxGridEvent &event)
Definition: OperationDialog.cc:622
OperationDialog::onAddResource
void onAddResource(wxCommandEvent &event)
Definition: OperationDialog.cc:948
OperationDialog::ID_NAME
@ ID_NAME
Definition: OperationDialog.hh:129
OperationDialog::updateUsageGrid
void updateUsageGrid()
Definition: OperationDialog.cc:393
OperationDialog::operation_
TTAMachine::HWOperation * operation_
Operation to edit.
Definition: OperationDialog.hh:87
OperationDialog::initialize
void initialize()
Definition: OperationDialog.cc:128
OperationDialog::USE_MARK
static const wxString USE_MARK
Grid marker for resource use.
Definition: OperationDialog.hh:121
OperationDialog::usageSizer_
wxStaticBoxSizer * usageSizer_
Static boxsizer for the operand usage grid widgets.
Definition: OperationDialog.hh:107
OperationDialog::onOK
void onOK(wxCommandEvent &event)
Definition: OperationDialog.cc:1027
OperationDialog::resourceSizer_
wxStaticBoxSizer * resourceSizer_
Static boxsizer for the resource grid widgets.
Definition: OperationDialog.hh:103
OperationDialog::ID_RESOURCE_NAME
@ ID_RESOURCE_NAME
Definition: OperationDialog.hh:144
OperationDialog::ID_BIND_LIST
@ ID_BIND_LIST
Definition: OperationDialog.hh:131
OperationDialog::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition: OperationDialog.cc:1093
OperationDialog::operandSizer_
wxStaticBoxSizer * operandSizer_
Static boxsizer for the operand list widgets.
Definition: OperationDialog.hh:105
OperationDialog::WRITE_MARK
static const wxString WRITE_MARK
Grid marker for a write.
Definition: OperationDialog.hh:125
OperationDialog::selectedResource
std::string selectedResource()
Definition: OperationDialog.cc:927
OperationDialog::ID_DELETE_OPERAND
@ ID_DELETE_OPERAND
Definition: OperationDialog.hh:136
OperationDialog::resourceName_
wxString resourceName_
Name of resource to be added.
Definition: OperationDialog.hh:91
OperationDialog::setOperandType
void setOperandType(int operand, bool read)
Definition: OperationDialog.cc:463
OperationDialog::ID_MENU_FOO
@ ID_MENU_FOO
Definition: OperationDialog.hh:148
OperationDialog::name_
wxString name_
Name of the operation.
Definition: OperationDialog.hh:89
OperationDialog::resourceGrid_
wxGrid * resourceGrid_
Resource list widget.
Definition: OperationDialog.hh:97
OperationDialog::bindList_
wxListCtrl * bindList_
Bind list widget.
Definition: OperationDialog.hh:93
OperationDialog::ID_RESOURCE_GRID
@ ID_RESOURCE_GRID
Definition: OperationDialog.hh:141
OperationDialog::ID_LABEL_PORT
@ ID_LABEL_PORT
Definition: OperationDialog.hh:132
OperationDialog::ID_MENU_BAR
@ ID_MENU_BAR
Definition: OperationDialog.hh:149
OperationDialog::numberControl_
wxSpinCtrl * numberControl_
Spin button control for the bind operand.
Definition: OperationDialog.hh:95
OperationDialog::ID_NUMBER
@ ID_NUMBER
Definition: OperationDialog.hh:140
OperationDialog::ID_OPERAND_GRID
@ ID_OPERAND_GRID
Definition: OperationDialog.hh:142
OperationDialog::onBindOperand
void onBindOperand(wxCommandEvent &event)
Definition: OperationDialog.cc:842
OperationDialog::ID_ADD_RESOURCE
@ ID_ADD_RESOURCE
Definition: OperationDialog.hh:145
OperationDialog::portChoice_
wxChoice * portChoice_
Choice widget for the port to bind.
Definition: OperationDialog.hh:101
OperationDialog::updateLatency
void updateLatency()
Definition: OperationDialog.cc:1077
OperationDialog::ID_LABEL_NAME
@ ID_LABEL_NAME
Definition: OperationDialog.hh:130
OperationDialog::onOperandSelection
void onOperandSelection(wxListEvent &event)
Definition: OperationDialog.cc:869
OperationDialog::READ_MARK
static const wxString READ_MARK
Grid marker for a read.
Definition: OperationDialog.hh:123
OperationDialog::onDeleteResource
void onDeleteResource(wxCommandEvent &event)
Definition: OperationDialog.cc:993
OperationDialog::onGridRClick
void onGridRClick(wxGridEvent &event)
Definition: OperationDialog.cc:550
OperationDialog::~OperationDialog
~OperationDialog()
Definition: OperationDialog.cc:120
OperationDialog::TransferDataToWindow
bool TransferDataToWindow()
Definition: OperationDialog.cc:243
OperationDialog::onAddOperand
void onAddOperand(wxCommandEvent &event)
Definition: OperationDialog.cc:754
OperationDialog::ID_HELP
@ ID_HELP
Definition: OperationDialog.hh:137
OperationDialog::warnOnResourcesWithoutUsages
void warnOnResourcesWithoutUsages()
Definition: OperationDialog.cc:482
OperationDialog::ID_LABEL_OPERAND
@ ID_LABEL_OPERAND
Definition: OperationDialog.hh:139
OperationDialog::GRID_COLUMN_WIDTH
static const int GRID_COLUMN_WIDTH
Width of the resource and operand usage grid columns.
Definition: OperationDialog.hh:119
OperationDialog::setTexts
void setTexts()
Definition: OperationDialog.cc:170
OperationDialog::onDeleteOperand
void onDeleteOperand(wxCommandEvent &event)
Definition: OperationDialog.cc:786
OperationDialog::ID_LABEL_RESOURCE_NAME
@ ID_LABEL_RESOURCE_NAME
Definition: OperationDialog.hh:143
OperationDialog::operandRow
int operandRow(int operand)
Definition: OperationDialog.cc:516
TTAMachine
Definition: Assembler.hh:48
OperationDialog::ID_DELETE_RESOURCE_CYCLE
@ ID_DELETE_RESOURCE_CYCLE
Definition: OperationDialog.hh:147
OperationDialog::onName
void onName(wxCommandEvent &event)
Definition: OperationDialog.cc:723
OperationDialog::usageGrid_
wxGrid * usageGrid_
Operand usage grid widget.
Definition: OperationDialog.hh:99
OperationDialog::updateOperandList
void updateOperandList()
Definition: OperationDialog.cc:256
OperationDialog::onResourceLClick
void onResourceLClick(wxGridEvent &event)
Definition: OperationDialog.cc:563
OperationDialog::onGridLClick
void onGridLClick(wxGridEvent &event)
Definition: OperationDialog.cc:536
OperationDialog
Definition: OperationDialog.hh:49
OperationDialog::onResourceSelection
void onResourceSelection(wxGridRangeSelectEvent &event)
Definition: OperationDialog.cc:911
OperationDialog::ID_LABEL_NUMBER
@ ID_LABEL_NUMBER
Definition: OperationDialog.hh:134