OpenASIP  2.0
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
MachineDialog Class Reference

#include <MachineDialog.hh>

Inheritance diagram for MachineDialog:
Inheritance graph
Collaboration diagram for MachineDialog:
Collaboration graph

Public Member Functions

 MachineDialog (wxWindow *parent, TTAMachine::Machine &machine)
 
virtual ~MachineDialog ()
 

Private Types

enum  { ID_ENDIANESS_CHOICE = 10000 }
 

Private Member Functions

wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 
virtual bool TransferDataToWindow ()
 
void onOK (wxCommandEvent &event)
 
void onCancel (wxCommandEvent &event)
 

Private Attributes

TTAMachine::Machinemachine_
 The machine to modify. More...
 
wxChoice * endianessChoise_
 

Detailed Description

Dialog for editing processor wide properties.

Definition at line 48 of file MachineDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
ID_ENDIANESS_CHOICE 

Definition at line 63 of file MachineDialog.hh.

63  {
64  ID_ENDIANESS_CHOICE = 10000
65  };

Constructor & Destructor Documentation

◆ MachineDialog()

MachineDialog::MachineDialog ( wxWindow *  parent,
TTAMachine::Machine machine 
)

The Constructor.

Parameters
parentParent window of the dialog.
machineThe machine to modify.

Definition at line 54 of file MachineDialog.cc.

54  :
55  wxDialog(parent, -1, _T(""), wxDefaultPosition),
56  machine_(machine) {
57 
58  createContents(this, true, true);
59  SetTitle(wxT("Architecture Features"));
60  endianessChoise_->Append(wxT("Big-endian"));
61  endianessChoise_->Append(wxT("Little-endian"));
63 }

References createContents(), endianessChoise_, and TransferDataToWindow().

Here is the call graph for this function:

◆ ~MachineDialog()

MachineDialog::~MachineDialog ( )
virtual

The Destructor.

Definition at line 69 of file MachineDialog.cc.

69  {
70 
71 }

Member Function Documentation

◆ createContents()

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

Creates contents of the dialog window.

Parameters
parentParent dialog of the contents.
call_fitIf true, fits sizer in dialog window.
set_sizerIf true, sets sizer as dialog's sizer.
Returns
Top level sizer of the contents.

Definition at line 120 of file MachineDialog.cc.

121  {
122 
123  wxBoxSizer *root = new wxBoxSizer(wxVERTICAL);
124  wxFlexGridSizer *machSettings = new wxFlexGridSizer(2, 0, 0);
125 
126  // Global Endianess Setting //
127  // Label
128  wxStaticText *endianessLabel = new wxStaticText(parent, -1,
129  wxT("Endianess:"), wxDefaultPosition, wxDefaultSize, 0 );
130  machSettings->Add(endianessLabel,
131  0, wxALIGN_RIGHT|wxALL, 5);
132  // Choice
133  endianessChoise_ = new wxChoice(parent, ID_ENDIANESS_CHOICE,
134  wxDefaultPosition, wxDefaultSize);
135  machSettings->Add(endianessChoise_,
136  0, wxALL, 5);
137 
138  root->Add(machSettings, 0, wxALIGN_CENTER|wxALL, 5);
139 
140  // Buttons //
141  wxStaticLine *horizLine = new wxStaticLine(parent, wxID_ANY,
142  wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL);
143  root->Add(horizLine, 0, wxGROW|wxALL, 5);
144  wxBoxSizer *buttonBox = new wxBoxSizer(wxHORIZONTAL);
145  // Ok button
146  wxButton *okButton =
147  new wxButton(parent, wxID_OK, wxT("&OK"), wxDefaultPosition,
148  wxDefaultSize, 0);
149  buttonBox->Add(okButton, 0, wxALIGN_CENTER|wxALL, 5);
150  // Cancel Button
151  wxButton *cancelButton =
152  new wxButton(parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition,
153  wxDefaultSize, 0);
154  buttonBox->Add(cancelButton, 0, wxALIGN_CENTER|wxALL, 5);
155  root->Add(buttonBox, 0, wxALIGN_CENTER|wxALL, 5);
156 
157  if (set_sizer) {
158  parent->SetAutoLayout(TRUE);
159  parent->SetSizer(root);
160  if (call_fit)
161  {
162  root->Fit(parent);
163  root->SetSizeHints(parent);
164  }
165  }
166  return root;
167 }

References endianessChoise_, ID_ENDIANESS_CHOICE, and TRUE.

Referenced by MachineDialog().

◆ onCancel()

void MachineDialog::onCancel ( wxCommandEvent &  event)
private

Event handler for Cancel button press.

Definition at line 106 of file MachineDialog.cc.

106  {
107  EndModal(wxID_CANCEL);
108 }

◆ onOK()

void MachineDialog::onOK ( wxCommandEvent &  event)
private

Event handler for Ok button press.

Definition at line 96 of file MachineDialog.cc.

96  {
98  EndModal(wxID_OK);
99 }

References endianessChoise_, LITTLEENDIAN, machine_, and TTAMachine::Machine::setLittleEndian().

Here is the call graph for this function:

◆ TransferDataToWindow()

bool MachineDialog::TransferDataToWindow ( )
privatevirtual

Transfers data from the port object to the dialog widgets.

Returns
False, if an error occured in the transfer.

Definition at line 80 of file MachineDialog.cc.

80  {
81  assert(endianessChoise_->GetCount() > 1); // Assume
82  if (machine_.isLittleEndian()) {
83  endianessChoise_->SetSelection(LITTLEENDIAN);
84  } else {
85  endianessChoise_->SetSelection(BIGENDIAN);
86  }
87 
88  return wxWindow::TransferDataToWindow();
89 }

References assert, BIGENDIAN, endianessChoise_, TTAMachine::Machine::isLittleEndian(), LITTLEENDIAN, and machine_.

Referenced by MachineDialog().

Here is the call graph for this function:

Member Data Documentation

◆ endianessChoise_

wxChoice* MachineDialog::endianessChoise_
private

Definition at line 61 of file MachineDialog.hh.

Referenced by createContents(), MachineDialog(), onOK(), and TransferDataToWindow().

◆ machine_

TTAMachine::Machine& MachineDialog::machine_
private

The machine to modify.

Definition at line 60 of file MachineDialog.hh.

Referenced by onOK(), and TransferDataToWindow().


The documentation for this class was generated from the following files:
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
MachineDialog::machine_
TTAMachine::Machine & machine_
The machine to modify.
Definition: MachineDialog.hh:60
MachineDialog::ID_ENDIANESS_CHOICE
@ ID_ENDIANESS_CHOICE
Definition: MachineDialog.hh:64
BIGENDIAN
@ BIGENDIAN
Definition: MachineDialog.cc:46
TTAMachine::Machine::isLittleEndian
bool isLittleEndian() const
Definition: Machine.hh:258
assert
#define assert(condition)
Definition: Application.hh:86
MachineDialog::TransferDataToWindow
virtual bool TransferDataToWindow()
Definition: MachineDialog.cc:80
TRUE
const string TRUE
Value used for true in attribute and element values.
Definition: GUIOptionsSerializer.cc:65
TTAMachine::Machine::setLittleEndian
void setLittleEndian(bool flag)
Definition: Machine.hh:259
MachineDialog::endianessChoise_
wxChoice * endianessChoise_
Definition: MachineDialog.hh:61
LITTLEENDIAN
@ LITTLEENDIAN
Definition: MachineDialog.cc:46
MachineDialog::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition: MachineDialog.cc:120