OpenASIP 2.2
Loading...
Searching...
No Matches
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
42namespace TTAMachine {
43 class HWOperation;
44}
45
46/**
47 * Dialog for editing HWOperation properties.
48 */
49class OperationDialog: public wxDialog {
50public:
51 OperationDialog(wxWindow* parent, TTAMachine::HWOperation* operation);
53
54private:
55 wxSizer* createContents(wxWindow* parent, bool call_fit, bool set_sizer);
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.
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
void onAddResource(wxCommandEvent &event)
void onAddOperand(wxCommandEvent &event)
void onOperandSelection(wxListEvent &event)
std::string selectedResource()
wxStaticBoxSizer * usageSizer_
Static boxsizer for the operand usage grid widgets.
TTAMachine::HWOperation * operation_
Operation to edit.
void onGridRClick(wxGridEvent &event)
wxStaticBoxSizer * operandSizer_
Static boxsizer for the operand list widgets.
wxChoice * portChoice_
Choice widget for the port to bind.
static const wxString READ_MARK
Grid marker for a read.
void onName(wxCommandEvent &event)
wxGrid * resourceGrid_
Resource list widget.
wxStaticText * latencyText_
Static text control displaying the operation latency.
void onOK(wxCommandEvent &event)
void onDeleteResource(wxCommandEvent &event)
wxStaticBoxSizer * resourceSizer_
Static boxsizer for the resource grid widgets.
wxSpinCtrl * numberControl_
Spin button control for the bind operand.
void onOperandLClick(wxGridEvent &event)
static const wxString USE_MARK
Grid marker for resource use.
static const wxString WRITE_MARK
Grid marker for a write.
wxString resourceName_
Name of resource to be added.
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
wxString name_
Name of the operation.
void onDeleteOperand(wxCommandEvent &event)
void warnOnResourcesWithoutUsages()
void onResourceLClick(wxGridEvent &event)
void onBindOperand(wxCommandEvent &event)
wxGrid * usageGrid_
Operand usage grid widget.
std::list< std::string > newResources_
List of unused resources.
void setOperandType(int operand, bool read)
static const int GRID_COLUMN_WIDTH
Width of the resource and operand usage grid columns.
int operandRow(int operand)
void onGridLClick(wxGridEvent &event)
wxListCtrl * bindList_
Bind list widget.
std::set< int > operands_
List of unused operands.
void onResourceSelection(wxGridRangeSelectEvent &event)