OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
InputOperandDialog Class Reference

#include <InputOperandDialog.hh>

Inheritance diagram for InputOperandDialog:
Inheritance graph
Collaboration diagram for InputOperandDialog:
Collaboration graph

Public Member Functions

 InputOperandDialog (wxWindow *parent, Operand *operand, int numberOfOperands, int operandIndex)
 
virtual ~InputOperandDialog ()
 

Private Types

enum  {
  ID_MEM_ADDRESS = 1000 , ID_MEM_DATA , ID_SWAP_LIST , ID_OPERAND_CHOICE ,
  ID_OPERATION_INPUT_TYPES , ID_ADD_BUTTON , ID_DELETE_BUTTON , ID_ELEMENT_WIDTH ,
  ID_ELEMENT_COUNT , ID_TEXT_WIDTH , ID_TEXT_COUNT
}
 

Private Member Functions

 InputOperandDialog (const InputOperandDialog &)
 Copying not allowed.
 
InputOperandDialogoperator= (const InputOperandDialog &)
 Assignment not allowed.
 
wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 
virtual bool TransferDataToWindow ()
 
void updateList ()
 
void onAddSwap (wxCommandEvent &event)
 
void onDeleteSwap (wxCommandEvent &event)
 
void onSelection (wxListEvent &event)
 
void onOk (wxCommandEvent &event)
 
void updateOperand ()
 
void onType (wxCommandEvent &event)
 
void onElementWidth (wxSpinEvent &event)
 
void onElementCount (wxCommandEvent &event)
 
void updateTypes ()
 
void updateElementWidths ()
 
void updateElementCounts ()
 
void setTexts ()
 

Private Attributes

wxListCtrl * swapList_
 List of can swap operands.
 
wxChoice * swapChoice_
 Choice list for can swap operands.
 
wxStaticBoxSizer * swapSizer_
 Pointer to can swap sizer.
 
Operandoperand_
 Operand to be created or modified.
 
bool memAddress_
 Flag indicating if operand is memory address.
 
bool memData_
 Flag indicating if operand is memory data.
 
wxChoice * inputTypesComboBox_
 Choice box for operation input types.
 
wxSpinCtrl * elementWidthSpinCtrl_
 Spin ctrl for operand element width.
 
wxChoice * elementCountChoice_
 Choice box for operand element count.
 
std::set< int > canSwap_
 Operands that can be swapped with this operand.
 
int numberOfOperands_
 Numberof input operands.
 
int index_
 Index of the input operand currently modified.
 
int type_
 Current operand type in choice box.
 
int elemWidth_
 Current element width in choice box.
 
int elemCount_
 Current element count in choice box.
 
std::vector< std::string > inputTypes_
 Input types.
 
Operand::OperandType operandTypes_ [9]
 

Detailed Description

Dialog for adding or modifying input operands.

Definition at line 47 of file InputOperandDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Component ids.

Enumerator
ID_MEM_ADDRESS 
ID_MEM_DATA 
ID_SWAP_LIST 
ID_OPERAND_CHOICE 
ID_OPERATION_INPUT_TYPES 
ID_ADD_BUTTON 
ID_DELETE_BUTTON 
ID_ELEMENT_WIDTH 
ID_ELEMENT_COUNT 
ID_TEXT_WIDTH 
ID_TEXT_COUNT 

Definition at line 83 of file InputOperandDialog.hh.

Constructor & Destructor Documentation

◆ InputOperandDialog() [1/2]

InputOperandDialog::InputOperandDialog ( wxWindow *  parent,
Operand operand,
int  numberOfOperands,
int  operandIndex 
)

Constructor.

Parameters
parentThe parent window.
operandOperand to be added or modified.
numberOfOperandsThe number of input operands.

Definition at line 76 of file InputOperandDialog.cc.

80 :
81 wxDialog(parent, -1, _T(""),
83 operand_(operand), numberOfOperands_(numberOfOperands),
84 index_(operandIndex) {
85
88 createContents(this, true, true);
89
90 swapList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_SWAP_LIST));
91 swapChoice_ = dynamic_cast<wxChoice*>(FindWindow(ID_OPERAND_CHOICE));
92
94 dynamic_cast<wxChoice*>(FindWindow(ID_OPERATION_INPUT_TYPES));
95
97 dynamic_cast<wxSpinCtrl*>(FindWindow(ID_ELEMENT_WIDTH));
98
100 dynamic_cast<wxChoice*>(FindWindow(ID_ELEMENT_COUNT));
101
102 FindWindow(ID_MEM_ADDRESS)->SetValidator(wxGenericValidator(&memAddress_));
103 FindWindow(ID_MEM_DATA)->SetValidator(wxGenericValidator(&memData_));
104
105 FindWindow(wxID_OK)->SetFocus();
106
108
118
128
129 type_ = operand_->type();
132 updateTypes();
135
136 setTexts();
137 }
static wxPoint getPosition(Dialogs dialog)
@ DIALOG_INPUT_OPERAND
Input operand dialog.
wxSpinCtrl * elementWidthSpinCtrl_
Spin ctrl for operand element width.
wxListCtrl * swapList_
List of can swap operands.
int type_
Current operand type in choice box.
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
int index_
Index of the input operand currently modified.
wxChoice * elementCountChoice_
Choice box for operand element count.
Operand * operand_
Operand to be created or modified.
wxChoice * inputTypesComboBox_
Choice box for operation input types.
wxChoice * swapChoice_
Choice list for can swap operands.
std::vector< std::string > inputTypes_
Input types.
std::set< int > canSwap_
Operands that can be swapped with this operand.
int elemWidth_
Current element width in choice box.
int elemCount_
Current element count in choice box.
int numberOfOperands_
Numberof input operands.
Operand::OperandType operandTypes_[9]
bool memAddress_
Flag indicating if operand is memory address.
bool memData_
Flag indicating if operand is memory data.
virtual bool isMemoryData() const
Definition Operand.cc:351
virtual int elementCount() const
Definition Operand.cc:298
virtual bool isAddress() const
Definition Operand.cc:328
static const std::string FLOAT_WORD_STRING
Definition Operand.hh:75
static const std::string SLONG_WORD_STRING
Definition Operand.hh:70
virtual const std::set< int > & swap() const
Definition Operand.cc:361
static const std::string HALF_FLOAT_WORD_STRING
Definition Operand.hh:74
static const std::string BOOL_STRING
Definition Operand.hh:77
virtual OperandType type() const
Definition Operand.cc:165
static const std::string DOUBLE_WORD_STRING
Definition Operand.hh:76
@ SLONG_WORD
Definition Operand.hh:66
@ FLOAT_WORD
Definition Operand.hh:61
@ ULONG_WORD
Definition Operand.hh:67
@ RAW_DATA
Definition Operand.hh:65
@ SINT_WORD
Definition Operand.hh:59
@ DOUBLE_WORD
Definition Operand.hh:62
@ UINT_WORD
Definition Operand.hh:60
@ HALF_FLOAT_WORD
Definition Operand.hh:63
static const std::string ULONG_WORD_STRING
Definition Operand.hh:71
static const std::string UINT_WORD_STRING
Definition Operand.hh:73
static const std::string RAW_DATA_STRING
Definition Operand.hh:78
static const std::string SINT_WORD_STRING
Definition Operand.hh:72
virtual int elementWidth() const
Definition Operand.cc:278

References Operand::BOOL, Operand::BOOL_STRING, Operand::DOUBLE_WORD, Operand::DOUBLE_WORD_STRING, Operand::FLOAT_WORD, Operand::FLOAT_WORD_STRING, Operand::HALF_FLOAT_WORD, Operand::HALF_FLOAT_WORD_STRING, Operand::RAW_DATA, Operand::RAW_DATA_STRING, Operand::SINT_WORD, Operand::SINT_WORD_STRING, Operand::SLONG_WORD, Operand::SLONG_WORD_STRING, Operand::UINT_WORD, Operand::UINT_WORD_STRING, Operand::ULONG_WORD, and Operand::ULONG_WORD_STRING.

◆ ~InputOperandDialog()

InputOperandDialog::~InputOperandDialog ( )
virtual

Destructor.

Definition at line 142 of file InputOperandDialog.cc.

142 {
143 int x, y;
144 GetPosition(&x, &y);
145 wxPoint point(x, y);
147}
static void setPosition(Dialogs dialog, wxPoint point)

References DialogPosition::DIALOG_INPUT_OPERAND, and DialogPosition::setPosition().

Here is the call graph for this function:

◆ InputOperandDialog() [2/2]

InputOperandDialog::InputOperandDialog ( const InputOperandDialog )
private

Copying not allowed.

Member Function Documentation

◆ createContents()

wxSizer * InputOperandDialog::createContents ( wxWindow *  parent,
bool  call_fit,
bool  set_sizer 
)
private

Creates the contents of dialog.

NOTE! This function is generated by wxDesigner, that is why it is ugly.

Parameters
parentThe parent window.
call_firIf true, fits the contents of the dialog inside dialog.
set_sizerIf true, sets the main sizer as the contents of the dialog.
Returns
The created sizer.

Definition at line 513 of file InputOperandDialog.cc.

514{
515 wxBoxSizer *item0 = new wxBoxSizer(wxVERTICAL);
516
517 wxBoxSizer *item1 = new wxBoxSizer(wxHORIZONTAL);
518
519 wxString strs9[] = {
520 wxT("id: 1")
521 };
522
523
524 // ComboBox for input operand types
525 wxChoice *itemInputTypes = new wxChoice(parent, ID_OPERATION_INPUT_TYPES, wxDefaultPosition, wxSize(100,-1), 1, strs9);
526 item1->Add(itemInputTypes, 0, wxALIGN_CENTER|wxALL, 5);
527
528 wxStaticText *itemTextWidth = new wxStaticText(parent, ID_TEXT_WIDTH, wxT("Element width:"), wxDefaultPosition, wxDefaultSize, 0);
529 item1->Add(itemTextWidth, 0, wxALIGN_CENTER|wxALL, 5);
530 wxSpinCtrl *itemElemWidth = new wxSpinCtrl(parent, ID_ELEMENT_WIDTH, wxT(""), wxDefaultPosition, wxSize(-1,-1), 1);
531 item1->Add(itemElemWidth, 0, wxALIGN_CENTER|wxALL, 5);
532 wxStaticText *itemTextCount = new wxStaticText(parent, ID_TEXT_COUNT, wxT("Element count:"), wxDefaultPosition, wxDefaultSize, 0);
533 item1->Add(itemTextCount, 0, wxALIGN_CENTER|wxALL, 5);
534 wxChoice *itemElemCount = new wxChoice(parent, ID_ELEMENT_COUNT, wxDefaultPosition, wxSize(70,-1), 1, strs9);
535 item1->Add(itemElemCount, 0, wxALIGN_CENTER|wxALL, 5);
536
537 wxBoxSizer *item1b = new wxBoxSizer(wxHORIZONTAL);
538
539 wxCheckBox *item2 = new wxCheckBox(parent, ID_MEM_ADDRESS, wxT("Memory address"), wxDefaultPosition, wxDefaultSize, 0);
540 item1b->Add(item2, 0, wxALIGN_CENTER|wxALL, 5);
541
542 wxCheckBox *item3 = new wxCheckBox(parent, ID_MEM_DATA, wxT("Memory data"), wxDefaultPosition, wxDefaultSize, 0);
543 item1b->Add(item3, 0, wxALIGN_CENTER|wxALL, 5);
544
545 item0->Add(item1, 0, wxALIGN_CENTER|wxALL, 5);
546 item0->Add(item1b, 0, wxALIGN_CENTER|wxALL, 5);
547
548 wxStaticBox *item5 = new wxStaticBox(parent, -1, wxT("Can swap"));
549 wxStaticBoxSizer *item4 = new wxStaticBoxSizer(item5, wxVERTICAL);
550 swapSizer_ = item4;
551
552 wxListCtrl *item6 = new wxListCtrl(parent, ID_SWAP_LIST, wxDefaultPosition, wxSize(160,120), wxLC_REPORT|wxSUNKEN_BORDER);
553 item4->Add(item6, 0, wxGROW|wxALL, 5);
554
555 wxBoxSizer *item7 = new wxBoxSizer(wxHORIZONTAL);
556
557 wxChoice *item8 = new wxChoice(parent, ID_OPERAND_CHOICE, wxDefaultPosition, wxSize(100,-1), 1, strs9, 0);
558 item7->Add(item8, 0, wxALIGN_CENTER|wxALL, 5);
559
560 wxButton *item9 = new wxButton(parent, ID_ADD_BUTTON, wxT("Add"), wxDefaultPosition, wxDefaultSize, 0);
561 item7->Add(item9, 0, wxALIGN_CENTER|wxALL, 5);
562
563 wxButton *item10 = new wxButton(parent, ID_DELETE_BUTTON, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0);
564 item7->Add(item10, 0, wxALIGN_CENTER|wxALL, 5);
565
566 item4->Add(item7, 0, wxALIGN_CENTER|wxALL, 5);
567
568 item0->Add(item4, 0, wxALIGN_CENTER|wxALL, 5);
569
570 wxGridSizer *item11 = new wxGridSizer(2, 0, 0);
571
572 item11->Add(20, 20, 0, wxALIGN_CENTER|wxALL, 5);
573
574 wxBoxSizer *item12 = new wxBoxSizer(wxHORIZONTAL);
575
576 wxButton *item13 = new wxButton(parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0);
577 item12->Add(item13, 0, wxALIGN_CENTER|wxALL, 5);
578
579 wxButton *item14 = new wxButton(parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0);
580 item12->Add(item14, 0, wxALIGN_CENTER|wxALL, 5);
581
582 item11->Add(item12, 0, wxGROW|wxALL, 5);
583
584 item0->Add(item11, 0, wxALIGN_CENTER|wxALL, 5);
585
586 if (set_sizer) {
587 parent->SetSizer(item0);
588 if (call_fit)
589 item0->SetSizeHints(parent);
590 }
591
592 return item0;
593}
wxStaticBoxSizer * swapSizer_
Pointer to can swap sizer.

References ID_ADD_BUTTON, ID_DELETE_BUTTON, ID_ELEMENT_COUNT, ID_ELEMENT_WIDTH, ID_MEM_ADDRESS, ID_MEM_DATA, ID_OPERAND_CHOICE, ID_OPERATION_INPUT_TYPES, ID_SWAP_LIST, ID_TEXT_COUNT, ID_TEXT_WIDTH, and swapSizer_.

◆ onAddSwap()

void InputOperandDialog::onAddSwap ( wxCommandEvent &  event)
private

Handles the event when id is added to can swap list.

Definition at line 362 of file InputOperandDialog.cc.

362 {
363 wxString wxId = swapChoice_->GetStringSelection();
364 string id = WxConversion::toString(wxId);
365 canSwap_.insert(Conversion::toInt(id));
366 updateList();
367}
static int toInt(const T &source)
static std::string toString(const wxString &source)

References canSwap_, swapChoice_, Conversion::toInt(), WxConversion::toString(), and updateList().

Here is the call graph for this function:

◆ onDeleteSwap()

void InputOperandDialog::onDeleteSwap ( wxCommandEvent &  event)
private

Handles the event when id is deleted from can swap list.

It is also possible to delete multible ids from the list.

Definition at line 375 of file InputOperandDialog.cc.

375 {
376
377 vector<string> toBeDeleted;
378 long item = -1;
379 for (;;) {
380 item = swapList_->GetNextItem(
381 item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
382
383 if (item == -1) {
384 break;
385 }
386
387 wxListItem info;
388 info.SetId(item);
389 info.SetColumn(0);
390 swapList_->GetItem(info);
391 toBeDeleted.push_back(WxConversion::toString(info.GetText()));
392 }
393
394 for (size_t i = 0; i < toBeDeleted.size(); i++) {
395 int id = Conversion::toInt(toBeDeleted[i]);
396 set<int>::iterator it = canSwap_.begin();
397 while (it != canSwap_.end()) {
398 if (*it == id) {
399 canSwap_.erase(it);
400 break;
401 }
402 it++;
403 }
404 }
405
406 updateList();
407}

References canSwap_, swapList_, Conversion::toInt(), WxConversion::toString(), and updateList().

Here is the call graph for this function:

◆ onElementCount()

void InputOperandDialog::onElementCount ( wxCommandEvent &  event)
private

Event handler for element count choice box.

Definition at line 224 of file InputOperandDialog.cc.

224 {
225 // get the current choice box value and convert it to integer
226 int index = elementCountChoice_->GetSelection();
227 wxString number = elementCountChoice_->GetString(index);
228 long value;
229 if(!number.ToLong(&value)) {
230 elemCount_ = 1;
231 return;
232 }
233
234 // save current choice
235 elemCount_ = static_cast<int>(value);
236 // update spin ctrl range
238}

References elemCount_, elementCountChoice_, and updateElementWidths().

Here is the call graph for this function:

◆ onElementWidth()

void InputOperandDialog::onElementWidth ( wxSpinEvent &  event)
private

Event handler for element width spin ctrl.

Definition at line 214 of file InputOperandDialog.cc.

214 {
215 elemWidth_ = elementWidthSpinCtrl_->GetValue();
216 // update choice box list cells
218}

References elementWidthSpinCtrl_, elemWidth_, and updateElementCounts().

Here is the call graph for this function:

◆ onOk()

void InputOperandDialog::onOk ( wxCommandEvent &  event)
private

Handles the event when OK button is pushed.

Definition at line 413 of file InputOperandDialog.cc.

413 {
414 TransferDataFromWindow();
416 EndModal(wxID_OK);
417}

References updateOperand().

Here is the call graph for this function:

◆ onSelection()

void InputOperandDialog::onSelection ( wxListEvent &  event)
private

Definition at line 494 of file InputOperandDialog.cc.

494 {
495 if (swapList_->GetSelectedItemCount() == 0) {
496 FindWindow(ID_DELETE_BUTTON)->Disable();
497 } else {
498 FindWindow(ID_DELETE_BUTTON)->Enable();
499 }
500}

References ID_DELETE_BUTTON, and swapList_.

Referenced by updateList().

◆ onType()

void InputOperandDialog::onType ( wxCommandEvent &  event)
private

Event handler for operand type choice box.

Definition at line 199 of file InputOperandDialog.cc.

199 {
200
201 type_ = inputTypesComboBox_->GetSelection();
202
203 Operand::OperandType operType = static_cast<Operand::OperandType>(type_);
205 elemCount_ = 1;
208}
static int defaultElementWidth(OperandType type)
Definition Operand.cc:557
OperandType
Definition Operand.hh:58

References Operand::defaultElementWidth(), elemCount_, elemWidth_, inputTypesComboBox_, type_, updateElementCounts(), and updateElementWidths().

Here is the call graph for this function:

◆ operator=()

InputOperandDialog & InputOperandDialog::operator= ( const InputOperandDialog )
private

Assignment not allowed.

◆ setTexts()

void InputOperandDialog::setTexts ( )
private

Set texts to widgets.

Definition at line 153 of file InputOperandDialog.cc.

153 {
154
157
158 // title
159 format fmt =
161 fmt % index_;
162 SetTitle(WxConversion::toWxString(fmt.str()));
163
164 // buttons
165 WidgetTools::setLabel(&guiText, FindWindow(wxID_OK),
167
168 WidgetTools::setLabel(&guiText, FindWindow(wxID_CANCEL),
170
173
176
177 // column names
179 swapList_->InsertColumn(
180 0, WxConversion::toWxString(fmt.str()), wxLIST_FORMAT_LEFT,
182
183 // check boxes
186
189
190 // sizer
193}
@ TXT_BUTTON_DELETE
Label for delete button.
@ TXT_BUTTON_CANCEL
Label for cancel button.
@ TXT_BUTTON_OK
Label for OK button.
@ TXT_BUTTON_ADD
Label for an add button.
static GUITextGenerator * instance()
static const int DEFAULT_COLUMN_WIDTH
Default column width.
static OSEdTextGenerator & instance()
@ TXT_BOX_CAN_SWAP
Can swap sizer label.
@ TXT_COLUMN_OPERAND
Operand column header.
@ TXT_INPUT_OPERAND_DIALOG_TITLE
Input operand dialog title.
@ TXT_CHECKBOX_MEM_ADDRESS
Memory address label.
@ TXT_CHECKBOX_MEM_DATA
Memory data label.
virtual boost::format text(int textId)
static void setWidgetLabel(wxWindow *widget, std::string text)
static void setLabel(Texts::TextGenerator *generator, wxWindow *widget, int textID)
static wxString toWxString(const std::string &source)

References OSEdConstants::DEFAULT_COLUMN_WIDTH, ID_ADD_BUTTON, ID_DELETE_BUTTON, ID_MEM_ADDRESS, ID_MEM_DATA, index_, GUITextGenerator::instance(), OSEdTextGenerator::instance(), WidgetTools::setLabel(), WidgetTools::setWidgetLabel(), swapList_, swapSizer_, Texts::TextGenerator::text(), WxConversion::toWxString(), OSEdTextGenerator::TXT_BOX_CAN_SWAP, GUITextGenerator::TXT_BUTTON_ADD, GUITextGenerator::TXT_BUTTON_CANCEL, GUITextGenerator::TXT_BUTTON_DELETE, GUITextGenerator::TXT_BUTTON_OK, OSEdTextGenerator::TXT_CHECKBOX_MEM_ADDRESS, OSEdTextGenerator::TXT_CHECKBOX_MEM_DATA, OSEdTextGenerator::TXT_COLUMN_OPERAND, and OSEdTextGenerator::TXT_INPUT_OPERAND_DIALOG_TITLE.

Here is the call graph for this function:

◆ TransferDataToWindow()

bool InputOperandDialog::TransferDataToWindow ( )
privatevirtual

Transfers data to window.

Returns
True if transfer is successful.

Definition at line 318 of file InputOperandDialog.cc.

318 {
319 updateList();
320 return wxWindow::TransferDataToWindow();
321}

References updateList().

Here is the call graph for this function:

◆ updateElementCounts()

void InputOperandDialog::updateElementCounts ( )
private

Updates the element count choice box list.

Definition at line 294 of file InputOperandDialog.cc.

294 {
295
296 elementCountChoice_->Clear();
297
298 // update the list so that only shorter or equal than SIMD_WORD_WIDTH
299 // width*count combinations are listed
300 int elemCount = 1;
301 int elemCountIndex = 0;
302 while (elemCount*elemWidth_ <= SIMD_WORD_WIDTH) {
303 if (elemCount < elemCount_) {
304 ++elemCountIndex;
305 }
307 elemCount *= 2;
308 }
309 elementCountChoice_->SetSelection(elemCountIndex);
310}
#define SIMD_WORD_WIDTH
Definition SimValue.hh:42

References elemCount_, elementCountChoice_, elemWidth_, SIMD_WORD_WIDTH, and WxConversion::toWxString().

Referenced by onElementWidth(), and onType().

Here is the call graph for this function:

◆ updateElementWidths()

void InputOperandDialog::updateElementWidths ( )
private

Updates the element width choice box list.

Definition at line 260 of file InputOperandDialog.cc.

260 {
261
262 Operand::OperandType operType = static_cast<Operand::OperandType>(type_);
263
264 if (operType == Operand::RAW_DATA) {
265 // element width for raw data can be arbitrary up to the max width
266 int elemWidth = 1;
267 int lastValidWidth = 1;
268 while (elemCount_*elemWidth <= SIMD_WORD_WIDTH) {
269 lastValidWidth = elemWidth;
270 elemWidth *= 2;
271 }
272
273 // degrade current element width if it is too big
274 if (elemWidth_ > lastValidWidth) {
275 elemWidth_ = lastValidWidth;
276 }
277 elementWidthSpinCtrl_->SetRange(1, lastValidWidth);
279 } else if (operType == Operand::SINT_WORD || operType == Operand::UINT_WORD) {
280 // element width for integers is 8 to 32
281 elementWidthSpinCtrl_->SetRange(8, 32);
283 } else {
284 // element width for other types is their default type width
287 }
288}

References elemCount_, elementWidthSpinCtrl_, elemWidth_, Operand::RAW_DATA, SIMD_WORD_WIDTH, Operand::SINT_WORD, type_, and Operand::UINT_WORD.

Referenced by onElementCount(), and onType().

◆ updateList()

void InputOperandDialog::updateList ( )
private

Updates the list of can swap operands.

Definition at line 327 of file InputOperandDialog.cc.

327 {
328
329 swapList_->DeleteAllItems();
330 swapChoice_->Clear();
331
332 set<int>::iterator it = canSwap_.begin();
333 int i = 0;
334 while (it != canSwap_.end()) {
335 wxString id = WxConversion::toWxString(*it);
336 swapList_->InsertItem(i, id);
337 i++;
338 it++;
339 }
340
341 for (int i = 1; i <= numberOfOperands_; i++) {
342 if (i != index_ &&
343 swapList_->FindItem(-1, WxConversion::toWxString(i)) == -1) {
344
346 }
347 }
348 swapChoice_->SetSelection(0);
349 if (swapChoice_->GetCount() == 0) {
350 FindWindow(ID_ADD_BUTTON)->Disable();
351 } else {
352 FindWindow(ID_ADD_BUTTON)->Enable();
353 }
354 wxListEvent dummy;
356}
SimValue dummy(32)
a dummy simvalue which is given for operands that are not bound
void onSelection(wxListEvent &event)

References canSwap_, dummy, ID_ADD_BUTTON, index_, numberOfOperands_, onSelection(), swapChoice_, swapList_, and WxConversion::toWxString().

Referenced by onAddSwap(), onDeleteSwap(), and TransferDataToWindow().

Here is the call graph for this function:

◆ updateOperand()

void InputOperandDialog::updateOperand ( )
private

Loads the properties to the modified/created operand.

Definition at line 423 of file InputOperandDialog.cc.

423 {
424 ObjectState* root = new ObjectState("");
426
427 int selected = inputTypesComboBox_->GetSelection();
428 Operand::OperandType type = operandTypes_[selected];
429
430
431 switch(type) {
434 break;
437 break;
440 break;
443 break;
445 root->setAttribute(
447 break;
448 case Operand::BOOL:
450 break;
452 root->setAttribute(
454 break;
456 root->setAttribute(
458 break;
460 root->setAttribute(
462 break;
463 default:
465 break;
466 }
467
470
473
474 if (canSwap_.size() > 0) {
476 set<int>::iterator it = canSwap_.begin();
477 while (it != canSwap_.end()) {
478 ObjectState* swapChild = new ObjectState(Operand::OPRND_IN);
479 swapChild->setAttribute(Operand::OPRND_ID, *it);
480 swap->addChild(swapChild);
481 it++;
482 }
483 root->addChild(swap);
484 }
485
486 operand_->loadState(root);
487 delete root;
488}
void setAttribute(const std::string &name, const std::string &value)
void addChild(ObjectState *child)
static const std::string OPRND_IN
Object state name for input operand.
Definition Operand.hh:94
static const std::string OPRND_CAN_SWAP
Object state name for can swap.
Definition Operand.hh:92
static const std::string OPRND_ELEM_WIDTH
Object state name for element width.
Definition Operand.hh:98
static const std::string OPRND_TYPE
Object state name for operand type.
Definition Operand.hh:84
static const std::string OPRND_MEM_ADDRESS
Object state name for memory address.
Definition Operand.hh:86
static const std::string OPRND_ELEM_COUNT
Object state name for element count.
Definition Operand.hh:100
static const std::string OPRND_MEM_DATA
Object state name for memory data.
Definition Operand.hh:90
static const std::string OPRND_ID
Object state name for operand id.
Definition Operand.hh:82
virtual void loadState(const ObjectState *state)
Definition Operand.cc:383

References ObjectState::addChild(), Operand::BOOL, Operand::BOOL_STRING, canSwap_, Operand::DOUBLE_WORD, Operand::DOUBLE_WORD_STRING, elemCount_, elemWidth_, Operand::FLOAT_WORD, Operand::FLOAT_WORD_STRING, Operand::HALF_FLOAT_WORD, Operand::HALF_FLOAT_WORD_STRING, inputTypesComboBox_, Operand::loadState(), memAddress_, memData_, numberOfOperands_, operand_, operandTypes_, Operand::OPRND_CAN_SWAP, Operand::OPRND_ELEM_COUNT, Operand::OPRND_ELEM_WIDTH, Operand::OPRND_ID, Operand::OPRND_IN, Operand::OPRND_MEM_ADDRESS, Operand::OPRND_MEM_DATA, Operand::OPRND_TYPE, Operand::RAW_DATA, Operand::RAW_DATA_STRING, ObjectState::setAttribute(), Operand::SINT_WORD, Operand::SINT_WORD_STRING, Operand::SLONG_WORD, Operand::SLONG_WORD_STRING, Operand::UINT_WORD, Operand::UINT_WORD_STRING, Operand::ULONG_WORD, and Operand::ULONG_WORD_STRING.

Referenced by onOk().

Here is the call graph for this function:

◆ updateTypes()

void InputOperandDialog::updateTypes ( )
private

Updates the type lists.

Definition at line 244 of file InputOperandDialog.cc.

244 {
245
246 inputTypesComboBox_->Clear();
247
248 for (unsigned int i = 0; i < inputTypes_.size(); i++) {
249 wxString oper = WxConversion::toWxString(inputTypes_.at(i));
250 inputTypesComboBox_->Append(oper);
251 }
252
253 inputTypesComboBox_->SetSelection(type_);
254}

References inputTypes_, inputTypesComboBox_, WxConversion::toWxString(), and type_.

Here is the call graph for this function:

Member Data Documentation

◆ canSwap_

std::set<int> InputOperandDialog::canSwap_
private

Operands that can be swapped with this operand.

Definition at line 116 of file InputOperandDialog.hh.

Referenced by onAddSwap(), onDeleteSwap(), updateList(), and updateOperand().

◆ elemCount_

int InputOperandDialog::elemCount_
private

Current element count in choice box.

Definition at line 126 of file InputOperandDialog.hh.

Referenced by onElementCount(), onType(), updateElementCounts(), updateElementWidths(), and updateOperand().

◆ elementCountChoice_

wxChoice* InputOperandDialog::elementCountChoice_
private

Choice box for operand element count.

Definition at line 114 of file InputOperandDialog.hh.

Referenced by onElementCount(), and updateElementCounts().

◆ elementWidthSpinCtrl_

wxSpinCtrl* InputOperandDialog::elementWidthSpinCtrl_
private

Spin ctrl for operand element width.

Definition at line 112 of file InputOperandDialog.hh.

Referenced by onElementWidth(), and updateElementWidths().

◆ elemWidth_

int InputOperandDialog::elemWidth_
private

Current element width in choice box.

Definition at line 124 of file InputOperandDialog.hh.

Referenced by onElementWidth(), onType(), updateElementCounts(), updateElementWidths(), and updateOperand().

◆ index_

int InputOperandDialog::index_
private

Index of the input operand currently modified.

Definition at line 120 of file InputOperandDialog.hh.

Referenced by setTexts(), and updateList().

◆ inputTypes_

std::vector<std::string> InputOperandDialog::inputTypes_
private

Input types.

Definition at line 129 of file InputOperandDialog.hh.

Referenced by updateTypes().

◆ inputTypesComboBox_

wxChoice* InputOperandDialog::inputTypesComboBox_
private

Choice box for operation input types.

Definition at line 110 of file InputOperandDialog.hh.

Referenced by onType(), updateOperand(), and updateTypes().

◆ memAddress_

bool InputOperandDialog::memAddress_
private

Flag indicating if operand is memory address.

Definition at line 106 of file InputOperandDialog.hh.

Referenced by updateOperand().

◆ memData_

bool InputOperandDialog::memData_
private

Flag indicating if operand is memory data.

Definition at line 108 of file InputOperandDialog.hh.

Referenced by updateOperand().

◆ numberOfOperands_

int InputOperandDialog::numberOfOperands_
private

Numberof input operands.

Definition at line 118 of file InputOperandDialog.hh.

Referenced by updateList(), and updateOperand().

◆ operand_

Operand* InputOperandDialog::operand_
private

Operand to be created or modified.

Definition at line 104 of file InputOperandDialog.hh.

Referenced by updateOperand().

◆ operandTypes_

Operand::OperandType InputOperandDialog::operandTypes_[9]
private

Definition at line 131 of file InputOperandDialog.hh.

Referenced by updateOperand().

◆ swapChoice_

wxChoice* InputOperandDialog::swapChoice_
private

Choice list for can swap operands.

Definition at line 100 of file InputOperandDialog.hh.

Referenced by onAddSwap(), and updateList().

◆ swapList_

wxListCtrl* InputOperandDialog::swapList_
private

List of can swap operands.

Definition at line 98 of file InputOperandDialog.hh.

Referenced by onDeleteSwap(), onSelection(), setTexts(), and updateList().

◆ swapSizer_

wxStaticBoxSizer* InputOperandDialog::swapSizer_
private

Pointer to can swap sizer.

Definition at line 102 of file InputOperandDialog.hh.

Referenced by createContents(), and setTexts().

◆ type_

int InputOperandDialog::type_
private

Current operand type in choice box.

Definition at line 122 of file InputOperandDialog.hh.

Referenced by onType(), updateElementWidths(), and updateTypes().


The documentation for this class was generated from the following files: