Salome HOME
f59d891f78609c6cc067908da3eeb02893893e0a
[modules/shaper.git] / src / Model / Model_Update.h
1 // File:        Model_Update.hxx
2 // Created:     25 Jun 2014
3 // Author:      Mikhail PONIKAROV
4
5 #ifndef Model_Update_HeaderFile
6 #define Model_Update_HeaderFile
7
8 #include "Model.h"
9 #include "Events_Listener.h"
10 #include <boost/shared_ptr.hpp>
11 #include <set>
12 #include <map>
13
14 class ModelAPI_Object;
15 class ModelAPI_Feature;
16
17 /**\class Model_Update
18  * \ingroup DataModel
19  * \brief Updates the results of features when it is needed.
20  */
21 class Model_Update : public Events_Listener
22 {
23   ///< initial set of updated features that must be processed
24   std::set<boost::shared_ptr<ModelAPI_Object> > myInitial;
25   ///< already updated and processed features and modificated feature flag
26   std::map<boost::shared_ptr<ModelAPI_Object>, bool> myUpdated;
27 public:
28   /// Is called only once, on startup of the application
29   Model_Update();
30
31   /// Processes the feature argument update: executes the results
32   MODEL_EXPORT virtual void processEvent(const Events_Message* theMessage);
33
34 protected:
35   /// Recoursively checks and updates the object if needed
36   /// Returns true if object was updated.
37   bool updateObject(boost::shared_ptr<ModelAPI_Object> theObject);
38 };
39
40 #endif