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

#include <ValidateMachineDialog.hh>

Inheritance diagram for ValidateMachineDialog:
Inheritance graph
Collaboration diagram for ValidateMachineDialog:
Collaboration graph

Public Member Functions

 ValidateMachineDialog (wxWindow *parent, const TTAMachine::Machine &machine)
 
 ~ValidateMachineDialog ()
 

Private Types

enum  {
  ID_VALIDATE = 10000 , ID_CLOSE , ID_RESULTS , ID_LINE ,
  ID_CHECK_ANSI_C , ID_CHECK_GLOBAL_CONN_REGISTER
}
 

Private Member Functions

wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 
void onValidate (wxCommandEvent &event)
 
void onClose (wxCommandEvent &event)
 
void onCheck (wxCommandEvent &event)
 

Private Attributes

const TTAMachine::Machinemachine_
 Machine to be validated.
 
wxHtmlWindow * resultsWindow_
 HTML-widget for validation result texts.
 
wxCheckBox * checkAnsiC_
 
wxCheckBox * checkGlobalConnReg_
 

Detailed Description

Dialog for listing and editing address spaces of the machine.

Definition at line 47 of file ValidateMachineDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
ID_VALIDATE 
ID_CLOSE 
ID_RESULTS 
ID_LINE 
ID_CHECK_ANSI_C 
ID_CHECK_GLOBAL_CONN_REGISTER 

Definition at line 68 of file ValidateMachineDialog.hh.

Constructor & Destructor Documentation

◆ ValidateMachineDialog()

ValidateMachineDialog::ValidateMachineDialog ( wxWindow *  parent,
const TTAMachine::Machine machine 
)

The Constructor.

Parameters
parentParent window of the dialog.
machineMachine containing the address spaces.

Definition at line 59 of file ValidateMachineDialog.cc.

61 :
62 wxDialog(parent, -1, _T("Validate Machine"), wxDefaultPosition),
64
65 createContents(this, true, true);
66
67 checkAnsiC_ = dynamic_cast<wxCheckBox*>(FindWindow(ID_CHECK_ANSI_C));
68 checkGlobalConnReg_ = dynamic_cast<wxCheckBox*>(
70
71 FindWindow(ID_VALIDATE)->Disable();
72
73 // Global connection register check in ProgrammabilityValidator
74 // doesn't work for arbitrary machines yet. The global
75 // connection register checkbox is therefore disabled.
76 // Following disable-call can be removed when the
77 // ProgrammabilityValiadtor works for all machines.
78 //FindWindow(ID_CHECK_GLOBAL_CONN_REGISTER)->Disable();
79}
TTAMachine::Machine * machine
the architecture definition of the estimated processor
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
const TTAMachine::Machine & machine_
Machine to be validated.

◆ ~ValidateMachineDialog()

ValidateMachineDialog::~ValidateMachineDialog ( )

The Destructor.

Definition at line 85 of file ValidateMachineDialog.cc.

85 {
86}

Member Function Documentation

◆ createContents()

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

Creates the dialog window contents.

This method was generated with wxDesigner, thus the ugly code and too long lines.

Returns
Main sizer of the created contents.
Parameters
parentThe dialog window.
call_fitIf true, fits the contents inside the dialog.
set_sizerIf true, sets the main sizer as dialog contents.

Definition at line 181 of file ValidateMachineDialog.cc.

182 {
183
184 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
185
186 wxBoxSizer *item1 = new wxBoxSizer( wxVERTICAL );
187
188 wxStaticBox *item3 = new wxStaticBox( parent, -1, wxT("Validate:") );
189 wxStaticBoxSizer *item2 = new wxStaticBoxSizer( item3, wxVERTICAL );
190
191 wxCheckBox *item4 = new wxCheckBox( parent, ID_CHECK_ANSI_C, wxT("Check for operations needed to support ANSI C."), wxDefaultPosition, wxDefaultSize, 0 );
192 item2->Add( item4, 0, wxALL, 5 );
193
194 wxCheckBox *item5 = new wxCheckBox( parent, ID_CHECK_GLOBAL_CONN_REGISTER, wxT("Check for global connection register."), wxDefaultPosition, wxDefaultSize, 0 );
195 item2->Add( item5, 0, wxALL, 5 );
196
197 wxButton *item6 = new wxButton( parent, ID_VALIDATE, wxT("Validate"), wxDefaultPosition, wxDefaultSize, 0 );
198 item2->Add( item6, 0, wxALIGN_RIGHT|wxALL, 5 );
199
200 item1->Add( item2, 0, wxGROW|wxALL, 5 );
201
202 wxStaticBox *item8 = new wxStaticBox( parent, -1, wxT("Results:") );
203 wxStaticBoxSizer *item7 = new wxStaticBoxSizer( item8, wxVERTICAL );
204
205 resultsWindow_ = new wxHtmlWindow(parent, ID_RESULTS, wxDefaultPosition, wxSize(250, 250));
206 wxWindow* item9 = resultsWindow_;
207 wxASSERT( item9 );
208 item7->Add( item9, 0, wxGROW|wxALL, 5 );
209
210 item1->Add( item7, 0, wxGROW|wxALL, 5 );
211
212 item0->Add( item1, 0, wxGROW|wxALL, 5 );
213
214 wxStaticLine *item10 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
215 item0->Add( item10, 0, wxGROW|wxALL, 5 );
216
217 wxButton *item11 = new wxButton( parent, ID_CLOSE, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0 );
218 item0->Add( item11, 0, wxALIGN_RIGHT|wxALL, 5 );
219
220 if (set_sizer)
221 {
222 parent->SetSizer( item0 );
223 if (call_fit)
224 item0->SetSizeHints( parent );
225 }
226
227 return item0;
228}
wxHtmlWindow * resultsWindow_
HTML-widget for validation result texts.

References ID_CHECK_ANSI_C, ID_CHECK_GLOBAL_CONN_REGISTER, ID_CLOSE, ID_LINE, ID_RESULTS, ID_VALIDATE, and resultsWindow_.

◆ onCheck()

void ValidateMachineDialog::onCheck ( wxCommandEvent &  event)
private

Event handler for the checkbox check toggles.

Disables the Validate-button if no checkboxes are checked.

Definition at line 95 of file ValidateMachineDialog.cc.

95 {
96 if (checkAnsiC_->IsChecked() ||
97 checkGlobalConnReg_->IsChecked()) {
98
99 FindWindow(ID_VALIDATE)->Enable();
100 } else {
101 FindWindow(ID_VALIDATE)->Disable();
102 }
103}

References checkAnsiC_, checkGlobalConnReg_, and ID_VALIDATE.

◆ onClose()

void ValidateMachineDialog::onClose ( wxCommandEvent &  event)
private

Event handler for the Close-button.

Closes the dialog.

Definition at line 164 of file ValidateMachineDialog.cc.

164 {
165 Close();
166}

◆ onValidate()

void ValidateMachineDialog::onValidate ( wxCommandEvent &  event)
private

Event handler for the Validate-button.

Validates the machine using a ProgrammabilityValidator. Only checks that are selected with the checkboxes are ran.

Definition at line 113 of file ValidateMachineDialog.cc.

113 {
114
115 bool valid = true;
116
117 wxString resultPage = _T("<html><body><small>");
118
119 std::set<ProgrammabilityValidator::ErrorCode> checks;
120 if (checkGlobalConnReg_->IsChecked()) {
121 checks.insert(
124 }
125 if (checkAnsiC_->IsChecked()) {
126 checks.insert(
128 OPERATION_MISSING_FROM_THE_PRIMITIVE_OPERATION_SET);
129 }
130
131 assert(!checks.empty());
132
133 try {
135
136 ProgrammabilityValidatorResults* results = validator.validate(checks);
137 for (int i = 0; i < results->errorCount(); i++) {
138 valid = false;
139 resultPage.Append(
140 WxConversion::toWxString(results->error(i).second));
141 resultPage.Append(_T("<hr>"));
142 }
143 delete results;
144 results = NULL;
145 } catch (IllegalMachine& e) {
146 valid = false;
147 resultPage.Append(WxConversion::toWxString(e.errorMessage()));
148 }
149 if (valid) {
150 resultPage.Append(
151 _T("<font color=#00c000>Validity checks passed!</font>"));
152 }
153 resultPage.Append(_T("</small></body></html>"));
154 resultsWindow_->SetPage(resultPage);
155}
#define assert(condition)
std::string errorMessage() const
Definition Exception.cc:123
@ GLOBAL_CONNECTION_REGISTER_NOT_FOUND
Global connection register could not be determined.
@ MISSING_CONNECTION
Connection is missing to or from the global connection register.
static wxString toWxString(const std::string &source)

References assert, checkAnsiC_, checkGlobalConnReg_, ProgrammabilityValidatorResults::error(), ProgrammabilityValidatorResults::errorCount(), Exception::errorMessage(), ProgrammabilityValidator::GLOBAL_CONNECTION_REGISTER_NOT_FOUND, machine_, ProgrammabilityValidator::MISSING_CONNECTION, resultsWindow_, WxConversion::toWxString(), and ProgrammabilityValidator::validate().

Here is the call graph for this function:

Member Data Documentation

◆ checkAnsiC_

wxCheckBox* ValidateMachineDialog::checkAnsiC_
private

Definition at line 64 of file ValidateMachineDialog.hh.

Referenced by onCheck(), and onValidate().

◆ checkGlobalConnReg_

wxCheckBox* ValidateMachineDialog::checkGlobalConnReg_
private

Definition at line 65 of file ValidateMachineDialog.hh.

Referenced by onCheck(), and onValidate().

◆ machine_

const TTAMachine::Machine& ValidateMachineDialog::machine_
private

Machine to be validated.

Definition at line 60 of file ValidateMachineDialog.hh.

Referenced by onValidate().

◆ resultsWindow_

wxHtmlWindow* ValidateMachineDialog::resultsWindow_
private

HTML-widget for validation result texts.

Definition at line 62 of file ValidateMachineDialog.hh.

Referenced by createContents(), and onValidate().


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