OpenASIP  2.0
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. More...
 
StopPointManagerbpManager_
 Stoppoint manager managing program breakpoints. More...
 
bool showPCArrow_
 True, if the current istrcution arrow should be displayed. More...
 
ProximDisasmAttrProviderattrProvider_
 

Additional Inherited Members

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

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 }

◆ ~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 }

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 }

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 }

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_.

◆ 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_.

◆ 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_.

◆ 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_.

◆ 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_.

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:
Breakpoint::address
virtual InstructionAddress address() const
Definition: Breakpoint.cc:86
ProximToolbox::frontend
static TracedSimulatorFrontend * frontend()
Definition: ProximToolbox.cc:223
DisassemblyGridTable::GetColLabelValue
virtual wxString GetColLabelValue(int col)
Definition: DisassemblyGridTable.cc:180
WxConversion::toWxString
static wxString toWxString(const std::string &source)
DisassemblyGridTable::GetValue
virtual wxString GetValue(int row, int col)
Definition: DisassemblyGridTable.cc:121
Breakpoint
Definition: Breakpoint.hh:50
DisassemblyGridTable::addressOfRow
Word addressOfRow(int row)
Definition: DisassemblyGridTable.cc:254
StopPointManager::stopPointCount
unsigned int stopPointCount()
Definition: StopPointManager.cc:269
StopPointManager::stopPointWithHandleConst
const StopPoint & stopPointWithHandleConst(unsigned int handle) const
Definition: StopPointManager.cc:248
ProximDisassemblyGridTable::currentInstruction_
Word currentInstruction_
Program counter value.
Definition: ProximDisassemblyGridTable.hh:68
ProximDisassemblyGridTable::showPCArrow_
bool showPCArrow_
True, if the current istrcution arrow should be displayed.
Definition: ProximDisassemblyGridTable.hh:72
DisassemblyGridTable::GetNumberRows
virtual int GetNumberRows()
Definition: DisassemblyGridTable.cc:79
ProximDisasmAttrProvider::moveCellAttr
virtual wxGridCellAttr * moveCellAttr(InstructionAddress address, int move)=0
Definition: ProximDisasmAttrProvider.cc:56
DisassemblyGridTable::DisassemblyGridTable
DisassemblyGridTable()
Definition: DisassemblyGridTable.cc:55
ProximDisassemblyGridTable::attrProvider_
ProximDisasmAttrProvider * attrProvider_
Definition: ProximDisassemblyGridTable.hh:74
ProximDisassemblyGridTable::bpManager_
StopPointManager * bpManager_
Stoppoint manager managing program breakpoints.
Definition: ProximDisassemblyGridTable.hh:70
DisassemblyGridTable::GetNumberCols
virtual int GetNumberCols()
Definition: DisassemblyGridTable.cc:92
StopPointManager::stopPointHandle
unsigned int stopPointHandle(unsigned int index)
Definition: StopPointManager.cc:231