OpenASIP 2.2
Loading...
Searching...
No Matches
OperationPropertyDialog.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 OperationPropertyDialog.hh
26 *
27 * Declaration of OperationPropertyDialog class.
28 *
29 * @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30 * @author Tero Ryynänen 2008 (tero.ryynanen-no.spam-tut.fi)
31 * @note rating: red
32 */
33
34#ifndef TTA_OPERATION_PROPERTY_DIALOG_HH
35#define TTA_OPERATION_PROPERTY_DIALOG_HH
36
37#include <wx/wx.h>
38#include <wx/listctrl.h>
39#include <wx/choice.h>
40#include <vector>
41#include <string>
42
43class Operation;
44class Operand;
45class OperationModule;
46class ObjectState;
47
48/**
49 * Dialog which is used to create or modify an operation.
50 */
51class OperationPropertyDialog : public wxDialog {
52public:
54 wxWindow* parent,
55 Operation* op,
56 OperationModule& module,
57 const std::string& path);
59
60 Operation* operation() const;
61
62private:
63 /// Copying not allowed.
65 /// Assignment not allowed.
67
68 wxSizer* createContents(wxWindow* parent, bool call_fit, bool set_sizer);
69 wxBitmap createBitmaps(size_t index);
70 virtual bool TransferDataToWindow();
71 void updateOperands();
73 void updateDAG();
74 void updateAffected();
76 void onSelection(wxListEvent& event);
77 void onAddAffectedBy(wxCommandEvent& event);
78 void onDeleteAffectedBy(wxCommandEvent& event);
79 void onAddAffects(wxCommandEvent& event);
80 void onDeleteAffects(wxCommandEvent& event);
81 void onAddInputOperand(wxCommandEvent& event);
82 void onModifyInputOperand(wxCommandEvent& event);
83 void onDeleteInputOperand(wxCommandEvent& event);
84 void onAddOutputOperand(wxCommandEvent& event);
85 void onModifyOutputOperand(wxCommandEvent& event);
86 void onDeleteOutputOperand(wxCommandEvent& event);
87 void onMoveInputUp(wxCommandEvent& event);
88 void onMoveInputDown(wxCommandEvent& event);
89 void onMoveOutputUp(wxCommandEvent& event);
90 void onMoveOutputDown(wxCommandEvent& event);
91 void onOpen(wxCommandEvent& event);
92 void onOpenDAG(wxCommandEvent& event);
93
94 void onSaveDAG(wxCommandEvent& event);
95 void onUndoDAG(wxCommandEvent& event);
96 void onDeleteDAG(wxCommandEvent& event);
97 void onNewDAG(wxCommandEvent& event);
98
99 void onDAGChange(wxCommandEvent& event);
100 void onComboBoxChange(wxCommandEvent& event);
101
102 void moveUp(std::vector<Operand*>& ops, int id, wxListCtrl* list);
103 void moveDown(std::vector<Operand*>& ops, int id, wxListCtrl* list);
104 std::vector<std::string> getSelectedItems(wxListCtrl* listCtrl);
105
106 void onOk(wxCommandEvent& event);
108 void setTexts();
109 void setBehaviorLabel();
110 void launchEditor(const std::string& cmd);
111 void updateSwapLists(std::vector<std::string> deletedOperands);
112
113 void updateOperation(bool newOpDag);
114
115 /**
116 * Component ids.
117 */
118 enum {
152 };
153
154 /// Input operand sizer.
155 wxStaticBoxSizer* inputSizer_;
156 /// Output operand sizer.
157 wxStaticBoxSizer* outputSizer_;
158 /// Affects sizer.
159 wxStaticBoxSizer* affectsSizer_;
160 /// Affected by sizer.
161 wxStaticBoxSizer* affectedBySizer_;
162
163 /// List of affected by operations.
164 wxListCtrl* affectedByList_;
165 /// List of affects operations.
166 wxListCtrl* affectsList_;
167 /// List of input operands.
168 wxListCtrl* inputOperandList_;
169 /// List of output operands.
171 /// Choice box for new affected by operations.
172 wxComboBox* affectedByChoice_;
173 /// Choice box for new affects operations.
174 wxComboBox* affectsChoice_;
175 /// Read memory check box.
176 wxCheckBox* readMemoryCB_;
177 /// Write memory check box.
178 wxCheckBox* writeMemoryCB_;
179 /// Can trap check box.
180 wxCheckBox* canTrapCB_;
181 /// Has side effects check box.
182 wxCheckBox* sideEffectsCB_;
183 /// Clocked check box.
184 wxCheckBox* clockedCB_;
185 /// Operation to be created or to be modified.
187 /// Original operation's ObjectState tree
189
190 /// Name of the operation.
191 wxString name_;
192 /// Module in which operation belongs to.
194 /// Path in which module belongs to.
195 std::string path_;
196 /// Does operation read memory?
198 /// Does operation write memory?
200 /// Can operation trap?
202 /// Does operation has side effects?
204 /// Is operation clocked?
206 /// Can operation can change program flow.
208 /// Operation performs function call.
210 /// Operation is branch.
212
213 // Text box for editing operation description
214 wxTextCtrl* editDescription_;
215
216 /// Input operands.
217 std::vector<Operand*> inputOperands_;
218 /// Output operands.
219 std::vector<Operand*> outputOperands_;
220 /// Operations that affects this operation.
221 std::vector<std::string> affects_;
222 /// Operations that are affected by this operation.
223 std::vector<std::string> affectedBy_;
224
226 DECLARE_EVENT_TABLE()
227};
228
229#endif
void onOk(wxCommandEvent &event)
void onSaveDAG(wxCommandEvent &event)
bool controlFlow_
Can operation can change program flow.
OperationModule & module_
Module in which operation belongs to.
void onDeleteAffectedBy(wxCommandEvent &event)
void updateSwapLists(std::vector< std::string > deletedOperands)
wxListCtrl * outputOperandList_
List of output operands.
void onDAGChange(wxCommandEvent &event)
bool isCall_
Operation performs function call.
bool hasSideEffects_
Does operation has side effects?
void onModifyInputOperand(wxCommandEvent &event)
void onDeleteInputOperand(wxCommandEvent &event)
void onOpen(wxCommandEvent &event)
bool writeMemory_
Does operation write memory?
wxString name_
Name of the operation.
void onMoveInputDown(wxCommandEvent &event)
Operation * operation_
Operation to be created or to be modified.
void onSelection(wxListEvent &event)
bool readMemory_
Does operation read memory?
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
void onDeleteAffects(wxCommandEvent &event)
wxBitmap createBitmaps(size_t index)
std::vector< Operand * > outputOperands_
Output operands.
wxCheckBox * sideEffectsCB_
Has side effects check box.
void onUndoDAG(wxCommandEvent &event)
void onDeleteOutputOperand(wxCommandEvent &event)
wxStaticBoxSizer * affectsSizer_
Affects sizer.
void onComboBoxChange(wxCommandEvent &event)
std::vector< std::string > getSelectedItems(wxListCtrl *listCtrl)
std::string path_
Path in which module belongs to.
void onMoveInputUp(wxCommandEvent &event)
void onAddInputOperand(wxCommandEvent &event)
void onModifyOutputOperand(wxCommandEvent &event)
bool canTrap_
Can operation trap?
wxCheckBox * readMemoryCB_
Read memory check box.
wxCheckBox * clockedCB_
Clocked check box.
void onAddAffectedBy(wxCommandEvent &event)
bool isBranch_
Operation is branch.
void onAddAffects(wxCommandEvent &event)
void onNewDAG(wxCommandEvent &event)
void moveDown(std::vector< Operand * > &ops, int id, wxListCtrl *list)
ObjectState * orig_
Original operation's ObjectState tree.
wxCheckBox * writeMemoryCB_
Write memory check box.
wxListCtrl * inputOperandList_
List of input operands.
wxStaticBoxSizer * affectedBySizer_
Affected by sizer.
void onAddOutputOperand(wxCommandEvent &event)
wxListCtrl * affectedByList_
List of affected by operations.
wxStaticBoxSizer * outputSizer_
Output operand sizer.
bool clocked_
Is operation clocked?
void onOpenDAG(wxCommandEvent &event)
void onMoveOutputUp(wxCommandEvent &event)
void onMoveOutputDown(wxCommandEvent &event)
std::vector< Operand * > inputOperands_
Input operands.
void launchEditor(const std::string &cmd)
std::vector< std::string > affects_
Operations that affects this operation.
OperationPropertyDialog(const OperationPropertyDialog &)
Copying not allowed.
wxComboBox * affectsChoice_
Choice box for new affects operations.
wxStaticBoxSizer * inputSizer_
Input operand sizer.
void moveUp(std::vector< Operand * > &ops, int id, wxListCtrl *list)
void onDeleteDAG(wxCommandEvent &event)
OperationPropertyDialog & operator=(const OperationPropertyDialog &)
Assignment not allowed.
std::vector< std::string > affectedBy_
Operations that are affected by this operation.
wxListCtrl * affectsList_
List of affects operations.
wxCheckBox * canTrapCB_
Can trap check box.
wxComboBox * affectedByChoice_
Choice box for new affected by operations.