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

#include <ProximDisassemblyGridTable.hh>

Inheritance diagram for ProximDisassemblyGridTable:
Inheritance graph
Collaboration diagram for ProximDisassemblyGridTable:
Collaboration graph

Public Member Functions

 ProximDisassemblyGridTable ()
 
 ~ProximDisassemblyGridTable ()
 
virtual wxString GetValue (int row, int col)
 
virtual int GetNumberCols ()
 
virtual int GetNumberRows ()
 
virtual wxString GetColLabelValue (int col)
 
virtual wxGridCellAttr * GetAttr (int row, int col, wxGridCellAttr::wxAttrKind kind)
 
void setStopPointManager (StopPointManager &manager)
 
void setCurrentInstruction (Word address)
 
void setMoveCellAttrProvider (ProximDisasmAttrProvider *attrProvider)
 
ProximDisasmAttrProvidermoveCellAttrProvider () const
 
void showPCArrow ()
 
void hidePCArrow ()
 
- Public Member Functions inherited from DisassemblyGridTable
 DisassemblyGridTable ()
 
virtual ~DisassemblyGridTable ()
 
virtual bool IsEmptyCell (int row, int col)
 
virtual wxString GetRowLabelValue (int row)
 
virtual void SetValue (int row, int col, const wxString &value)
 
virtual bool CanHaveAttributes ()
 
int rowOfAddress (Word address)
 
Word addressOfRow (int row)
 
void loadProgram (const TTAProgram::Program &program)
 

Private Attributes

Word currentInstruction_
 Program counter value.
 
StopPointManagerbpManager_
 Stoppoint manager managing program breakpoints.
 
bool showPCArrow_
 True, if the current istrcution arrow should be displayed.
 
ProximDisasmAttrProviderattrProvider_
 

Additional Inherited Members

- Protected Attributes inherited from DisassemblyGridTable
const TTAProgram::Programprogram_
 Program loaded in the table.
 

Detailed Description

A specialized DisassemblyGridTable class, which adds a column with breakpoint labels and arrow displaying the current instruction to the disassembly grid.

Definition at line 47 of file ProximDisassemblyGridTable.hh.

Constructor & Destructor Documentation

◆ ProximDisassemblyGridTable()

ProximDisassemblyGridTable::ProximDisassemblyGridTable ( )

The Constructor.

Definition at line 49 of file ProximDisassemblyGridTable.cc.

49 :
51 attrProvider_(NULL) {
52
53}
ProximDisasmAttrProvider * attrProvider_
StopPointManager * bpManager_
Stoppoint manager managing program breakpoints.

◆ ~ProximDisassemblyGridTable()

ProximDisassemblyGridTable::~ProximDisassemblyGridTable ( )

The Destructor.

Definition at line 59 of file ProximDisassemblyGridTable.cc.

59 {
60 if (attrProvider_ != NULL) {
61 delete attrProvider_;
62 }
63}

References attrProvider_.

Member Function Documentation

◆ GetAttr()

wxGridCellAttr * ProximDisassemblyGridTable::GetAttr ( int  row,
int  col,
wxGridCellAttr::wxAttrKind  kind 
)
virtual

Returns cell style attributes for a cell with given row and column.

@paran row Row of the grid cell.

Parameters
colColumn of the grid cell.
Returns
Cell's style attribute.

Definition at line 232 of file ProximDisassemblyGridTable.cc.

233 {
234
235 wxGridCellAttr* attr = new wxGridCellAttr();
236
237 if (ProximToolbox::frontend()->isProgramLoaded() && row >= 0 && col > 1) {
238 if (attrProvider_ != NULL) {
239 return attrProvider_->moveCellAttr(addressOfRow(row), col - 2);
240 }
241 } else {
242 attr->SetBackgroundColour(wxColour(180, 180, 180));
243 }
244
245 return attr;
246}
virtual wxGridCellAttr * moveCellAttr(InstructionAddress address, int move)=0
static TracedSimulatorFrontend * frontend()

References DisassemblyGridTable::addressOfRow(), attrProvider_, ProximToolbox::frontend(), and ProximDisasmAttrProvider::moveCellAttr().

Here is the call graph for this function:

◆ GetColLabelValue()

wxString ProximDisassemblyGridTable::GetColLabelValue ( int  col)
virtual

Returns label for a column.

Parameters
colColumn index.
Returns
Column label.

Reimplemented from DisassemblyGridTable.

Definition at line 160 of file ProximDisassemblyGridTable.cc.

160 {
161 if (col > 1) {
163 } else {
164 return _T("");
165 }
166}
virtual wxString GetColLabelValue(int col)

References DisassemblyGridTable::GetColLabelValue().

Here is the call graph for this function:

◆ GetNumberCols()

int ProximDisassemblyGridTable::GetNumberCols ( )
virtual

Returns number of columns in the grid.

Returns
Number of columns.

Reimplemented from DisassemblyGridTable.

Definition at line 128 of file ProximDisassemblyGridTable.cc.

128 {
129
130 if (!ProximToolbox::frontend()->isProgramLoaded()) {
131 return 0;
132 }
133
135}

References ProximToolbox::frontend(), and DisassemblyGridTable::GetNumberCols().

Here is the call graph for this function:

◆ GetNumberRows()

int ProximDisassemblyGridTable::GetNumberRows ( )
virtual

Returns number of rows in the grid.

Returns
Number of rows.

Reimplemented from DisassemblyGridTable.

Definition at line 144 of file ProximDisassemblyGridTable.cc.

144 {
145
146 if (!ProximToolbox::frontend()->isProgramLoaded()) {
147 return 0;
148 }
149
151}

References ProximToolbox::frontend(), and DisassemblyGridTable::GetNumberRows().

Here is the call graph for this function:

◆ GetValue()

wxString ProximDisassemblyGridTable::GetValue ( int  row,
int  col 
)
virtual

Returns text value of a cell.

Parameters
rowRow of the cell.
colColumn of the cell.
Returns
Value of the cell as wxString.

Reimplemented from DisassemblyGridTable.

Definition at line 86 of file ProximDisassemblyGridTable.cc.

86 {
87
88 if (!ProximToolbox::frontend()->isProgramLoaded()) {
89 return _T("");
90 }
91
92 wxString value;
93
94 if (col == 0 && bpManager_ != NULL) {
95 for (unsigned i = 0; i < bpManager_->stopPointCount(); i++) {
96 unsigned handle = bpManager_->stopPointHandle(i);
97
98 const Breakpoint* bp =
99 dynamic_cast<const Breakpoint*>(
101
102 if (bp != NULL) {
103 Word address = bp->address();
104 if (address == (Word)row) {
105 value.Append(WxConversion::toWxString(handle));
106 value.Append(_T(" "));
107 }
108 }
109 }
110 }
111
112 if (col == 0 && showPCArrow_ && (Word)row == currentInstruction_) {
113 value.Append(_T("next>"));
114 }
115
116 if (col > 0) {
117 value = DisassemblyGridTable::GetValue(row, col - 1);
118 }
119 return value;
120}
virtual InstructionAddress address() const
Definition Breakpoint.cc:86
virtual wxString GetValue(int row, int col)
Word currentInstruction_
Program counter value.
bool showPCArrow_
True, if the current istrcution arrow should be displayed.
unsigned int stopPointCount()
const StopPoint & stopPointWithHandleConst(unsigned int handle) const
unsigned int stopPointHandle(unsigned int index)
static wxString toWxString(const std::string &source)

References Breakpoint::address(), bpManager_, currentInstruction_, ProximToolbox::frontend(), DisassemblyGridTable::GetValue(), showPCArrow_, StopPointManager::stopPointCount(), StopPointManager::stopPointHandle(), StopPointManager::stopPointWithHandleConst(), and WxConversion::toWxString().

Here is the call graph for this function:

◆ hidePCArrow()

void ProximDisassemblyGridTable::hidePCArrow ( )

Turns off showing of the arrow displaying the current instruction.

Definition at line 180 of file ProximDisassemblyGridTable.cc.

180 {
181 showPCArrow_ = false;
182}

References showPCArrow_.

◆ moveCellAttrProvider()

ProximDisasmAttrProvider * ProximDisassemblyGridTable::moveCellAttrProvider ( ) const

Returns the move cell attribute provider.

Returns
Move cell attribute provider, or NULL is it's not set.

Definition at line 219 of file ProximDisassemblyGridTable.cc.

219 {
220 return attrProvider_;
221}

References attrProvider_.

Referenced by ProximDisassemblyWindow::onSimulatorStop().

◆ setCurrentInstruction()

void ProximDisassemblyGridTable::setCurrentInstruction ( Word  address)

Sets address of the current instruction.

Parameters
addressAddress of the current instruction.

Definition at line 191 of file ProximDisassemblyGridTable.cc.

191 {
192 currentInstruction_ = address;
193}

References currentInstruction_.

Referenced by ProximDisassemblyWindow::loadProgram(), and ProximDisassemblyWindow::onSimulatorStop().

◆ setMoveCellAttrProvider()

void ProximDisassemblyGridTable::setMoveCellAttrProvider ( ProximDisasmAttrProvider attrProvider)

Sets the cell attribute provider for cell's containing move disassembly.

ProximDisassemblyGridTable take ownership of the pointer and deletes the object when it's no longer needed.

Parameters
attrProviderNew move cell attribute provider.

Definition at line 204 of file ProximDisassemblyGridTable.cc.

205 {
206
207 if (attrProvider_ != NULL) {
208 delete attrProvider_;
209 }
210 attrProvider_ = attrProvider;
211}

References attrProvider_.

Referenced by ProximDisassemblyWindow::setMoveAttrProvider().

◆ setStopPointManager()

void ProximDisassemblyGridTable::setStopPointManager ( StopPointManager bpManager)

Sets the breakpoint manager containing program breakpoints to display.

Parameters
bpManagerBreakpoint manager of the program.

Definition at line 71 of file ProximDisassemblyGridTable.cc.

72 {
73
74 bpManager_ = &bpManager;
75}

References bpManager_.

Referenced by ProximDisassemblyWindow::loadProgram().

◆ showPCArrow()

void ProximDisassemblyGridTable::showPCArrow ( )

Turns on showing of the arrow displaying the current instruction.

Definition at line 172 of file ProximDisassemblyGridTable.cc.

172 {
173 showPCArrow_ = true;
174}

References showPCArrow_.

Referenced by ProximDisassemblyWindow::loadProgram().

Member Data Documentation

◆ attrProvider_

ProximDisasmAttrProvider* ProximDisassemblyGridTable::attrProvider_
private

◆ bpManager_

StopPointManager* ProximDisassemblyGridTable::bpManager_
private

Stoppoint manager managing program breakpoints.

Definition at line 70 of file ProximDisassemblyGridTable.hh.

Referenced by GetValue(), and setStopPointManager().

◆ currentInstruction_

Word ProximDisassemblyGridTable::currentInstruction_
private

Program counter value.

Definition at line 68 of file ProximDisassemblyGridTable.hh.

Referenced by GetValue(), and setCurrentInstruction().

◆ showPCArrow_

bool ProximDisassemblyGridTable::showPCArrow_
private

True, if the current istrcution arrow should be displayed.

Definition at line 72 of file ProximDisassemblyGridTable.hh.

Referenced by GetValue(), hidePCArrow(), and showPCArrow().


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