bugfixes in overall coroutine handling to allow the overwriting of onTrigger.

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1721 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
adrian
2012-10-05 11:48:39 +00:00
parent 32de9e174e
commit 31aa3aa925
3 changed files with 22 additions and 5 deletions

View File

@ -13,7 +13,14 @@ int interrupt_to_fire = -1;
bool SimulatorController::addListener(BaseListener* li)
{
assert(li != NULL && "FATAL ERROR: Argument (ptr) cannot be NULL!");
m_LstList.add(li, m_Flows.getCurrent());
// If addListener() was called from onTrigger(), there is no parent
// to retrieve/assign. In this case, we simple expect the parent-member
// to be valid ('as is'). (Otherwise, the current flow is retrieved by
// calling CoroutineManager::getCurrent().)
ExperimentFlow* pFlow = m_Flows.getCurrent();
if (pFlow == CoroutineManager::SIM_FLOW)
pFlow = li->getParent();
m_LstList.add(li, pFlow);
// Call the common postprocessing function:
if (!li->onAddition()) { // If the return value signals "false"...,
m_LstList.remove(li); // ...skip the addition