Salome HOME
Debug of the parametric model updates
[modules/shaper.git] / src / Events / Events_Loop.h
index cd78497ed1c67b0c7b3482d5964df9b49674572b..b8a628ff7d73a9050e6ab527f5b620d4661ea2ca 100644 (file)
@@ -9,6 +9,7 @@
 #include <Events_Listener.h>
 
 #include <map>
+#include <set>
 #include <list>
 
 class Events_MessageGroup;
@@ -28,8 +29,14 @@ class Events_Loop
   /// map from event ID to sender pointer to listeners that must be called for this
   std::map<char*, std::map<void*, std::list<Events_Listener*> > > myListeners;
 
+  /// map from event ID to listeners which must process message without waiting for flush
+  std::map<char*, Events_Listener*> myImmediateListeners;
+
   /// map from event ID to groupped messages (accumulated on flush)
-  std::map<char*, Events_MessageGroup*> myGroups;
+  std::map<char*, boost::shared_ptr<Events_Message> > myGroups;
+
+  ///< set of messages that are flushed right now, so they are not grouped
+  std::set<char*> myFlushed;
 
   /// to process flushes or not
   bool myFlushActive;
@@ -46,12 +53,12 @@ class Events_Loop
 
   //! Allows to send an event
   //! \param isGroup is true for grouping messages if possible
-  EVENTS_EXPORT void send(Events_Message& theMessage, bool isGroup = true);
+  EVENTS_EXPORT void send(const boost::shared_ptr<Events_Message>& theMessage, bool isGroup = true);
 
   //! Registers (or adds if such listener is already registered) a listener 
   //! that will be called on the event and from the defined sender
   EVENTS_EXPORT void registerListener(Events_Listener* theListener, const Events_ID theID,
-                                      void* theSender = 0);
+                                      void* theSender = 0, bool theImmediate = false);
 
   //! Initializes sending of a group-message by the given ID
   EVENTS_EXPORT void flush(const Events_ID& theID);
@@ -59,6 +66,12 @@ class Events_Loop
   //! Allows to disable flushes: needed in synchronization of document mechanism 
   //! (to synchronize all and only then flush create, update, etc in correct order)
   EVENTS_EXPORT void activateFlushes(const bool theActivate);
+
+  //! Clears all collected messages
+  EVENTS_EXPORT void clear(const Events_ID& theID);
+
+  //! Enables flush without grouping for the given message
+  EVENTS_EXPORT void autoFlush(const Events_ID& theID, const bool theAuto = true);
 };
 
 #endif