OpenASIP  2.0
AddressSpaceDialog.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 AddressSpaceDialog.hh
26  *
27  * Declaration of AddressSpaceDialog class.
28  *
29  * @author Veli-Pekka Jääskeläinen 2004 (vjaaskel-no.spam-cs.tut.fi)
30  */
31 
32 #ifndef TTA_ADDRESS_SPACE_DIALOG_HH
33 #define TTA_ADDRESS_SPACE_DIALOG_HH
34 
35 #include <wx/wx.h>
36 #include <wx/spinctrl.h>
37 #include <wx/listctrl.h>
38 #include <set>
39 
40 class NumberControl;
41 
42 namespace TTAMachine {
43  class Machine;
44  class AddressSpace;
45 }
46 
47 /**
48  * Dialog for editing address space properties.
49  */
50 class AddressSpaceDialog : public wxDialog {
51 public:
53  wxWindow* parent,
55  TTAMachine::AddressSpace* addressSpace);
57 
58 private:
59  wxSizer* createContents(wxWindow* parent, bool call_fit, bool set_sizer);
60  virtual bool TransferDataToWindow();
61  void onName(wxCommandEvent& event);
62  void onOK(wxCommandEvent& event);
63  void onHelp(wxCommandEvent& event);
64  void onMinAddress(wxCommandEvent& event);
65  void onMinHex(wxCommandEvent& event);
66  void onMaxAddress(wxCommandEvent& event);
67  void onMaxHex(wxCommandEvent& event);
68  void onMinToDec(wxCommandEvent& event);
69  void onMinToHex(wxCommandEvent& event);
70  void onMaxToDec(wxCommandEvent& event);
71  void onMaxToHex(wxCommandEvent& event);
72  void onBitWidth(wxSpinEvent& event);
73  void onBitWidthText(wxCommandEvent& event);
74 
75  void onAddId(wxCommandEvent& event);
76  void onDeleteId(wxCommandEvent& event);
77  void onSpinId(wxSpinEvent& event);
78  void onIdListSelection(wxListEvent& event);
79  void updateIdLists();
80  bool isFreeId(unsigned id) const;
81 
82  void setTexts();
83 
84  /// Machine containing all the address spaces.
86  /// Address space to modify with the dialog.
88  /// Name of the address space.
89  wxString name_;
90  /// The bit width of the minimum addressable word.
91  int width_;
92  /// The lowest address in the address space.
93  wxString minAddress_;
94  /// The highest address in the address space.
95  wxString maxAddress_;
96  /// Widget for the lowest address hex value.
98  /// Widget for the highest address hex value.
100 
101  /// Boxsizer containing the name widget.
102  wxStaticBoxSizer* nameSizer_;
103  /// Boxsizer containing the min-address widget.
104  wxStaticBoxSizer* minAddressSizer_;
105  /// Boxsizer containing the max-address widget.
106  wxStaticBoxSizer* maxAddressSizer_;
107  /// Boxsizer containing the width widget.
108  wxStaticBoxSizer* widthSizer_;
109  /// SpinCtrl containing the bit width of the max-address.
110  wxSpinCtrl *bitWidthSpinCtrl_;
111 
112  /// Boxsizer containing the address space id widget.
113  wxStaticBoxSizer* idSizer_;
114  /// List control containing the address space ids.
115  wxListCtrl* idListCtrl_;
116  /// SpinCtrl containing an address space id.
117  wxSpinCtrl* idSpinCtrl_;
118 
119  /// Container for unique id numbers.
120  std::set<unsigned> idNumbers_;
121 
122  // IDs for dialog controls
123  enum {
124  ID_NAME = 10000,
129 
134 
142  };
143 
144  DECLARE_EVENT_TABLE()
145 };
146 #endif
AddressSpaceDialog::maxControl_
NumberControl * maxControl_
Widget for the highest address hex value.
Definition: AddressSpaceDialog.hh:99
AddressSpaceDialog::onAddId
void onAddId(wxCommandEvent &event)
Definition: AddressSpaceDialog.cc:366
AddressSpaceDialog::onName
void onName(wxCommandEvent &event)
Definition: AddressSpaceDialog.cc:302
AddressSpaceDialog::ID_RADIO_MIN_HEX
@ ID_RADIO_MIN_HEX
Definition: AddressSpaceDialog.hh:136
AddressSpaceDialog::ID_MIN_ADDRESS
@ ID_MIN_ADDRESS
Definition: AddressSpaceDialog.hh:126
AddressSpaceDialog::onDeleteId
void onDeleteId(wxCommandEvent &event)
Definition: AddressSpaceDialog.cc:387
AddressSpaceDialog::setTexts
void setTexts()
Definition: AddressSpaceDialog.cc:134
AddressSpaceDialog::ID_MAX_ADDRESS
@ ID_MAX_ADDRESS
Definition: AddressSpaceDialog.hh:127
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
TTAMachine::AddressSpace
Definition: AddressSpace.hh:51
AddressSpaceDialog::ID_ADD_ID
@ ID_ADD_ID
Definition: AddressSpaceDialog.hh:132
AddressSpaceDialog::onMinToHex
void onMinToHex(wxCommandEvent &event)
AddressSpaceDialog::ID_ID_LIST
@ ID_ID_LIST
Definition: AddressSpaceDialog.hh:130
AddressSpaceDialog::ID_SPIN_ID
@ ID_SPIN_ID
Definition: AddressSpaceDialog.hh:131
AddressSpaceDialog::ID_HELP
@ ID_HELP
Definition: AddressSpaceDialog.hh:141
AddressSpaceDialog::onMaxToDec
void onMaxToDec(wxCommandEvent &event)
AddressSpaceDialog
Definition: AddressSpaceDialog.hh:50
AddressSpaceDialog::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition: AddressSpaceDialog.cc:494
AddressSpaceDialog::ID_TEXT
@ ID_TEXT
Definition: AddressSpaceDialog.hh:139
AddressSpaceDialog::as_
TTAMachine::AddressSpace * as_
Address space to modify with the dialog.
Definition: AddressSpaceDialog.hh:87
AddressSpaceDialog::TransferDataToWindow
virtual bool TransferDataToWindow()
Definition: AddressSpaceDialog.cc:180
AddressSpaceDialog::updateIdLists
void updateIdLists()
Definition: AddressSpaceDialog.cc:211
AddressSpaceDialog::maxAddressSizer_
wxStaticBoxSizer * maxAddressSizer_
Boxsizer containing the max-address widget.
Definition: AddressSpaceDialog.hh:106
AddressSpaceDialog::onOK
void onOK(wxCommandEvent &event)
Definition: AddressSpaceDialog.cc:226
AddressSpaceDialog::onSpinId
void onSpinId(wxSpinEvent &event)
Definition: AddressSpaceDialog.cc:418
AddressSpaceDialog::AddressSpaceDialog
AddressSpaceDialog(wxWindow *parent, TTAMachine::Machine *machine, TTAMachine::AddressSpace *addressSpace)
Definition: AddressSpaceDialog.cc:82
AddressSpaceDialog::ID_LINE
@ ID_LINE
Definition: AddressSpaceDialog.hh:140
AddressSpaceDialog::onMaxToHex
void onMaxToHex(wxCommandEvent &event)
AddressSpaceDialog::ID_RADIO_MAX_HEX
@ ID_RADIO_MAX_HEX
Definition: AddressSpaceDialog.hh:138
AddressSpaceDialog::onMinAddress
void onMinAddress(wxCommandEvent &event)
Definition: AddressSpaceDialog.cc:319
AddressSpaceDialog::name_
wxString name_
Name of the address space.
Definition: AddressSpaceDialog.hh:89
AddressSpaceDialog::minControl_
NumberControl * minControl_
Widget for the lowest address hex value.
Definition: AddressSpaceDialog.hh:97
AddressSpaceDialog::onBitWidthText
void onBitWidthText(wxCommandEvent &event)
Definition: AddressSpaceDialog.cc:342
AddressSpaceDialog::onIdListSelection
void onIdListSelection(wxListEvent &event)
Definition: AddressSpaceDialog.cc:436
AddressSpaceDialog::bitWidthSpinCtrl_
wxSpinCtrl * bitWidthSpinCtrl_
SpinCtrl containing the bit width of the max-address.
Definition: AddressSpaceDialog.hh:110
AddressSpaceDialog::onMaxHex
void onMaxHex(wxCommandEvent &event)
AddressSpaceDialog::machine_
TTAMachine::Machine * machine_
Machine containing all the address spaces.
Definition: AddressSpaceDialog.hh:85
AddressSpaceDialog::widthSizer_
wxStaticBoxSizer * widthSizer_
Boxsizer containing the width widget.
Definition: AddressSpaceDialog.hh:108
AddressSpaceDialog::isFreeId
bool isFreeId(unsigned id) const
Definition: AddressSpaceDialog.cc:450
AddressSpaceDialog::idNumbers_
std::set< unsigned > idNumbers_
Container for unique id numbers.
Definition: AddressSpaceDialog.hh:120
AddressSpaceDialog::minAddress_
wxString minAddress_
The lowest address in the address space.
Definition: AddressSpaceDialog.hh:93
AddressSpaceDialog::ID_RADIO_MAX_DEC
@ ID_RADIO_MAX_DEC
Definition: AddressSpaceDialog.hh:137
NumberControl
Definition: NumberControl.hh:59
AddressSpaceDialog::maxAddress_
wxString maxAddress_
The highest address in the address space.
Definition: AddressSpaceDialog.hh:95
AddressSpaceDialog::ID_RADIO_MIN_DEC
@ ID_RADIO_MIN_DEC
Definition: AddressSpaceDialog.hh:135
AddressSpaceDialog::ID_NAME
@ ID_NAME
Definition: AddressSpaceDialog.hh:124
AddressSpaceDialog::width_
int width_
The bit width of the minimum addressable word.
Definition: AddressSpaceDialog.hh:91
AddressSpaceDialog::ID_BIT_WIDTH
@ ID_BIT_WIDTH
Definition: AddressSpaceDialog.hh:128
AddressSpaceDialog::nameSizer_
wxStaticBoxSizer * nameSizer_
Boxsizer containing the name widget.
Definition: AddressSpaceDialog.hh:102
AddressSpaceDialog::ID_DELETE_ID
@ ID_DELETE_ID
Definition: AddressSpaceDialog.hh:133
TTAMachine
Definition: Assembler.hh:48
AddressSpaceDialog::idSpinCtrl_
wxSpinCtrl * idSpinCtrl_
SpinCtrl containing an address space id.
Definition: AddressSpaceDialog.hh:117
AddressSpaceDialog::idListCtrl_
wxListCtrl * idListCtrl_
List control containing the address space ids.
Definition: AddressSpaceDialog.hh:115
AddressSpaceDialog::onHelp
void onHelp(wxCommandEvent &event)
AddressSpaceDialog::onMinHex
void onMinHex(wxCommandEvent &event)
AddressSpaceDialog::minAddressSizer_
wxStaticBoxSizer * minAddressSizer_
Boxsizer containing the min-address widget.
Definition: AddressSpaceDialog.hh:104
AddressSpaceDialog::idSizer_
wxStaticBoxSizer * idSizer_
Boxsizer containing the address space id widget.
Definition: AddressSpaceDialog.hh:113
AddressSpaceDialog::~AddressSpaceDialog
~AddressSpaceDialog()
Definition: AddressSpaceDialog.cc:126
AddressSpaceDialog::onMaxAddress
void onMaxAddress(wxCommandEvent &event)
Definition: AddressSpaceDialog.cc:330
AddressSpaceDialog::onBitWidth
void onBitWidth(wxSpinEvent &event)
Definition: AddressSpaceDialog.cc:351
TTAMachine::Machine
Definition: Machine.hh:73
AddressSpaceDialog::ID_WIDTH
@ ID_WIDTH
Definition: AddressSpaceDialog.hh:125
AddressSpaceDialog::onMinToDec
void onMinToDec(wxCommandEvent &event)