|
OpenASIP 2.2
|
#include <StopPointManager.hh>


Public Member Functions | |
| StopPointManager (TTASimulationController &controller, SimulationEventHandler &eventHandler) | |
| virtual | ~StopPointManager () |
| unsigned int | add (const StopPoint &stopPoint) |
| void | deleteStopPoint (unsigned int handle) |
| void | deleteAll () |
| void | enable (unsigned int handle) |
| void | enableAll () |
| void | enableOnceAndDelete (unsigned int handle) |
| void | enableOnceAndDisable (unsigned int handle) |
| void | disable (unsigned int handle) |
| void | disableAll () |
| const StopPoint & | stopPointWithHandleConst (unsigned int handle) const |
| unsigned int | stopPointHandle (unsigned int index) |
| unsigned int | stopPointCount () |
| void | setIgnore (unsigned int handle, unsigned int count) |
| void | setCondition (unsigned int handle, const ConditionScript &condition) |
| void | removeCondition (unsigned int handle) |
| unsigned int | stopCausingStopPoint (unsigned int index) const |
| unsigned int | stopCausingStopPointCount () const |
| void | handleEvent () |
Public Member Functions inherited from Listener | |
| Listener () | |
| virtual | ~Listener () |
| virtual void | handleEvent (int event) |
Private Types | |
| typedef std::map< unsigned int, StopPoint * > | StopPointIndex |
| The breakpoint storage. | |
| typedef std::vector< unsigned int > | HandleContainer |
| The handle storage. | |
Private Member Functions | |
| StopPoint * | findStopPoint (unsigned int handle) |
Private Attributes | |
| StopPointIndex | stopPoints_ |
| The stop points. | |
| HandleContainer | handles_ |
| The stop point handles. | |
| unsigned int | handleCount_ |
| Represents the next free handle. | |
| ClockCycleCount | lastStopCycle_ |
| The clock cycle in which simulation was stopped last. | |
| TTASimulationController & | controller_ |
| The simulation controller to use to stop the simulation. | |
| SimulationEventHandler & | eventHandler_ |
| The event handler to use to register stop points to. | |
Keeps book of user-set simulation stop points.
Definition at line 50 of file StopPointManager.hh.
|
private |
The handle storage.
Definition at line 88 of file StopPointManager.hh.
|
private |
The breakpoint storage.
Definition at line 86 of file StopPointManager.hh.
| StopPointManager::StopPointManager | ( | TTASimulationController & | controller, |
| SimulationEventHandler & | eventHandler | ||
| ) |
Constructor.
| controller | The simulation controller the stop points should use to stop the simulation. |
Definition at line 56 of file StopPointManager.cc.
|
virtual |
Destructor.
Definition at line 67 of file StopPointManager.cc.
References MapTools::deleteAllValues(), and stopPoints_.

| unsigned int StopPointManager::add | ( | const StopPoint & | stopPoint | ) |
Function that adds a new stop point.
Copies the given stop point.
| stopPoint | The stop point to be added. |
Definition at line 81 of file StopPointManager.cc.
References StopPoint::copy(), eventHandler_, handleCount_, handles_, Informer::registerListener(), SimulationEventHandler::SE_NEW_INSTRUCTION, StopPoint::setEnabled(), and stopPoints_.
Referenced by BPCommand::execute(), TBPCommand::execute(), and WatchCommand::execute().

| void StopPointManager::deleteAll | ( | ) |
Removes all stop points.
Definition at line 136 of file StopPointManager.cc.
References deleteStopPoint(), and handles_.
Referenced by DeleteBPCommand::execute().

| void StopPointManager::deleteStopPoint | ( | unsigned int | handle | ) |
Remove a stop point by the given handle.
| handle | The handle of the stop point to be removed. |
Definition at line 108 of file StopPointManager.cc.
References eventHandler_, findStopPoint(), handles_, SimulationEventHandler::SE_NEW_INSTRUCTION, stopPoints_, and Informer::unregisterListener().
Referenced by deleteAll(), DeleteBPCommand::execute(), handleEvent(), ProximBreakpointWindow::onDeleteBreakpoint(), and ProximBreakpointWindow::onDeleteWatch().

| void StopPointManager::disable | ( | unsigned int | handle | ) |
Disables the stop point by the given handle.
| handle | The handle for the stop point. |
Definition at line 200 of file StopPointManager.cc.
References findStopPoint(), and StopPoint::setEnabled().
Referenced by disableAll(), and DisableBPCommand::execute().

| void StopPointManager::disableAll | ( | ) |
Disables all stop oints.
Definition at line 208 of file StopPointManager.cc.
References disable(), and handles_.

| void StopPointManager::enable | ( | unsigned int | handle | ) |
Enables the stop point by the given handle.
| handle | The handle to identify the stop point. |
Definition at line 149 of file StopPointManager.cc.
References findStopPoint(), and StopPoint::setEnabled().
Referenced by enableAll(), and EnableBPCommand::execute().

| void StopPointManager::enableAll | ( | ) |
Enables all stop points.
Definition at line 157 of file StopPointManager.cc.
References enable(), and handles_.

| void StopPointManager::enableOnceAndDelete | ( | unsigned int | handle | ) |
Enables the stop point by the given handle and sets it to be deleted after being triggered.
| handle | The handle for the stop point. |
| InstanceNotFound | if the given handle cannot be found. |
Definition at line 172 of file StopPointManager.cc.
References findStopPoint(), StopPoint::setDeletedAfterTriggered(), and StopPoint::setEnabled().
Referenced by EnableBPCommand::execute().

| void StopPointManager::enableOnceAndDisable | ( | unsigned int | handle | ) |
Enables the stop point by the given handle and sets it to be disabled after being triggered.
| handle | The handle for the stop point. |
| InstanceNotFound | if the given handle cannot be found. |
Definition at line 187 of file StopPointManager.cc.
References findStopPoint(), StopPoint::setDisabledAfterTriggered(), and StopPoint::setEnabled().
Referenced by EnableBPCommand::execute().

|
private |
Tries to find a stop point by the given handle. If no such stop point is found, throws an exception.
| handle | The handle for the stop point. |
| InstanceNotFound | If no stop point with given handle is found. |
Definition at line 320 of file StopPointManager.cc.
References __func__, and stopPoints_.
Referenced by deleteStopPoint(), disable(), enable(), enableOnceAndDelete(), enableOnceAndDisable(), removeCondition(), setCondition(), and setIgnore().
|
virtual |
Stops simulation if there is at least one stop point requesting it.
Receives SE_NEW_INSTRUCTION events.
Reimplemented from Listener.
Definition at line 388 of file StopPointManager.cc.
References TTASimulationController::clockCount(), controller_, StopPoint::decreaseIgnoreCount(), deleteStopPoint(), StopPoint::ignoreCount(), StopPoint::isConditionOK(), StopPoint::isDeletedAfterTriggered(), StopPoint::isDisabledAfterTriggered(), StopPoint::isEnabled(), StopPoint::isTriggered(), lastStopCycle_, TTASimulationController::prepareToStop(), StopPoint::setEnabled(), SRE_BREAKPOINT, and stopPoints_.

| void StopPointManager::removeCondition | ( | unsigned int | handle | ) |
Removes the condition of triggering of the stop point by the given handle.
| handle | The handle for the stop point. |
| InstanceNotFound | If no stop point with given handle is found. |
Definition at line 308 of file StopPointManager.cc.
References findStopPoint(), and StopPoint::removeCondition().
Referenced by ConditionCommand::execute().

| void StopPointManager::setCondition | ( | unsigned int | handle, |
| const ConditionScript & | condition | ||
| ) |
Sets the condition of triggering for the stop point by the given handle.
| handle | The handle for the stop point. |
| condition | The condition to be used to determine if the stop point should be fired. |
| InstanceNotFound | If no stop point with given handle is found. |
Definition at line 296 of file StopPointManager.cc.
References findStopPoint(), and StopPoint::setCondition().
Referenced by ConditionCommand::execute().

| void StopPointManager::setIgnore | ( | unsigned int | handle, |
| unsigned int | count | ||
| ) |
Sets the number of times the stop point by the given handle should not be triggered when the condition is met.
| handle | The handle for the stop point. |
| count | The number of times the stop point should be ignored. |
| InstanceNotFound | If no stop point with given handle is found. |
Definition at line 283 of file StopPointManager.cc.
References findStopPoint(), and StopPoint::setIgnoreCount().
Referenced by IgnoreCommand::execute().

| unsigned int StopPointManager::stopCausingStopPoint | ( | unsigned int | index | ) | const |
Returns the handle of a stop causing stop point with given index in the container of stop causing stop points.
Stop causing stop point is a stop point that caused the latest stop of simulator.
| index | Index of the stop point in the container. |
| OutOfRange |
Definition at line 345 of file StopPointManager.cc.
References __func__, and stopPoints_.
Referenced by SimControlLanguageCommand::printStopReasons().
| unsigned int StopPointManager::stopCausingStopPointCount | ( | ) | const |
Returns the count of stop causing stop points.
Stop causing stop point is a stop point that caused the latest stop of simulator.
Definition at line 368 of file StopPointManager.cc.
References TTASimulationController::clockCount(), controller_, lastStopCycle_, and stopPoints_.
Referenced by SimControlLanguageCommand::printStopReasons().

| unsigned int StopPointManager::stopPointCount | ( | ) |
Returns the current number of stop points in the manager.
Can be used to access all stop points in the manager.
Definition at line 269 of file StopPointManager.cc.
References handles_.
Referenced by InfoBreakpointsCommand::execute(), ProximDisassemblyGridTable::GetValue(), ProximDisassemblyWindow::onRightClick(), ProximBreakpointWindow::refreshStopPoints(), and stopPointHandle().
| unsigned int StopPointManager::stopPointHandle | ( | unsigned int | index | ) |
Returns the handle of the stop point by the given index.
The index is not a direct index to the container used to store stop points, but more just a way to go through all of the stop points in the manager. A stop point may not have the same index every call.
All of the stop points can be accessed by going through the stop points with the indices between 0 and stopPointCount - 1, inclusive. The stop points are in no particular order.
| index | The index. |
| OutOfRange | If there is no stop point by the given index. |
Definition at line 231 of file StopPointManager.cc.
References __func__, handles_, and stopPointCount().
Referenced by InfoBreakpointsCommand::execute(), ProximDisassemblyGridTable::GetValue(), ProximDisassemblyWindow::onRightClick(), and ProximBreakpointWindow::refreshStopPoints().

| const StopPoint & StopPointManager::stopPointWithHandleConst | ( | unsigned int | handle | ) | const |
Returns the stop point with the given handle.
| handle | The handle. |
| InstanceNotFound | If there is no stop point with the given handle. |
Definition at line 248 of file StopPointManager.cc.
References __func__, and stopPoints_.
Referenced by ConditionCommand::execute(), IgnoreCommand::execute(), ProximDisassemblyGridTable::GetValue(), ProximBreakpointWindow::onBreakpointLookup(), ProximDisassemblyWindow::onRightClick(), SimControlLanguageCommand::printBreakpointInfo(), SimControlLanguageCommand::printStopReasons(), ProximBreakpointWindow::refreshStopPoints(), BreakpointPropertiesDialog::TransferDataToWindow(), WatchPropertiesDialog::TransferDataToWindow(), and SimControlLanguageCommand::verifyBreakpointHandles().
|
private |
The simulation controller to use to stop the simulation.
Definition at line 101 of file StopPointManager.hh.
Referenced by handleEvent(), and stopCausingStopPointCount().
|
private |
The event handler to use to register stop points to.
Definition at line 103 of file StopPointManager.hh.
Referenced by add(), and deleteStopPoint().
|
private |
Represents the next free handle.
Definition at line 97 of file StopPointManager.hh.
Referenced by add().
|
private |
The stop point handles.
Definition at line 95 of file StopPointManager.hh.
Referenced by add(), deleteAll(), deleteStopPoint(), disableAll(), enableAll(), stopPointCount(), and stopPointHandle().
|
private |
The clock cycle in which simulation was stopped last.
Definition at line 99 of file StopPointManager.hh.
Referenced by handleEvent(), and stopCausingStopPointCount().
|
private |
The stop points.
Definition at line 93 of file StopPointManager.hh.
Referenced by add(), deleteStopPoint(), findStopPoint(), handleEvent(), stopCausingStopPoint(), stopCausingStopPointCount(), stopPointWithHandleConst(), and ~StopPointManager().