OpenASIP  2.0
Public Member Functions | Protected Attributes | List of all members
StopPoint Class Referenceabstract

#include <StopPoint.hh>

Inheritance diagram for StopPoint:
Inheritance graph
Collaboration diagram for StopPoint:
Collaboration graph

Public Member Functions

 StopPoint ()
 
virtual ~StopPoint ()
 
virtual void setEnabled (bool flag)
 
virtual bool isEnabled () const
 
virtual void setDisabledAfterTriggered (bool flag)
 
virtual bool isDisabledAfterTriggered () const
 
virtual void setDeletedAfterTriggered (bool flag)
 
virtual bool isDeletedAfterTriggered () const
 
virtual void setCondition (const ConditionScript &condition)
 
virtual void removeCondition ()
 
virtual const ConditionScriptcondition () const
 
virtual bool isConditional () const
 
virtual void setIgnoreCount (unsigned int count)
 
virtual unsigned int ignoreCount () const
 
virtual bool isConditionOK ()
 
virtual bool isTriggered () const =0
 
virtual std::string description () const =0
 
virtual StopPointcopy () const =0
 
virtual void decreaseIgnoreCount ()
 

Protected Attributes

bool enabled_
 Tells whether the breakpoint is enabled or disabled. More...
 
bool disabledAfterTriggered_
 Tells if the breakpoint is disabled after it is triggered the next time. More...
 
bool deletedAfterTriggered_
 Tells if the breakpoint is deleted after it is triggered the next time. More...
 
bool conditional_
 Tells whether the breakpoint is conditional or not. More...
 
ConditionScriptcondition_
 The condition which is used to determine whether the breakpoint should be fired or not. More...
 
unsigned int ignoreCount_
 The number of times the condition is to be ignored before enabling the breakpoint. More...
 

Detailed Description

Represents a stop point in simulation.

StopPointManager uses this class to store information of each stop point of the simulation phase. StopPoint is a parent class for different types of user-set simulation stop conditions (currently breakpoints and watches).

Each StopPoint listens to a simulation event (usually PC advance) and evaluates its stop condition.

Definition at line 53 of file StopPoint.hh.

Constructor & Destructor Documentation

◆ StopPoint()

StopPoint::StopPoint ( )

Constructor.

Definition at line 43 of file StopPoint.cc.

43  :
44  enabled_(false), disabledAfterTriggered_(false),
45  deletedAfterTriggered_(false), conditional_(false), condition_(NULL),
46  ignoreCount_(0) {
47 }

◆ ~StopPoint()

StopPoint::~StopPoint ( )
virtual

Destructor.

Definition at line 52 of file StopPoint.cc.

52  {
53  delete condition_;
54  condition_ = NULL;
55 }

References condition_.

Member Function Documentation

◆ condition()

const ConditionScript & StopPoint::condition ( ) const
virtual

Returns the condition of the stop point.

If breakpoint is unconditional, an empty ConditionScript is returned.

Returns
The condition of the stop point firing.

Definition at line 156 of file StopPoint.cc.

156  {
157 
158  static ConditionScript emptyCondition(NULL, "");
159 
160  if (conditional_) {
161  return *condition_;
162  } else {
163  return emptyCondition;
164  }
165 }

References condition_, and conditional_.

Referenced by setCondition(), WatchPropertiesDialog::TransferDataToWindow(), and BreakpointPropertiesDialog::TransferDataToWindow().

◆ copy()

virtual StopPoint* StopPoint::copy ( ) const
pure virtual

Implemented in Breakpoint, and Watch.

Referenced by StopPointManager::add().

◆ decreaseIgnoreCount()

void StopPoint::decreaseIgnoreCount ( )
virtual

Decreases the ignore count.

Definition at line 201 of file StopPoint.cc.

201  {
202  if (ignoreCount() > 0) {
204  }
205 }

References ignoreCount(), and setIgnoreCount().

Referenced by StopPointManager::handleEvent().

Here is the call graph for this function:

◆ description()

std::string StopPoint::description ( ) const
pure virtual

Prints the description string of the stop point.

Each subclass overrides this method to construct a descripting string of itself.

Implemented in Breakpoint, and Watch.

Definition at line 239 of file StopPoint.cc.

239  {
240  std::string description = "";
241  if (!enabled_)
242  description += "is disabled";
243 
245  if (description != "")
246  description += ", ";
247  description = "will be disabled after triggered";
248  }
249 
251  if (description != "")
252  description += ", ";
253  description += "will be deleted after triggered";
254  }
255 
256  if (ignoreCount_) {
257  if (description != "")
258  description += ", ";
259  description += "will be ignored " +
260  Conversion::toString(ignoreCount_) + " time(s)";
261  }
262 
263  if (conditional_) {
264  if (description != "")
265  description += ", ";
266  description += "has condition '" + condition_->script().at(0) + "'";
267  }
268 
269  if (description != "")
270  description += " ";
271 
272  return description;
273 }

References condition_, conditional_, deletedAfterTriggered_, disabledAfterTriggered_, enabled_, ignoreCount_, Script::script(), and Conversion::toString().

Referenced by Breakpoint::description(), Watch::description(), and SimControlLanguageCommand::printBreakpointInfo().

Here is the call graph for this function:

◆ ignoreCount()

unsigned int StopPoint::ignoreCount ( ) const
virtual

Tells the current ignore count, i.e. the number of times the stop point condition is ignored before being fired.

Returns
The ignore count.

Definition at line 193 of file StopPoint.cc.

193  {
194  return ignoreCount_;
195 }

References ignoreCount_.

Referenced by decreaseIgnoreCount(), StopPointManager::handleEvent(), WatchPropertiesDialog::TransferDataToWindow(), and BreakpointPropertiesDialog::TransferDataToWindow().

◆ isConditional()

bool StopPoint::isConditional ( ) const
virtual

Tells whether the stop point is conditional or not.

Returns
'True' if the stop point is conditional, 'false' if it is not.

Definition at line 173 of file StopPoint.cc.

173  {
174  return conditional_;
175 }

References conditional_.

Referenced by WatchPropertiesDialog::TransferDataToWindow(), and BreakpointPropertiesDialog::TransferDataToWindow().

◆ isConditionOK()

bool StopPoint::isConditionOK ( )
virtual

Tells wheter the condition of the stop point evalutes to true.

If the stop point is not conditional, returns always true.

Returns
'True' if condition is OK, 'false' otherwise.

Definition at line 215 of file StopPoint.cc.

215  {
216 
217  if (conditional_) {
218  assert(condition_ != NULL);
219  try {
220  return condition_->conditionOk();
221  } catch (const Exception& e) {
223  << "Condition script threw exception: " << e.errorMessage()
224  << std::endl;
225  return false;
226  }
227  } else {
228  return true;
229  }
230 }

References assert, condition_, conditional_, ConditionScript::conditionOk(), Exception::errorMessage(), and Application::logStream().

Referenced by StopPointManager::handleEvent().

Here is the call graph for this function:

◆ isDeletedAfterTriggered()

bool StopPoint::isDeletedAfterTriggered ( ) const
virtual

Tells whether the stop point is deleted after it is triggered (fired) the next time.

Returns
'True' if the stop point is deleted after it is triggered, 'false' if it is not.

Definition at line 119 of file StopPoint.cc.

119  {
120  return deletedAfterTriggered_;
121 }

References deletedAfterTriggered_.

Referenced by StopPointManager::handleEvent().

◆ isDisabledAfterTriggered()

bool StopPoint::isDisabledAfterTriggered ( ) const
virtual

Tells if the stop point is disabled after it is triggered (fired) the next time.

Returns
'True' if the stop oint is disabled after it is triggered, 'false' otherwise.

Definition at line 97 of file StopPoint.cc.

97  {
99 }

References disabledAfterTriggered_.

Referenced by StopPointManager::handleEvent().

◆ isEnabled()

bool StopPoint::isEnabled ( ) const
virtual

Tells wheter the stop point is enabled or not.

Returns
'True' if the breakpoint is enabled, 'false' if it is disabled.

Definition at line 73 of file StopPoint.cc.

73  {
74  return enabled_;
75 }

References enabled_.

Referenced by StopPointManager::handleEvent(), ProximDisassemblyWindow::onRightClick(), and ProximBreakpointWindow::refreshStopPoints().

◆ isTriggered()

virtual bool StopPoint::isTriggered ( ) const
pure virtual

Implemented in Breakpoint, and Watch.

Referenced by StopPointManager::handleEvent().

◆ removeCondition()

void StopPoint::removeCondition ( )
virtual

Remove the condition of the StopPoint.

The condition is used to determine if the stop point should be fired.

Definition at line 142 of file StopPoint.cc.

142  {
143  conditional_ = false;
144  delete condition_;
145  condition_ = NULL;
146 }

References condition_, and conditional_.

Referenced by Breakpoint::copy(), Watch::copy(), SimControlLanguageCommand::parseBreakpoint(), and StopPointManager::removeCondition().

◆ setCondition()

void StopPoint::setCondition ( const ConditionScript condition)
virtual

Sets the condition of the StopPoint.

The condition is used to determine if the stop point should be fired.

Parameters
conditionThe condition to be used as stop point's condition.

Definition at line 131 of file StopPoint.cc.

131  {
132  conditional_ = true;
134 }

References condition(), condition_, conditional_, and ConditionScript::copy().

Referenced by Breakpoint::copy(), Watch::copy(), SimControlLanguageCommand::parseBreakpoint(), and StopPointManager::setCondition().

Here is the call graph for this function:

◆ setDeletedAfterTriggered()

void StopPoint::setDeletedAfterTriggered ( bool  flag)
virtual

Makes the stop point to be deleted after it is triggered the next time.

Parameters
flagThe new value for this property.

Definition at line 107 of file StopPoint.cc.

107  {
108  deletedAfterTriggered_ = flag;
109 }

References deletedAfterTriggered_.

Referenced by Breakpoint::copy(), Watch::copy(), StopPointManager::enableOnceAndDelete(), and TBPCommand::execute().

◆ setDisabledAfterTriggered()

void StopPoint::setDisabledAfterTriggered ( bool  flag)
virtual

Sets the stop point to be disabled after it is triggered the next time.

Parameters
flagThe new value for this property.

Definition at line 85 of file StopPoint.cc.

85  {
87 }

References disabledAfterTriggered_.

Referenced by Breakpoint::copy(), Watch::copy(), and StopPointManager::enableOnceAndDisable().

◆ setEnabled()

void StopPoint::setEnabled ( bool  flag)
virtual

Sets the enabled status of the breakpoint.

Parameters
flagThe status.

Definition at line 63 of file StopPoint.cc.

63  {
64  enabled_ = flag;
65 }

References enabled_.

Referenced by StopPointManager::add(), Breakpoint::copy(), Watch::copy(), StopPointManager::disable(), StopPointManager::enable(), StopPointManager::enableOnceAndDelete(), StopPointManager::enableOnceAndDisable(), and StopPointManager::handleEvent().

◆ setIgnoreCount()

void StopPoint::setIgnoreCount ( unsigned int  count)
virtual

Sets the number of times the condition for firing the stop point is to be disabled before enabling it.

Definition at line 182 of file StopPoint.cc.

182  {
183  ignoreCount_ = count;
184 }

References ignoreCount_.

Referenced by Breakpoint::copy(), Watch::copy(), decreaseIgnoreCount(), and StopPointManager::setIgnore().

Member Data Documentation

◆ condition_

ConditionScript* StopPoint::condition_
protected

The condition which is used to determine whether the breakpoint should be fired or not.

Definition at line 94 of file StopPoint.hh.

Referenced by condition(), Breakpoint::copy(), Watch::copy(), description(), isConditionOK(), removeCondition(), setCondition(), and ~StopPoint().

◆ conditional_

bool StopPoint::conditional_
protected

Tells whether the breakpoint is conditional or not.

Definition at line 91 of file StopPoint.hh.

Referenced by condition(), Breakpoint::copy(), Watch::copy(), description(), isConditional(), isConditionOK(), removeCondition(), and setCondition().

◆ deletedAfterTriggered_

bool StopPoint::deletedAfterTriggered_
protected

Tells if the breakpoint is deleted after it is triggered the next time.

Definition at line 89 of file StopPoint.hh.

Referenced by Breakpoint::copy(), Watch::copy(), description(), isDeletedAfterTriggered(), and setDeletedAfterTriggered().

◆ disabledAfterTriggered_

bool StopPoint::disabledAfterTriggered_
protected

Tells if the breakpoint is disabled after it is triggered the next time.

Definition at line 87 of file StopPoint.hh.

Referenced by Breakpoint::copy(), Watch::copy(), description(), isDisabledAfterTriggered(), and setDisabledAfterTriggered().

◆ enabled_

bool StopPoint::enabled_
protected

Tells whether the breakpoint is enabled or disabled.

Definition at line 84 of file StopPoint.hh.

Referenced by Breakpoint::copy(), Watch::copy(), description(), isEnabled(), and setEnabled().

◆ ignoreCount_

unsigned int StopPoint::ignoreCount_
protected

The number of times the condition is to be ignored before enabling the breakpoint.

Definition at line 97 of file StopPoint.hh.

Referenced by Breakpoint::copy(), Watch::copy(), description(), ignoreCount(), and setIgnoreCount().


The documentation for this class was generated from the following files:
StopPoint::conditional_
bool conditional_
Tells whether the breakpoint is conditional or not.
Definition: StopPoint.hh:91
Script::script
virtual std::vector< std::string > script() const
Definition: Script.cc:106
StopPoint::setIgnoreCount
virtual void setIgnoreCount(unsigned int count)
Definition: StopPoint.cc:182
ConditionScript::copy
virtual ConditionScript * copy() const
Definition: ConditionScript.cc:99
StopPoint::enabled_
bool enabled_
Tells whether the breakpoint is enabled or disabled.
Definition: StopPoint.hh:84
StopPoint::condition_
ConditionScript * condition_
The condition which is used to determine whether the breakpoint should be fired or not.
Definition: StopPoint.hh:94
StopPoint::ignoreCount
virtual unsigned int ignoreCount() const
Definition: StopPoint.cc:193
Application::logStream
static std::ostream & logStream()
Definition: Application.cc:155
Conversion::toString
static std::string toString(const T &source)
ConditionScript::conditionOk
virtual bool conditionOk()
Definition: ConditionScript.cc:76
ConditionScript
Definition: ConditionScript.hh:45
assert
#define assert(condition)
Definition: Application.hh:86
StopPoint::condition
virtual const ConditionScript & condition() const
Definition: StopPoint.cc:156
Exception
Definition: Exception.hh:54
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
StopPoint::deletedAfterTriggered_
bool deletedAfterTriggered_
Tells if the breakpoint is deleted after it is triggered the next time.
Definition: StopPoint.hh:89
StopPoint::disabledAfterTriggered_
bool disabledAfterTriggered_
Tells if the breakpoint is disabled after it is triggered the next time.
Definition: StopPoint.hh:87
StopPoint::ignoreCount_
unsigned int ignoreCount_
The number of times the condition is to be ignored before enabling the breakpoint.
Definition: StopPoint.hh:97
StopPoint::description
virtual std::string description() const =0
Definition: StopPoint.cc:239