void Searcher_DatonSet::pPull() { ZGuardMtxR guard(fMtxR); set<ZRef<Callable_PullFrom> > theCallables_PullFrom; swap(theCallables_PullFrom, fCallables_PullFrom); foreachv (ZRef<Callable_PullFrom> theCallable, theCallables_PullFrom) { guard.Release(); ZRef<ZDatonSet::Deltas> theDeltas; ZRef<Event> theEvent; theCallable->Call(fEvent, theDeltas, theEvent); guard.Acquire(); fEvent = fEvent->Joined(theEvent); const Vector_Event_Delta_t& theVector = theDeltas->GetVector(); foreachi (iterVector, theVector) { const ZRef<Event>& theEvent = iterVector->first; const map<Daton, bool>& theStatements = iterVector->second->GetStatements(); foreachi (iterStmts, theStatements) { const Daton& theDaton = iterStmts->first; map<Daton, pair<ZRef<Event>, ZVal_Any> >::iterator lbAssert = fMap_Assert.lower_bound(theDaton); map<Daton, ZRef<Event> >::iterator lbRetract = fMap_Retract.lower_bound(theDaton); if (iterStmts->second) { // It's an assert if (lbAssert != fMap_Assert.end() and lbAssert->first == theDaton) { // It's in fMap_Assert. ZAssert(lbRetract == fMap_Retract.end() || lbRetract->first != theDaton); if (sIsBefore(lbAssert->second.first, theEvent)) { // It's more recent. const ZVal_Any theVal = sAsVal(theDaton); this->pChanged(theVal); lbAssert->second.first = theEvent; lbAssert->second.second = theVal; } } else if (lbRetract != fMap_Retract.end() and lbRetract->first == theDaton) { // It's in fMap_Retract. if (sIsBefore(lbRetract->second, theEvent)) { // It's more recent. const ZVal_Any theVal = sAsVal(theDaton); this->pChanged(theVal); fMap_Retract.erase(lbRetract); fMap_Assert.insert(lbAssert, make_pair(theDaton, make_pair(theEvent, theVal))); } } else { // It's not previously known. const ZVal_Any theVal = sAsVal(theDaton); this->pChanged(theVal); fMap_Assert.insert(lbAssert, make_pair(theDaton, make_pair(theEvent, theVal))); } } else { // It's a retract. if (lbAssert != fMap_Assert.end() and lbAssert->first == theDaton) { // It's in fMap_Assert. ZAssert(lbRetract == fMap_Retract.end() || lbRetract->first != theDaton); if (sIsBefore(lbAssert->second.first, theEvent)) { // It's more recent. this->pChanged(lbAssert->second.second); fMap_Assert.erase(lbAssert); fMap_Retract.insert(lbRetract, make_pair(theDaton, theEvent)); } } else if (lbRetract != fMap_Retract.end() and lbRetract->first == theDaton) { // It's in fMap_Retract. if (sIsBefore(lbRetract->second, theEvent)) { // It's more recent. lbRetract->second = theEvent; } } else { // It's not previously known. fMap_Retract.insert(lbRetract, make_pair(theDaton, theEvent)); } } } } }