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

#include <SocketDialog.hh>

Inheritance diagram for SocketDialog:
Inheritance graph
Collaboration diagram for SocketDialog:
Collaboration graph

Public Member Functions

 SocketDialog (wxWindow *parent, TTAMachine::Socket *socket)
 
virtual ~SocketDialog ()
 

Private Types

enum  {
  ID_NAME = 10000, ID_ATTACHED_LIST, ID_DETACHED_LIST, ID_ATTACH,
  ID_DETACH, ID_HELP, ID_DIRECTION, ID_LABEL_NAME,
  ID_LINE
}
 

Private Member Functions

wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 
TTAMachine::Segmentsegment (wxListCtrl *listCtrl, int index)
 
void onOK (wxCommandEvent &)
 
void onHelp (wxCommandEvent &event)
 
void onName (wxCommandEvent &)
 
void onAttach (wxCommandEvent &)
 
void onDetach (wxCommandEvent &)
 
void onAttachedSelection (wxListEvent &)
 
void onDetachedSelection (wxListEvent &)
 
void onDirection (wxCommandEvent &)
 
void updateConnected ()
 
void updateDirection ()
 
virtual bool TransferDataToWindow ()
 
void setTexts ()
 

Private Attributes

TTAMachine::Socketsocket_
 Socket to modify. More...
 
wxString name_
 Name of the socket. More...
 
MachineTestertester_
 MachineTester which does sanity checks for the target machine. More...
 
wxRadioBox * directionBox_
 Radio box for direction. More...
 
wxListCtrl * connectedListCtrl_
 List control for connected (bus, segment) pairs. More...
 
wxListCtrl * segmentListCtrl_
 List control for all (bus, segment) pairs. More...
 
wxStaticBoxSizer * attachedSizer_
 Static boxsizer containing the list of attached buses. More...
 
wxStaticBoxSizer * detachedSizer_
 Static boxsizer containing the list of detached buses. More...
 

Detailed Description

Dialog for modifying socket attributes.

Definition at line 50 of file SocketDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
ID_NAME 
ID_ATTACHED_LIST 
ID_DETACHED_LIST 
ID_ATTACH 
ID_DETACH 
ID_HELP 
ID_DIRECTION 
ID_LABEL_NAME 
ID_LINE 

Definition at line 88 of file SocketDialog.hh.

88  {
89  ID_NAME = 10000,
92  ID_ATTACH,
93  ID_DETACH,
94  ID_HELP,
97  ID_LINE
98  };

Constructor & Destructor Documentation

◆ SocketDialog()

SocketDialog::SocketDialog ( wxWindow *  parent,
TTAMachine::Socket socket 
)

The Constructor.

Parameters
parentParent window of the dialog.
socketSocket to be modified with the dialog.

Definition at line 90 of file SocketDialog.cc.

92  :
93  wxDialog(parent, -1, _T(""), wxDefaultPosition),
94  socket_(socket),
95  directionBox_(NULL),
96  connectedListCtrl_(NULL),
97  segmentListCtrl_(NULL),
98  attachedSizer_(NULL),
99  detachedSizer_(NULL) {
100 
101  createContents(this, true, true);
103 
105 
106  FindWindow(wxID_OK)->Disable();
107  FindWindow(ID_ATTACH)->Disable();
108  FindWindow(ID_DETACH)->Disable();
109 
110  // Set widget pointers.
111  directionBox_ = dynamic_cast<wxRadioBox*>(FindWindow(ID_DIRECTION));
113  dynamic_cast<wxListCtrl*>(FindWindow(ID_ATTACHED_LIST));
115  dynamic_cast<wxListCtrl*>(FindWindow(ID_DETACHED_LIST));
116 
117  // Set widget validators.
118  FindWindow(ID_NAME)->SetValidator(wxTextValidator(wxFILTER_ASCII, &name_));
119 
120  // sets labels for widgets
121  setTexts();
122 
124 }

References WxConversion::toWxString().

Here is the call graph for this function:

◆ ~SocketDialog()

SocketDialog::~SocketDialog ( )
virtual

The Destructor.

Definition at line 130 of file SocketDialog.cc.

130  {
131  delete tester_;
132 }

Member Function Documentation

◆ createContents()

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

Creates the dialog window contents.

This method was initially generated with wxDesigner, code will be cleaned up later.

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 567 of file SocketDialog.cc.

568  {
569 
570  wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
571 
572  wxGridSizer *item1 = new wxGridSizer( 2, 0, 0 );
573 
574  wxBoxSizer *item2 = new wxBoxSizer( wxHORIZONTAL );
575 
576  wxStaticText *item3 = new wxStaticText( parent, ID_LABEL_NAME, wxT("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
577  item2->Add( item3, 0, wxALIGN_CENTER|wxALL, 5 );
578 
579  wxTextCtrl *item4 = new wxTextCtrl( parent, ID_NAME, wxT(""), wxDefaultPosition, wxSize(120,-1), 0 );
580  item2->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 );
581 
582  item1->Add( item2, 0, wxGROW|wxALL, 5 );
583 
584  wxString strs5[] =
585  {
586  wxT("Input"),
587  wxT("Output")
588  };
589  wxRadioBox *item5 = new wxRadioBox( parent, ID_DIRECTION, wxT("Direction:"), wxDefaultPosition, wxDefaultSize, 2, strs5, 1, wxRA_SPECIFY_COLS );
590  item1->Add( item5, 0, wxGROW|wxALL, 5 );
591 
592  item0->Add( item1, 0, wxGROW|wxALL, 5 );
593 
594  wxBoxSizer *item6 = new wxBoxSizer( wxHORIZONTAL );
595 
596  wxStaticBox *item8 = new wxStaticBox( parent, -1, wxT("Attached buses:") );
597  wxStaticBoxSizer *item7 = new wxStaticBoxSizer( item8, wxVERTICAL );
598  attachedSizer_ = item7;
599 
600  wxListCtrl *item9 = new wxListCtrl( parent, ID_ATTACHED_LIST, wxDefaultPosition, wxSize(200,120), wxLC_REPORT|wxSUNKEN_BORDER );
601  item7->Add( item9, 0, wxALIGN_CENTER|wxALL, 5 );
602 
603  item6->Add( item7, 0, wxALIGN_CENTER|wxALL, 5 );
604 
605  wxBoxSizer *item10 = new wxBoxSizer( wxVERTICAL );
606 
607  wxButton *item11 = new wxButton( parent, ID_ATTACH, wxT("&Attach"), wxDefaultPosition, wxDefaultSize, 0 );
608  item10->Add( item11, 0, wxALIGN_CENTER|wxALL, 5 );
609 
610  wxButton *item12 = new wxButton( parent, ID_DETACH, wxT("&Detach"), wxDefaultPosition, wxDefaultSize, 0 );
611  item10->Add( item12, 0, wxALIGN_CENTER|wxALL, 5 );
612 
613  item6->Add( item10, 0, wxALIGN_CENTER|wxALL, 5 );
614 
615  wxStaticBox *item14 = new wxStaticBox( parent, -1, wxT("Detached buses:") );
616  wxStaticBoxSizer *item13 = new wxStaticBoxSizer( item14, wxVERTICAL );
617  detachedSizer_ = item13;
618 
619  wxListCtrl *item15 = new wxListCtrl( parent, ID_DETACHED_LIST, wxDefaultPosition, wxSize(200,120), wxLC_REPORT|wxSUNKEN_BORDER );
620  item13->Add( item15, 0, wxALIGN_CENTER|wxALL, 5 );
621 
622  item6->Add( item13, 0, wxALIGN_CENTER|wxALL, 5 );
623 
624  item0->Add( item6, 0, wxALIGN_CENTER, 5 );
625 
626  wxStaticLine *item16 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
627  item0->Add( item16, 0, wxGROW|wxALL, 5 );
628 
629  wxGridSizer *item17 = new wxGridSizer( 2, 0, 0 );
630 
631  wxButton *item18 = new wxButton( parent, ID_HELP, wxT("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
632  item17->Add( item18, 0, wxALL, 5 );
633 
634  wxBoxSizer *item19 = new wxBoxSizer( wxHORIZONTAL );
635 
636  wxButton *item20 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
637  item19->Add( item20, 0, wxALIGN_CENTER|wxALL, 5 );
638 
639  wxButton *item21 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
640  item19->Add( item21, 0, wxALIGN_CENTER|wxALL, 5 );
641 
642  item17->Add( item19, 0, wxALL, 5 );
643 
644  item0->Add( item17, 0, wxGROW|wxALL, 5 );
645 
646  if (set_sizer)
647  {
648  parent->SetSizer( item0 );
649  if (call_fit)
650  item0->SetSizeHints( parent );
651  }
652 
653  return item0;
654 }

◆ onAttach()

void SocketDialog::onAttach ( wxCommandEvent &  )
private

Attaches selected segments on the segment list to the socket.

Definition at line 364 of file SocketDialog.cc.

364  {
365 
366  long item = -1;
367  item = segmentListCtrl_->GetNextItem(
368  item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
369 
370  // Socket state is saved, so it can be restored if the socket can't
371  // be connected to all selected segments.
372  ObjectState* savedState = socket_->saveState();
373  MachineTester tester(*socket_->machine());
374 
375  // Try to connect socket to all selected segments.
376  while (item != -1) {
377 
378  Segment* seg = segment(segmentListCtrl_, item);
379  assert(seg != NULL);
380 
381  if (!tester.canConnect(*socket_, *seg)) {
382  // Socket couldn't be connected to all selected segments.
383  std::string error =
385  *socket_, *seg, tester);
386  wxString message = WxConversion::toWxString(error);
387  InformationDialog dialog(this, message);
388  dialog.ShowModal();
389  socket_->loadState(savedState);
390  break;
391  }
392  socket_->attachBus(*seg);
393  item = segmentListCtrl_->GetNextItem(
394  item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
395  }
396  delete savedState;
397  savedState = NULL;
398 
399  updateConnected();
400  updateDirection();
401 
402  // Select the first item in the segment list (if possible) to improve
403  // the dialog usability.
404  if (segmentListCtrl_->GetItemCount() > 0) {
405  segmentListCtrl_->SetItemState(
406  0, wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED,
407  wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED);
408  }
409 
410  wxListEvent dummy;
412 
413 }

References assert, MachineTester::canConnect(), dummy, MachineTestReporter::socketSegmentConnectionError(), and WxConversion::toWxString().

Here is the call graph for this function:

◆ onAttachedSelection()

void SocketDialog::onAttachedSelection ( wxListEvent &  )
private

Disables and enables Detach button under the connected list.

If a (bus, segment) pair is selected, button is enabled. If no (bus, segment) pair is selected the button will be disabled.

Definition at line 530 of file SocketDialog.cc.

530  {
531  if (connectedListCtrl_->GetSelectedItemCount() < 1) {
532  FindWindow(ID_DETACH)->Disable();
533  return;
534  }
535  FindWindow(ID_DETACH)->Enable();
536 }

◆ onDetach()

void SocketDialog::onDetach ( wxCommandEvent &  )
private

Detaches selected segments on the connection list from the socket.

Definition at line 419 of file SocketDialog.cc.

419  {
420 
421  long item = -1;
422  item = connectedListCtrl_->GetNextItem(
423  item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
424 
425  // Detach socket from all selected segments.
426  while (item != -1) {
427  Segment* seg = segment(connectedListCtrl_, item);
428  assert(seg != NULL);
429  socket_->detachBus(*seg);
430  item = connectedListCtrl_->GetNextItem(
431  item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
432  }
433 
434  updateConnected();
435  updateDirection();
436  wxListEvent dummy;
438 
439 }

References assert, and dummy.

◆ onDetachedSelection()

void SocketDialog::onDetachedSelection ( wxListEvent &  )
private

Disables and enables Attach button under the connected list.

If a (bus, segment) pair is selected, button is enabled. If no (bus, segment) pair is selected the button will be disabled.

Definition at line 546 of file SocketDialog.cc.

546  {
547  if (segmentListCtrl_->GetSelectedItemCount() < 1) {
548  FindWindow(ID_ATTACH)->Disable();
549  return;
550  }
551  FindWindow(ID_ATTACH)->Enable();
552 }

◆ onDirection()

void SocketDialog::onDirection ( wxCommandEvent &  )
private

Checks whether socket direction can be changed.

Due to the port connections to the sockets it might be impossible. If the socket is connected to the port already containing a connection to socket of this direction, changing the direction is not allowed.

Definition at line 315 of file SocketDialog.cc.

315  {
316 
317  wxString direction = directionBox_->GetStringSelection();
318 
319  if (direction.IsSameAs(ProDeConstants::SOCKET_DIRECTION_INPUT) &&
320  !tester_->canSetDirection(*socket_, Socket::INPUT)) {
321 
322  // It wasn't legal to change the direction to input,
323  // display an error message.
324  string message =
326  *socket_, Socket::INPUT, *tester_);
327 
328  WarningDialog dialog(this, WxConversion::toWxString(message));
329  dialog.ShowModal();
330  directionBox_->SetStringSelection(
332 
333  } else if(direction.IsSameAs(ProDeConstants::SOCKET_DIRECTION_OUTPUT) &&
334  !tester_->canSetDirection(*socket_, Socket::OUTPUT)) {
335 
336  // It wasn't legal to change the direction to output,
337  // display an error message.
338  string message =
340  *socket_, Socket::OUTPUT, *tester_);
341 
342  WarningDialog dialog(this, WxConversion::toWxString(message));
343 
344  dialog.ShowModal();
345  directionBox_->SetStringSelection(
347  }
348 
349  direction = directionBox_->GetStringSelection();
350 
351  if (direction.IsSameAs(ProDeConstants::SOCKET_DIRECTION_INPUT)) {
352  socket_->setDirection(Socket::INPUT);
353  }
354  if (direction.IsSameAs(ProDeConstants::SOCKET_DIRECTION_OUTPUT)) {
355  socket_->setDirection(Socket::OUTPUT);
356  }
357 }

References TTAMachine::Socket::INPUT, TTAMachine::Socket::OUTPUT, ProDeConstants::SOCKET_DIRECTION_INPUT, ProDeConstants::SOCKET_DIRECTION_OUTPUT, MachineTestReporter::socketDirectionSettingError(), and WxConversion::toWxString().

Here is the call graph for this function:

◆ onHelp()

void SocketDialog::onHelp ( wxCommandEvent &  event)
private

◆ onName()

void SocketDialog::onName ( wxCommandEvent &  )
private

Enables and disables OK button based on input in the socket name.

Definition at line 293 of file SocketDialog.cc.

293  {
294  if (!TransferDataFromWindow()) {
295  assert(false);
296  }
297  wxString trimmedName = name_.Trim(false).Trim(true);
298  if (trimmedName == _T("")) {
299  FindWindow(wxID_OK)->Disable();
300  } else {
301  FindWindow(wxID_OK)->Enable();
302  }
303 }

References assert.

◆ onOK()

void SocketDialog::onOK ( wxCommandEvent &  )
private

Validates input in the controls, and updates the Socket.

Definition at line 236 of file SocketDialog.cc.

236  {
237 
238  if (!Validate()) {
239  return;
240  }
241  if (!TransferDataFromWindow()) {
242  return;
243  }
244 
245  string trimmedName =
246  WxConversion::toString(name_.Trim(false).Trim(true));
247 
248  // Check the name validity.
249  if (!MachineTester::isValidComponentName(trimmedName)) {
251  format message =
253  InformationDialog warning(
254  this, WxConversion::toWxString(message.str()));
255  warning.ShowModal();
256  return;
257  }
258 
259  if (trimmedName != socket_->name()) {
260  Machine::SocketNavigator navigator =
262  for (int i = 0; i < navigator.count(); i++) {
263  Socket* socket = navigator.item(i);
264  if (trimmedName == socket->name()) {
265  ProDeTextGenerator* prodeTexts =
267  format message =
269  format a_soc =
271  format machine =
273  format soc =
275  message %
276  trimmedName % a_soc.str() % machine.str() % soc.str();
277  WarningDialog warning(
278  this, WxConversion::toWxString(message.str()));
279  warning.ShowModal();
280  return;
281  }
282  }
283  }
284  socket_->setName(trimmedName);
285  EndModal(wxID_OK);
286 }

References ProDeTextGenerator::COMP_A_SOCKET, ProDeTextGenerator::COMP_MACHINE, ProDeTextGenerator::COMP_SOCKET, TTAMachine::Machine::Navigator< ComponentType >::count(), ProDeTextGenerator::instance(), MachineTester::isValidComponentName(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine, ProDeTextGenerator::MSG_ERROR_ILLEGAL_NAME, ProDeTextGenerator::MSG_ERROR_SAME_NAME, TTAMachine::Component::name(), Texts::TextGenerator::text(), WxConversion::toString(), and WxConversion::toWxString().

Here is the call graph for this function:

◆ segment()

Segment * SocketDialog::segment ( wxListCtrl *  listCtrl,
int  index 
)
private

Returns pointer to a segment with given index on a list.

Parameters
listCtrlList containing the segment.
indexList index of the segment.
Returns
Pointer to the segment.

Definition at line 449 of file SocketDialog.cc.

449  {
450 
451  wxListItem busItem;
452  busItem.SetId(index);
453  busItem.SetColumn(0);
454  listCtrl->GetItem(busItem);
455  string busName = WxConversion::toString(busItem.GetText());
456 
457  wxListItem segItem;
458  segItem.SetId(index);
459  segItem.SetColumn(1);
460  listCtrl->GetItem(segItem);
461  string segmentName = WxConversion::toString(segItem.GetText());
462 
464  Segment* segment = navigator.item(busName)->segment(segmentName);
465  return segment;
466 }

References TTAMachine::Machine::Navigator< ComponentType >::item(), and WxConversion::toString().

Here is the call graph for this function:

◆ setTexts()

void SocketDialog::setTexts ( )
private

Sets texts for widgets.

Definition at line 139 of file SocketDialog.cc.

139  {
142 
143  // Dialog title
144  format fmt = prodeTexts->text(ProDeTextGenerator::TXT_SOCKET_DIALOG_TITLE);
145  SetTitle(WxConversion::toWxString(fmt.str()));
146 
147  // buttons
148  WidgetTools::setLabel(generator, FindWindow(wxID_OK),
150 
151  WidgetTools::setLabel(generator, FindWindow(wxID_CANCEL),
153 
156 
159 
162 
163  // widget labels
166 
169 
170  // box sizer label
173 
176 
177  // Create list columns.
178  wxListCtrl* attachedList =
179  dynamic_cast<wxListCtrl*>(FindWindow(ID_ATTACHED_LIST));
180  fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_BUS);
181  attachedList->InsertColumn(0, WxConversion::toWxString(fmt.str()),
182  wxLIST_FORMAT_LEFT, 100);
183  fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_SEGMENT);
184  attachedList->InsertColumn(1, WxConversion::toWxString(fmt.str()),
185  wxLIST_FORMAT_LEFT, 80);
186 
187  wxListCtrl* detachedList =
188  dynamic_cast<wxListCtrl*>(FindWindow(ID_DETACHED_LIST));
189  fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_BUS);
190  detachedList->InsertColumn(0, WxConversion::toWxString(fmt.str()),
191  wxLIST_FORMAT_LEFT, 100);
192  fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_SEGMENT);
193  detachedList->InsertColumn(1, WxConversion::toWxString(fmt.str()),
194  wxLIST_FORMAT_LEFT, 80);
195 
196  // Radio button labels
198  directionBox_->SetString(0, WxConversion::toWxString(fmt.str()));
200  directionBox_->SetString(1, WxConversion::toWxString(fmt.str()));
201 }

References GUITextGenerator::instance(), ProDeTextGenerator::instance(), WidgetTools::setLabel(), WidgetTools::setWidgetLabel(), Texts::TextGenerator::text(), WxConversion::toWxString(), ProDeTextGenerator::TXT_BUTTON_ATTACH, GUITextGenerator::TXT_BUTTON_CANCEL, ProDeTextGenerator::TXT_BUTTON_DETACH, GUITextGenerator::TXT_BUTTON_HELP, GUITextGenerator::TXT_BUTTON_OK, ProDeTextGenerator::TXT_COLUMN_BUS, ProDeTextGenerator::TXT_COLUMN_SEGMENT, ProDeTextGenerator::TXT_LABEL_DIRECTION, ProDeTextGenerator::TXT_LABEL_NAME, ProDeTextGenerator::TXT_RADIO_DIRECTION_INPUT, ProDeTextGenerator::TXT_RADIO_DIRECTION_OUTPUT, ProDeTextGenerator::TXT_SOCKET_ATTACHED_BOX, ProDeTextGenerator::TXT_SOCKET_DETACHED_BOX, and ProDeTextGenerator::TXT_SOCKET_DIALOG_TITLE.

Here is the call graph for this function:

◆ TransferDataToWindow()

bool SocketDialog::TransferDataToWindow ( )
privatevirtual

Transfers data from the socket object to the dialog widgets.

Definition at line 208 of file SocketDialog.cc.

208  {
209  // Socket direction.
210  updateDirection();
211  updateConnected();
212  return wxDialog::TransferDataToWindow();
213 }

◆ updateConnected()

void SocketDialog::updateConnected ( )
private

Updates connected list elements.

Definition at line 474 of file SocketDialog.cc.

474  {
475 
476  connectedListCtrl_->DeleteAllItems();
477  segmentListCtrl_->DeleteAllItems();
478 
479  // update connections list
480  for (int i = 0; i < socket_->segmentCount(); i++) {
481 
483 
484  wxString segmentName =
486  wxString busName =
488 
489  connectedListCtrl_->InsertItem(i, busName);
490  connectedListCtrl_->SetItem(i, 1, segmentName);
491  }
492 
493  // update list of segments available for connection
495  int segments = 0;
496  for (int i = 0; i < navigator.count(); i++) {
497  Bus* bus = navigator.item(i);
498  for (int j = 0; j < bus->segmentCount(); j++) {
499  Segment* segment = bus->segment(j);
500  if (tester_->canConnect(*socket_, *segment)) {
501  wxString segmentName =
503  wxString busName =
505 
506  segmentListCtrl_->InsertItem(segments, busName);
507  segmentListCtrl_->SetItem(segments, 1, segmentName);
508  segments++;
509  }
510  }
511  }
512 
513  // Disable the direction control if the socket is not
514  // connected to a bus.
515  if (socket_->segmentCount() > 0) {
516  FindWindow(ID_DIRECTION)->Enable();
517  } else {
518  FindWindow(ID_DIRECTION)->Disable();
519  }
520 }

References TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Segment::name(), TTAMachine::Component::name(), TTAMachine::Segment::parentBus(), TTAMachine::Bus::segment(), TTAMachine::Bus::segmentCount(), and WxConversion::toWxString().

Here is the call graph for this function:

◆ updateDirection()

void SocketDialog::updateDirection ( )
private

Updates the direction choicer.

Definition at line 220 of file SocketDialog.cc.

220  {
221  if (socket_->direction() == Socket::INPUT) {
222  directionBox_->SetStringSelection(
224  } else if (socket_->direction() == Socket::OUTPUT) {
225  directionBox_->SetStringSelection(
227  }
228 
229 }

References TTAMachine::Socket::INPUT, TTAMachine::Socket::OUTPUT, ProDeConstants::SOCKET_DIRECTION_INPUT, and ProDeConstants::SOCKET_DIRECTION_OUTPUT.

Member Data Documentation

◆ attachedSizer_

wxStaticBoxSizer* SocketDialog::attachedSizer_
private

Static boxsizer containing the list of attached buses.

Definition at line 84 of file SocketDialog.hh.

◆ connectedListCtrl_

wxListCtrl* SocketDialog::connectedListCtrl_
private

List control for connected (bus, segment) pairs.

Definition at line 80 of file SocketDialog.hh.

◆ detachedSizer_

wxStaticBoxSizer* SocketDialog::detachedSizer_
private

Static boxsizer containing the list of detached buses.

Definition at line 86 of file SocketDialog.hh.

◆ directionBox_

wxRadioBox* SocketDialog::directionBox_
private

Radio box for direction.

Definition at line 78 of file SocketDialog.hh.

◆ name_

wxString SocketDialog::name_
private

Name of the socket.

Definition at line 74 of file SocketDialog.hh.

◆ segmentListCtrl_

wxListCtrl* SocketDialog::segmentListCtrl_
private

List control for all (bus, segment) pairs.

Definition at line 82 of file SocketDialog.hh.

◆ socket_

TTAMachine::Socket* SocketDialog::socket_
private

Socket to modify.

Definition at line 72 of file SocketDialog.hh.

◆ tester_

MachineTester* SocketDialog::tester_
private

MachineTester which does sanity checks for the target machine.

Definition at line 76 of file SocketDialog.hh.


The documentation for this class was generated from the following files:
ProDeTextGenerator::TXT_SOCKET_DETACHED_BOX
@ TXT_SOCKET_DETACHED_BOX
Label for Detached buses box.
Definition: ProDeTextGenerator.hh:218
SocketDialog::segmentListCtrl_
wxListCtrl * segmentListCtrl_
List control for all (bus, segment) pairs.
Definition: SocketDialog.hh:82
MachineTester::canConnect
virtual bool canConnect(const TTAMachine::Socket &socket, const TTAMachine::Segment &segment)
Definition: MachineTester.cc:86
WarningDialog
Definition: WarningDialog.hh:42
SocketDialog::updateConnected
void updateConnected()
Definition: SocketDialog.cc:474
ProDeTextGenerator::TXT_LABEL_DIRECTION
@ TXT_LABEL_DIRECTION
Label for direction widget.
Definition: ProDeTextGenerator.hh:90
ProDeTextGenerator::COMP_A_SOCKET
@ COMP_A_SOCKET
Name for socket (w/ article).
Definition: ProDeTextGenerator.hh:280
WxConversion::toWxString
static wxString toWxString(const std::string &source)
SocketDialog::segment
TTAMachine::Segment * segment(wxListCtrl *listCtrl, int index)
Definition: SocketDialog.cc:449
SocketDialog::detachedSizer_
wxStaticBoxSizer * detachedSizer_
Static boxsizer containing the list of detached buses.
Definition: SocketDialog.hh:86
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
TTAMachine::Segment
Definition: Segment.hh:54
SocketDialog::TransferDataToWindow
virtual bool TransferDataToWindow()
Definition: SocketDialog.cc:208
WidgetTools::setLabel
static void setLabel(Texts::TextGenerator *generator, wxWindow *widget, int textID)
Definition: WidgetTools.cc:92
TTAMachine::Bus
Definition: Bus.hh:53
SocketDialog::ID_ATTACHED_LIST
@ ID_ATTACHED_LIST
Definition: SocketDialog.hh:90
GUITextGenerator::instance
static GUITextGenerator * instance()
Definition: GUITextGenerator.cc:67
MachineTestReporter::socketDirectionSettingError
static std::string socketDirectionSettingError(const TTAMachine::Socket &socket, TTAMachine::Socket::Direction, const MachineTester &tester)
Definition: MachineTestReporter.cc:299
SocketDialog::ID_ATTACH
@ ID_ATTACH
Definition: SocketDialog.hh:92
TTAMachine::Socket::loadState
virtual void loadState(const ObjectState *state)
Definition: Socket.cc:502
GUITextGenerator
Definition: GUITextGenerator.hh:46
ObjectState
Definition: ObjectState.hh:59
GUITextGenerator::TXT_BUTTON_HELP
@ TXT_BUTTON_HELP
Label for help button.
Definition: GUITextGenerator.hh:60
SocketDialog::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition: SocketDialog.cc:567
SocketDialog::ID_DIRECTION
@ ID_DIRECTION
Definition: SocketDialog.hh:95
FindWindow
Definition: FindWindow.hh:49
MachineTestReporter::socketSegmentConnectionError
static std::string socketSegmentConnectionError(const TTAMachine::Socket &socket, const TTAMachine::Segment &segment, const MachineTester &tester)
Definition: MachineTestReporter.cc:55
TTAMachine::Socket::segment
Segment * segment(int index) const
Definition: Socket.cc:401
ProDeTextGenerator::TXT_BUTTON_DETACH
@ TXT_BUTTON_DETACH
Label for detach button.
Definition: ProDeTextGenerator.hh:141
TTAMachine::Machine::Navigator::count
int count() const
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
TTAMachine::Socket::direction
Direction direction() const
TTAMachine::Bus::segment
virtual Segment * segment(int index) const
Definition: Bus.cc:329
TTAMachine::Socket::saveState
virtual ObjectState * saveState() const
Definition: Socket.cc:465
ProDeTextGenerator
Definition: ProDeTextGenerator.hh:49
ProDeTextGenerator::MSG_ERROR_ILLEGAL_NAME
@ MSG_ERROR_ILLEGAL_NAME
Error: Illegal component name.
Definition: ProDeTextGenerator.hh:223
SocketDialog::onAttachedSelection
void onAttachedSelection(wxListEvent &)
Definition: SocketDialog.cc:530
ProDeConstants::SOCKET_DIRECTION_OUTPUT
static const wxString SOCKET_DIRECTION_OUTPUT
String for the socket direction output.
Definition: ProDeConstants.hh:69
ProDeTextGenerator::TXT_COLUMN_SEGMENT
@ TXT_COLUMN_SEGMENT
Label for segment column.
Definition: ProDeTextGenerator.hh:127
ProDeTextGenerator::MSG_ERROR_SAME_NAME
@ MSG_ERROR_SAME_NAME
Error: Same name exists.
Definition: ProDeTextGenerator.hh:229
assert
#define assert(condition)
Definition: Application.hh:86
SocketDialog::ID_NAME
@ ID_NAME
Definition: SocketDialog.hh:89
GUITextGenerator::TXT_BUTTON_CANCEL
@ TXT_BUTTON_CANCEL
Label for cancel button.
Definition: GUITextGenerator.hh:55
SocketDialog::ID_LINE
@ ID_LINE
Definition: SocketDialog.hh:97
TTAMachine::Socket::attachBus
void attachBus(Segment &bus)
Definition: Socket.cc:166
ProDeTextGenerator::TXT_COLUMN_BUS
@ TXT_COLUMN_BUS
Label for bus column in a list.
Definition: ProDeTextGenerator.hh:126
ProDeConstants::SOCKET_DIRECTION_INPUT
static const wxString SOCKET_DIRECTION_INPUT
String for the socket direction: input.
Definition: ProDeConstants.hh:67
TTAMachine::Segment::parentBus
Bus * parentBus() const
SocketDialog::onDetachedSelection
void onDetachedSelection(wxListEvent &)
Definition: SocketDialog.cc:546
dummy
SimValue dummy(32)
a dummy simvalue which is given for operands that are not bound
SocketDialog::name_
wxString name_
Name of the socket.
Definition: SocketDialog.hh:74
ProDeTextGenerator::COMP_SOCKET
@ COMP_SOCKET
Name for socket (w/o article).
Definition: ProDeTextGenerator.hh:281
TTAMachine::Socket
Definition: Socket.hh:53
ProDeTextGenerator::TXT_LABEL_NAME
@ TXT_LABEL_NAME
Label for component name widget.
Definition: ProDeTextGenerator.hh:56
SocketDialog::updateDirection
void updateDirection()
Definition: SocketDialog.cc:220
ProDeTextGenerator::TXT_SOCKET_DIALOG_TITLE
@ TXT_SOCKET_DIALOG_TITLE
Socket dialog title.
Definition: ProDeTextGenerator.hh:216
ProDeTextGenerator::TXT_RADIO_DIRECTION_INPUT
@ TXT_RADIO_DIRECTION_INPUT
Label for input radio button.
Definition: ProDeTextGenerator.hh:102
TTAMachine::Socket::setName
virtual void setName(const std::string &name)
Definition: Socket.cc:103
MachineTester::isValidComponentName
static bool isValidComponentName(const std::string &name)
Definition: MachineTester.cc:312
TTAMachine::Machine::socketNavigator
virtual SocketNavigator socketNavigator() const
Definition: Machine.cc:368
TTAMachine::Socket::setDirection
void setDirection(Direction direction)
Definition: Socket.cc:130
TTAMachine::Socket::detachBus
void detachBus(Segment &bus)
Definition: Socket.cc:213
ProDeTextGenerator::TXT_BUTTON_ATTACH
@ TXT_BUTTON_ATTACH
Label for attach button.
Definition: ProDeTextGenerator.hh:140
SocketDialog::ID_DETACH
@ ID_DETACH
Definition: SocketDialog.hh:93
ProDeTextGenerator::instance
static ProDeTextGenerator * instance()
Definition: ProDeTextGenerator.cc:382
SocketDialog::ID_DETACHED_LIST
@ ID_DETACHED_LIST
Definition: SocketDialog.hh:91
TTAMachine::Component::machine
virtual Machine * machine() const
MachineTester::canSetDirection
virtual bool canSetDirection(const TTAMachine::Socket &socket, TTAMachine::Socket::Direction direction)
Definition: MachineTester.cc:283
SocketDialog::tester_
MachineTester * tester_
MachineTester which does sanity checks for the target machine.
Definition: SocketDialog.hh:76
SocketDialog::setTexts
void setTexts()
Definition: SocketDialog.cc:139
TTAMachine::Machine::busNavigator
virtual BusNavigator busNavigator() const
Definition: Machine.cc:356
SocketDialog::ID_LABEL_NAME
@ ID_LABEL_NAME
Definition: SocketDialog.hh:96
SocketDialog::socket_
TTAMachine::Socket * socket_
Socket to modify.
Definition: SocketDialog.hh:72
SocketDialog::connectedListCtrl_
wxListCtrl * connectedListCtrl_
List control for connected (bus, segment) pairs.
Definition: SocketDialog.hh:80
ProDeTextGenerator::COMP_MACHINE
@ COMP_MACHINE
Text for machine description.
Definition: ProDeTextGenerator.hh:252
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
WidgetTools::setWidgetLabel
static void setWidgetLabel(wxWindow *widget, std::string text)
Definition: WidgetTools.cc:52
InformationDialog
Definition: InformationDialog.hh:42
TTAMachine::Socket::segmentCount
int segmentCount() const
TTAMachine::Segment::name
std::string name() const
ProDeTextGenerator::TXT_SOCKET_ATTACHED_BOX
@ TXT_SOCKET_ATTACHED_BOX
Label for Attached buses box.
Definition: ProDeTextGenerator.hh:217
MachineTester
Definition: MachineTester.hh:46
WxConversion::toString
static std::string toString(const wxString &source)
TTAMachine::Machine::Navigator
Definition: Machine.hh:186
TTAMachine::Bus::segmentCount
virtual int segmentCount() const
Definition: Bus.cc:385
SocketDialog::attachedSizer_
wxStaticBoxSizer * attachedSizer_
Static boxsizer containing the list of attached buses.
Definition: SocketDialog.hh:84
SocketDialog::ID_HELP
@ ID_HELP
Definition: SocketDialog.hh:94
SocketDialog::directionBox_
wxRadioBox * directionBox_
Radio box for direction.
Definition: SocketDialog.hh:78
GUITextGenerator::TXT_BUTTON_OK
@ TXT_BUTTON_OK
Label for OK button.
Definition: GUITextGenerator.hh:59
ProDeTextGenerator::TXT_RADIO_DIRECTION_OUTPUT
@ TXT_RADIO_DIRECTION_OUTPUT
Label for output radio button.
Definition: ProDeTextGenerator.hh:103