Listener handler revisited (onTrigger toggles the current flow), typo.
git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1713 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
@ -8,6 +8,12 @@ BaseListener::~BaseListener()
|
||||
simulator.removeListener(this);
|
||||
}
|
||||
|
||||
void BaseListener::onTrigger()
|
||||
{
|
||||
assert(m_Parent && "FATAL ERROR: The listener has no parent!");
|
||||
simulator.toggle(m_Parent);
|
||||
}
|
||||
|
||||
bool TroubleListener::isMatching(const TroubleEvent* pEv) const
|
||||
{
|
||||
for (unsigned i = 0; i < m_WatchNumbers.size(); i++) {
|
||||
|
||||
@ -42,7 +42,7 @@ public:
|
||||
*/
|
||||
virtual bool onAddition() { return true; }
|
||||
/**
|
||||
* This method is called when an experiment flow removes an listener from
|
||||
* This method is called when an experiment flow removes a listener from
|
||||
* the listener-management by calling \c removeListener(), \c clearListeners()
|
||||
* or by deleting a complete flow (\c removeFlow()). More specifically, this
|
||||
* listener handler will be called *before* the listener is actually deleted.
|
||||
@ -50,11 +50,11 @@ public:
|
||||
virtual void onDeletion() { }
|
||||
/**
|
||||
* This method is called when an previously added listener is about to be
|
||||
* triggered by the simulator-backend. More specifically, this listener handler
|
||||
* will be called *before* the listener is actually triggered, i.e. before the
|
||||
* corresponding coroutine is toggled.
|
||||
* triggered by the simulator-backend. \c onTrigger() toggles the experiment
|
||||
* flow specified by \c BaseListener::getParent(). You can use this handler
|
||||
* as a callback function by overwriting this method appropriately.
|
||||
*/
|
||||
virtual void onTrigger() { }
|
||||
virtual void onTrigger();
|
||||
/**
|
||||
* Decreases the listener counter by one. When this counter reaches zero, the
|
||||
* listener will be triggered.
|
||||
|
||||
@ -236,10 +236,8 @@ void ListenerManager::triggerActiveListeners()
|
||||
m_pFired = *it;
|
||||
// Inform (call) the simulator's (internal) listener handler that we are about
|
||||
// to trigger an listener (*before* we actually toggle the experiment flow):
|
||||
m_pFired->onTrigger();
|
||||
ExperimentFlow* pFlow = m_pFired->getParent();
|
||||
assert(pFlow && "FATAL ERROR: The listener has no parent experiment (owner)!");
|
||||
simulator.m_Flows.toggle(pFlow);
|
||||
m_pFired->onDeletion(); // the listener has already been deleted (in the buffer-list)!
|
||||
m_pFired->onTrigger(); // onTrigger will toggle the correct coroutine
|
||||
}
|
||||
}
|
||||
m_FireList.clear();
|
||||
|
||||
@ -235,6 +235,11 @@ public:
|
||||
* @see ListenerManager::dereference()
|
||||
*/
|
||||
inline BaseListener* dereference(index_t idx) { return m_LstList.dereference(idx); }
|
||||
/**
|
||||
* Toggles the provided experiment flow by activating its coroutine.
|
||||
* @param pfl the experiment flow to be activated
|
||||
*/
|
||||
void toggle(ExperimentFlow* pfl) { m_Flows.toggle(pfl); }
|
||||
};
|
||||
|
||||
// FIXME (see SimulatorController.cc): Weird, homeless global variable
|
||||
|
||||
Reference in New Issue
Block a user