OpenASIP 2.2
Loading...
Searching...
No Matches
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.
 
SimulationInfoDialogoperator= (const SimulationInfoDialog &)
 Assignment not allowed.
 
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.
 
SimulateDialogparent_
 Parent window.
 
OperationContextcontext_
 Operation context for retrieving simulation data.
 

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.

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}
static wxPoint getPosition(Dialogs dialog)
@ DIALOG_SIMULATION_INFO
Simulation info dialog.
static const int DEFAULT_COLUMN_WIDTH
Default column width.
static OSEdTextGenerator & instance()
@ TXT_LABEL_SYS_CALL_NUMBER
Sys call number label.
@ TXT_LABEL_RA
Return address label.
@ TXT_LABEL_PC
Program counter label.
@ TXT_LABEL_SYS_CALL_HANDLER
Sys call handler label.
OperationContext * context_
Operation context for retrieving simulation data.
wxListCtrl * infoList_
List for showing simulation statistics.
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
SimulateDialog * parent_
Parent window.
virtual boost::format text(int textId)
static wxString toWxString(const std::string &source)

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}
static void setPosition(Dialogs dialog, wxPoint point)

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;
173 context_->returnAddress() = 0;
174 updateList();
175 break;
176 default:
177 break;
178 }
179}
@ EVENT_REGISTER
Event when register value might change.
@ EVENT_RESET
Event when operation is reseted.
SimValue & returnAddress()
InstructionAddress & programCounter()

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}
@ TXT_SIMULATION_INFO_DIALOG_TITLE
Simulation info dialog title.

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}
static SimValue & instance()
Definition SimValue.cc:1642
UIntWord uIntWordValue() const
Definition SimValue.cc:972
std::string formattedValue(SimValue *value)

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: