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

#include <SimulationInfoDialog.hh>

Inheritance diagram for SimulationInfoDialog:
Inheritance graph
Collaboration diagram for SimulationInfoDialog:
Collaboration graph

Public Member Functions

 SimulationInfoDialog (wxWindow *parent, OperationContext *context)
 
virtual ~SimulationInfoDialog ()
 
virtual void handleEvent (OSEdInformer::EventId id)
 
- Public Member Functions inherited from OSEdListener
 OSEdListener ()
 
virtual ~OSEdListener ()
 

Private Types

enum  { ID_LISTCTRL }
 

Private Member Functions

 SimulationInfoDialog (const SimulationInfoDialog &)
 Copying not allowed. More...
 
SimulationInfoDialogoperator= (const SimulationInfoDialog &)
 Assignment not allowed. More...
 
wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 
virtual bool TransferDataToWindow ()
 
void setTexts ()
 
void updateList ()
 

Private Attributes

wxListCtrl * infoList_
 List for showing simulation statistics. More...
 
SimulateDialogparent_
 Parent window. More...
 
OperationContextcontext_
 Operation context for retrieving simulation data. More...
 

Detailed Description

Dialog that holds additional information about simulation.

Definition at line 48 of file SimulationInfoDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Component ids.

Enumerator
ID_LISTCTRL 

Definition at line 69 of file SimulationInfoDialog.hh.

69  {
71  };

Constructor & Destructor Documentation

◆ SimulationInfoDialog() [1/2]

SimulationInfoDialog::SimulationInfoDialog ( wxWindow *  parent,
OperationContext context 
)

Constructor.

Parameters
parentParent window.
contextOperation context.

Definition at line 55 of file SimulationInfoDialog.cc.

57  :
58  wxDialog(parent, -1, _T(""),
60  wxSize(400, 150), wxRESIZE_BORDER), context_(context) {
61 
62  createContents(this, false, true);
63 
64  parent_ = dynamic_cast<SimulateDialog*>(parent);
65 
66  infoList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_LISTCTRL));
67  infoList_->InsertColumn(0, _T(""), wxLIST_FORMAT_LEFT,
69  infoList_->InsertColumn(1, _T(""), wxLIST_FORMAT_LEFT,
71 
73 
74  format fmt = texts.text(OSEdTextGenerator::TXT_LABEL_PC);
75  infoList_->InsertItem(0, WxConversion::toWxString(fmt.str()));
76 
78  infoList_->InsertItem(1, WxConversion::toWxString(fmt.str()));
79 
81  infoList_->InsertItem(2, WxConversion::toWxString(fmt.str()));
82 
84  infoList_->InsertItem(3, WxConversion::toWxString(fmt.str()));
85 
86  setTexts();
87 }

References createContents(), OSEdConstants::DEFAULT_COLUMN_WIDTH, ID_LISTCTRL, infoList_, OSEdTextGenerator::instance(), parent_, setTexts(), Texts::TextGenerator::text(), WxConversion::toWxString(), OSEdTextGenerator::TXT_LABEL_PC, OSEdTextGenerator::TXT_LABEL_RA, OSEdTextGenerator::TXT_LABEL_SYS_CALL_HANDLER, and OSEdTextGenerator::TXT_LABEL_SYS_CALL_NUMBER.

Here is the call graph for this function:

◆ ~SimulationInfoDialog()

SimulationInfoDialog::~SimulationInfoDialog ( )
virtual

Destructor.

Definition at line 108 of file SimulationInfoDialog.cc.

108  {
109  int x, y;
110  GetPosition(&x, &y);
111  wxPoint point(x, y);
113 }

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

Here is the call graph for this function:

◆ SimulationInfoDialog() [2/2]

SimulationInfoDialog::SimulationInfoDialog ( const SimulationInfoDialog )
private

Copying not allowed.

Member Function Documentation

◆ createContents()

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

Creates the contents of the dialog.

NOTE! This function was generated by wxDesigner.

Parameters
parentParent window.
call_fitIf true fits the contenst inside the dialog.
set_sizerIf true sets the main sizer as dialog contents.
Returns
The created sizer.

Definition at line 192 of file SimulationInfoDialog.cc.

195  {
196 
197  wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
198 
199  wxListCtrl *item1 = new wxListCtrl( parent, ID_LISTCTRL, wxDefaultPosition, wxSize(160,120), wxLC_REPORT|wxLC_NO_HEADER|wxSUNKEN_BORDER );
200  item0->Add( item1, 1, wxGROW|wxALL, 5 );
201 
202  if (set_sizer)
203  {
204  parent->SetSizer( item0 );
205  if (call_fit)
206  item0->SetSizeHints( parent );
207  }
208 
209  return item0;
210 }

References ID_LISTCTRL.

Referenced by SimulationInfoDialog().

◆ handleEvent()

void SimulationInfoDialog::handleEvent ( OSEdInformer::EventId  id)
virtual

Updates the list which contains information about simulation.

This method is called when trigger button is pushed in parent dialog (SimulateDialog).

Parameters
idThe id of the event.

Implements OSEdListener.

Definition at line 166 of file SimulationInfoDialog.cc.

166  {
167  switch (id) {
169  updateList();
170  break;
172  context_->programCounter() = 0;
173  context_->returnAddress() = 0;
174  updateList();
175  break;
176  default:
177  break;
178  }
179 }

References context_, OSEdInformer::EVENT_REGISTER, OSEdInformer::EVENT_RESET, OperationContext::programCounter(), OperationContext::returnAddress(), and updateList().

Here is the call graph for this function:

◆ operator=()

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

Assignment not allowed.

◆ setTexts()

void SimulationInfoDialog::setTexts ( )
private

Sets the texts for the widgets.

Definition at line 93 of file SimulationInfoDialog.cc.

93  {
94 
96 
97  // title
98  format fmt =
100  SetTitle(WxConversion::toWxString(fmt.str()));
101 
102 }

References OSEdTextGenerator::instance(), Texts::TextGenerator::text(), WxConversion::toWxString(), and OSEdTextGenerator::TXT_SIMULATION_INFO_DIALOG_TITLE.

Referenced by SimulationInfoDialog().

Here is the call graph for this function:

◆ TransferDataToWindow()

bool SimulationInfoDialog::TransferDataToWindow ( )
privatevirtual

Transfer data to dialog.

Returns
True if transfer is successful.

Definition at line 121 of file SimulationInfoDialog.cc.

121  {
122  updateList();
123  return wxWindow::TransferDataToWindow();
124 }

References updateList().

Here is the call graph for this function:

◆ updateList()

void SimulationInfoDialog::updateList ( )
private

Updates the list of information.

Definition at line 130 of file SimulationInfoDialog.cc.

130  {
131 #if 0
133  infoList_->SetItem(0, 1, WxConversion::toWxString(0));
134  } else {
135  SimValue& value = context_->programCounter();
136  string valueString = parent_->formattedValue(&value);
137  infoList_->SetItem(0, 1, WxConversion::toWxString(valueString));
138  }
139 #endif
140  infoList_->SetItem(
142 
143 #if 0
145  infoList_->SetItem(1, 1, WxConversion::toWxString(0));
146  } else {
147  SimValue& value = context_->returnAddress();
148  string valueString = parent_->formattedValue(&value);
149  infoList_->SetItem(1, 1, WxConversion::toWxString(valueString));
150  }
151 #endif
152  infoList_->SetItem(
153  1, 1,
155 }

References context_, SimulateDialog::formattedValue(), infoList_, NullSimValue::instance(), parent_, OperationContext::programCounter(), OperationContext::returnAddress(), WxConversion::toWxString(), and SimValue::uIntWordValue().

Referenced by handleEvent(), and TransferDataToWindow().

Here is the call graph for this function:

Member Data Documentation

◆ context_

OperationContext* SimulationInfoDialog::context_
private

Operation context for retrieving simulation data.

Definition at line 78 of file SimulationInfoDialog.hh.

Referenced by handleEvent(), and updateList().

◆ infoList_

wxListCtrl* SimulationInfoDialog::infoList_
private

List for showing simulation statistics.

Definition at line 74 of file SimulationInfoDialog.hh.

Referenced by SimulationInfoDialog(), and updateList().

◆ parent_

SimulateDialog* SimulationInfoDialog::parent_
private

Parent window.

Definition at line 76 of file SimulationInfoDialog.hh.

Referenced by SimulationInfoDialog(), and updateList().


The documentation for this class was generated from the following files:
OSEdTextGenerator::TXT_LABEL_RA
@ TXT_LABEL_RA
Return address label.
Definition: OSEdTextGenerator.hh:62
SimulationInfoDialog::setTexts
void setTexts()
Definition: SimulationInfoDialog.cc:93
OSEdConstants::DEFAULT_COLUMN_WIDTH
static const int DEFAULT_COLUMN_WIDTH
Default column width.
Definition: OSEdConstants.hh:113
WxConversion::toWxString
static wxString toWxString(const std::string &source)
OSEdTextGenerator::TXT_LABEL_SYS_CALL_NUMBER
@ TXT_LABEL_SYS_CALL_NUMBER
Sys call number label.
Definition: OSEdTextGenerator.hh:64
SimulateDialog
Definition: SimulateDialog.hh:53
SimulationInfoDialog::infoList_
wxListCtrl * infoList_
List for showing simulation statistics.
Definition: SimulationInfoDialog.hh:74
DialogPosition::getPosition
static wxPoint getPosition(Dialogs dialog)
Definition: DialogPosition.cc:49
NullSimValue::instance
static SimValue & instance()
Definition: SimValue.cc:1642
OSEdInformer::EVENT_REGISTER
@ EVENT_REGISTER
Event when register value might change.
Definition: OSEdInformer.hh:53
OSEdTextGenerator::TXT_SIMULATION_INFO_DIALOG_TITLE
@ TXT_SIMULATION_INFO_DIALOG_TITLE
Simulation info dialog title.
Definition: OSEdTextGenerator.hh:119
FindWindow
Definition: FindWindow.hh:49
SimulationInfoDialog::updateList
void updateList()
Definition: SimulationInfoDialog.cc:130
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
SimValue::uIntWordValue
UIntWord uIntWordValue() const
Definition: SimValue.cc:972
DialogPosition::setPosition
static void setPosition(Dialogs dialog, wxPoint point)
Definition: DialogPosition.cc:63
SimulationInfoDialog::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition: SimulationInfoDialog.cc:192
SimulationInfoDialog::context_
OperationContext * context_
Operation context for retrieving simulation data.
Definition: SimulationInfoDialog.hh:78
SimValue
Definition: SimValue.hh:96
SimulationInfoDialog::ID_LISTCTRL
@ ID_LISTCTRL
Definition: SimulationInfoDialog.hh:70
SimulationInfoDialog::parent_
SimulateDialog * parent_
Parent window.
Definition: SimulationInfoDialog.hh:76
OSEdTextGenerator::TXT_LABEL_SYS_CALL_HANDLER
@ TXT_LABEL_SYS_CALL_HANDLER
Sys call handler label.
Definition: OSEdTextGenerator.hh:63
DialogPosition::DIALOG_SIMULATION_INFO
@ DIALOG_SIMULATION_INFO
Simulation info dialog.
Definition: DialogPosition.hh:55
OSEdInformer::EVENT_RESET
@ EVENT_RESET
Event when operation is reseted.
Definition: OSEdInformer.hh:54
OperationContext::programCounter
InstructionAddress & programCounter()
Definition: OperationContext.cc:152
OSEdTextGenerator::TXT_LABEL_PC
@ TXT_LABEL_PC
Program counter label.
Definition: OSEdTextGenerator.hh:61
OSEdTextGenerator::instance
static OSEdTextGenerator & instance()
Definition: OSEdTextGenerator.cc:214
OSEdTextGenerator
Definition: OSEdTextGenerator.hh:42
SimulateDialog::formattedValue
std::string formattedValue(SimValue *value)
Definition: SimulateDialog.cc:532
OperationContext::returnAddress
SimValue & returnAddress()
Definition: OperationContext.cc:207