X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FEvents%2FEvents_Loop.cpp;h=d2d96de532ceda5a4c43bb051fadad2a3ebb7f21;hb=4d6bb9de0e54f09a9bbacc94a058cb7cd437d535;hp=9447c376b97c6a4f017be8206e8c13f41325fed6;hpb=4783f146b71a48c651523fcf0e12367bcf3d1fa8;p=modules%2Fshaper.git diff --git a/src/Events/Events_Loop.cpp b/src/Events/Events_Loop.cpp index 9447c376b..d2d96de53 100644 --- a/src/Events/Events_Loop.cpp +++ b/src/Events/Events_Loop.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: Events_Loop.hxx // Created: Thu Mar 13 2014 // Author: Mikhail PONIKAROV @@ -115,20 +117,40 @@ void Events_Loop::flush(const Events_ID& theID) { if (!myFlushActive) return; - std::map>::iterator aMyGroup = - myGroups.find(theID.eventText()); - if (aMyGroup != myGroups.end()) { // really sends - myFlushed.insert(theID.myID); + std::map >::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 aGroup = aMyGroup->second; myGroups.erase(aMyGroup); send(aGroup, false); - myFlushed.erase(myFlushed.find(theID.myID)); + + if (!aWasFlushed) + // TODO: Stabilization fix. Check later. + if(myFlushed.find(theID.myID) != myFlushed.end()) { + myFlushed.erase(myFlushed.find(theID.myID)); + } + } +} + +void Events_Loop::eraseMessages(const Events_ID& theID) +{ + std::map >::iterator aMyGroup = + myGroups.find(theID.eventText()); + if (aMyGroup != myGroups.end()) { + myGroups.erase(aMyGroup); } } -void Events_Loop::activateFlushes(const bool theActivate) + +bool Events_Loop::activateFlushes(const bool theActivate) { + bool isActive = myFlushActive; myFlushActive = theActivate; + return isActive; } void Events_Loop::clear(const Events_ID& theID) @@ -147,3 +169,16 @@ void Events_Loop::autoFlush(const Events_ID& theID, const bool theAuto) 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)); +}