+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
// File: Events_Loop.hxx
// Created: Thu Mar 13 2014
// Author: Mikhail PONIKAROV
{
if (!myFlushActive)
return;
- std::map<char*, std::shared_ptr<Events_Message>>::iterator aMyGroup =
- myGroups.find(theID.eventText());
- if (aMyGroup != myGroups.end()) { // really sends
- myFlushed.insert(theID.myID);
+ std::map<char*, std::shared_ptr<Events_Message> >::iterator aMyGroup;
+ for(aMyGroup = myGroups.find(theID.eventText());
+ aMyGroup != myGroups.end(); aMyGroup = myGroups.find(theID.eventText()))
+ { // really sends
+ bool aWasFlushed = myFlushed.find(theID.myID) != myFlushed.end();
+ if (!aWasFlushed)
+ myFlushed.insert(theID.myID);
std::shared_ptr<Events_Message> aGroup = aMyGroup->second;
myGroups.erase(aMyGroup);
send(aGroup, false);
- std::set<char*>::iterator anIt = myFlushed.find(theID.myID);
- if (anIt != myFlushed.end()) {
- myFlushed.erase(anIt);
- }
+
+ if (!aWasFlushed)
+ myFlushed.erase(myFlushed.find(theID.myID));
}
}
else
myFlushed.erase(myFlushed.find(theID.myID));
}
+
+bool Events_Loop::isFlushed(const Events_ID& theID)
+{
+ return myFlushed.find(theID.myID) != myFlushed.end();
+}
+
+void Events_Loop::setFlushed(const Events_ID& theID, const bool theValue)
+{
+ if (theValue)
+ myFlushed.insert(theID.myID);
+ else
+ myFlushed.erase(myFlushed.find(theID.myID));
+}