27 mExecutionTime(src.mExecutionTime),
33 const bool & equality,
34 const size_t & cascadingLevel) :
35 mExecutionTime(executionTime),
67 mpProcessQueue(src.mpProcessQueue)
75 mpProcessQueue(pProcessQueue)
84 mpProcessQueue(pProcessQueue)
104 bool StateChanged =
false;
110 if (mpEvent->delayAssignment())
112 mpProcessQueue->addAssignment(mpEvent->getAssignmentTime(mpProcessQueue->mTime),
113 mpProcessQueue->mEquality,
114 mpEvent->getTargetValues(),
119 StateChanged = mpEvent->executeAssignment();
125 StateChanged = mpEvent->setTargetValues(mValues);
130 if (mpProcessQueue->mpEventCallBack)
132 (*mpProcessQueue->mpEventCallBack)(mpProcessQueue->mpCallbackTask, mpEvent->getType());
170 mActions(src.mActions),
171 mExecutionLimit(src.mExecutionLimit),
172 mExecutionCounter(src.mExecutionCounter),
174 mEquality(src.mEquality),
175 mCascadingLevel(src.mCascadingLevel),
176 mSimultaneousAssignmentsFound(src.mSimultaneousAssignmentsFound),
177 mEventIdSet(src.mEventIdSet),
178 mpMathModel(src.mpMathModel),
179 mRootsFound(src.mRootsFound),
180 mRootValues1(src.mRootValues1),
181 mRootValues2(src.mRootValues2),
182 mpRootValuesBefore(&src.mRootValues1 == src.mpRootValuesBefore ? &mRootValues1 : &mRootValues2),
183 mpRootValuesAfter(&src.mRootValues1 == src.mpRootValuesAfter ? &mRootValues1 : &mRootValues2),
184 mpResolveSimultaneousAssignments(src.mpResolveSimultaneousAssignments),
185 mContinueSimultaneousEvents(src.mContinueSimultaneousEvents),
186 mpCallbackTask(src.mpCallbackTask),
187 mpEventCallBack(src.mpEventCallBack)
194 const bool & equality,
199 if (executionTime <
mTime)
return false;
203 if (executionTime >
mTime)
206 mActions.insert(std::make_pair(
CKey(executionTime, equality, CascadingLevel),
207 CAction(values, pEvent,
this)));
213 const bool & equality,
217 if (executionTime <
mTime)
return false;
221 if (executionTime >
mTime)
224 mActions.insert(std::make_pair(
CKey(executionTime, equality, CascadingLevel),
253 const bool & priorToOutput,
254 resolveSimultaneousAssignments pResolveSimultaneousAssignments)
266 bool stateChanged =
false;
308 while (itAction ==
mActions.end() &&
331 if (PendingActions.first == PendingActions.second)
336 iterator nextAction = PendingActions.first;
339 if (nextAction != PendingActions.second)
360 return PendingActions.first;
365 bool StateChanged = itAction->second.process();
391 for (; pRootFound != pRootEnd; ++pRootFound, ++pValueBefore, ++pValueAfter, ++ppRootFinder)
394 if (*pValueBefore == *pValueAfter)
401 if ((*ppRootFinder)->isEquality())
403 if ((*ppRootFinder)->isTrue())
405 if (*pValueAfter >= 0.0 || *pValueAfter > *pValueBefore)
417 if (*pValueAfter < 0.0 || *pValueAfter < *pValueBefore)
430 if ((*ppRootFinder)->isTrue())
432 if (*pValueAfter > 0.0 || *pValueAfter > *pValueBefore)
444 if (*pValueAfter <= 0.0 || *pValueAfter < *pValueBefore)
468 return range.first != range.second;
479 std::numeric_limits< C_FLOAT64 >::infinity();
486 return mActions.begin()->first.getExecutionTime();
507 os <<
"Process Queue" << std::endl;
508 std::multimap< CProcessQueue::CKey, CProcessQueue::CAction >::const_iterator it;
510 if (o.
mActions.size()) os <<
" Actions:" << std::endl;
514 os <<
"exec time " << it->first.mExecutionTime
515 <<
", cascading lvl " << it->first.mCascadingLevel
516 <<
", " << (it->first.mEquality ?
"equality, " :
"inequality");
522 os <<
"pEvent: 0x" << pEvent <<
", Action: ";
524 switch (it->second.mType)
528 if (pEvent->delayAssignment())
534 os <<
"Calculation & Assignment";
548 os << std::endl << std::endl;
Header file of class CExpression.
void initialize(CMathModel *pMathModel)
std::ostream & operator<<(std::ostream &os, const CProcessQueue &o)
CVector< C_FLOAT64 > * mpRootValuesAfter
const C_FLOAT64 & getProcessQueueExecutionTime() const
CVector< C_FLOAT64 > mRootValues1
static bool notEmpty(const range &range)
void evaluateRoots(CVectorCore< C_FLOAT64 > &rootValues, const bool &ignoreDiscrete)
const Type & getType() const
void resize(size_t size, const bool ©=false)
bool addAssignment(const C_FLOAT64 &executionTime, const bool &equality, const CVector< C_FLOAT64 > &values, CMathEvent *pEvent)
std::pair< std::multimap< CKey, CAction >::iterator, std::multimap< CKey, CAction >::iterator > range
std::set< size_t > mEventIdSet
const C_FLOAT64 & getInitialTime() const
const CEvent::Type & getType() const
EventCallBack mpEventCallBack
bool operator<(const CKey &rhs) const
void setContinueSimultaneousEvents(const bool &continueSimultaneousEvents)
void setEventCallBack(void *pTask, EventCallBack ecb)
CVector< C_INT > mRootsFound
bool executeAction(CProcessQueue::iterator itAction)
bool process(const C_FLOAT64 &time, const bool &priorToOutput, resolveSimultaneousAssignments pResolveSimultaneousAssignments)
CVector< C_FLOAT64 > mRootValues2
CVector< C_FLOAT64 > * mpRootValuesBefore
void destroyEventId(const size_t &eventId)
const bool & getContinueSimultaneousEvents() const
bool mContinueSimultaneousEvents
bool addCalculation(const C_FLOAT64 &executionTime, const bool &equality, CMathEvent *pEvent)
bool mSimultaneousAssignmentsFound
resolveSimultaneousAssignments mpResolveSimultaneousAssignments
size_t getNumRoots() const
std::multimap< CKey, CAction > mActions
const CVector< CMathTrigger::CRootFinder * > & getRootFinders() const
void processRoots(const C_FLOAT64 &time, const bool &equality, const bool &correct, const CVector< C_INT > &roots)
std::multimap< CKey, CAction >::iterator iterator