OpenASIP
2.0
|
#include <Informer.hh>
Public Member Functions | |
Informer () | |
virtual | ~Informer () |
void | handleEvent (int event) |
virtual bool | registerListener (int event, Listener *listener) |
virtual bool | unregisterListener (int event, Listener *listener) |
Private Types | |
typedef std::vector< std::pair< int, Listener * > > | ListenerList |
Private Member Functions | |
std::size_t | findListenerSlot (int event, Listener *listener) |
Private Attributes | |
ListenerList | eventListeners_ |
The Informer class delivers notifications of events (represented by integers) to Listeners.
A Listener can register to be notified of certain event(s) and will thereafter receive a notification every time the event takes place. Naturally, a Listener can also be unregistered to not receive any more notifications of the event.
Definition at line 52 of file Informer.hh.
|
private |
Definition at line 64 of file Informer.hh.
Informer::Informer | ( | ) |
|
virtual |
|
inlineprivate |
Finds the event slot for the given listener listening to the given event.
In case the listener is not found, it's added to the list and index of it is returned.
event | Event the listener is listening to. |
listener | The listener. |
Definition at line 65 of file Informer.cc.
References eventListeners_.
Referenced by registerListener(), and unregisterListener().
void Informer::handleEvent | ( | int | event | ) |
Referenced by CompiledSimulation::cycleEnd(), TracedSimulatorFrontend::killSimulation(), TracedSimulatorFrontend::loadMachine(), TracedSimulatorFrontend::loadProgram(), SimulationController::next(), CompiledSimController::next(), TracedSimulatorFrontend::next(), MemoryProxy::read(), SimulatorFrontend::reportSimulatedProgramError(), TracedSimulatorFrontend::run(), SimulationController::run(), CompiledSimController::run(), TracedSimulatorFrontend::runUntil(), SimulationController::runUntil(), CompiledSimController::runUntil(), OTASimulationController::simulateCycle(), SimulationController::simulateCycle(), SimulationController::step(), TracedSimulatorFrontend::step(), CompiledSimController::step(), and MemoryProxy::write().
|
virtual |
Adds the given Listener to the list of listeners of the given event.
After this function has been called, the listener will be notified every time the event occurs.
event | The code identifying the event. |
listener | The Listener that should be added. |
Definition at line 87 of file Informer.cc.
References findListenerSlot().
Referenced by StopPointManager::add(), BusTracker::BusTracker(), ExecutionTracker::ExecutionTracker(), ProximSimulationThread::initialize(), ProcedureTransferTracker::ProcedureTransferTracker(), ProximRuntimeErrorHandler::ProximRuntimeErrorHandler(), SimpleSimulatorFrontend::registerEventListener(), RFAccessTracker::RFAccessTracker(), RuntimeErrorReporter::RuntimeErrorReporter(), and RFAccessTracker::~RFAccessTracker().
|
virtual |
Removes the given Listener from the list of listeners of the given event.
After this function has been called, the listener will not be notified that the event has occurred.
event | The code identifying the event. |
listener | The Listener that should be removed. |
Definition at line 104 of file Informer.cc.
References eventListeners_, and findListenerSlot().
Referenced by StopPointManager::deleteStopPoint(), SimpleSimulatorFrontend::unregisterEventListener(), BusTracker::~BusTracker(), ExecutionTracker::~ExecutionTracker(), ProcedureTransferTracker::~ProcedureTransferTracker(), ProximRuntimeErrorHandler::~ProximRuntimeErrorHandler(), RFAccessTracker::~RFAccessTracker(), and RuntimeErrorReporter::~RuntimeErrorReporter().
|
private |
Definition at line 65 of file Informer.hh.
Referenced by findListenerSlot(), and unregisterListener().