1 // File: Model_Events.h
2 // Created: 10 Apr 2014
3 // Author: Mikhail PONIKAROV
5 #ifndef Model_Events_HeaderFile
6 #define Model_Events_HeaderFile
9 #include <Events_Message.h>
10 #include <boost/shared_ptr.hpp>
13 class ModelAPI_Feature;
14 class ModelAPI_Document;
16 /// Event ID that feature is created (comes with ModelAPI_FeatureUpdatedMessage)
17 static const char * EVENT_FEATURE_CREATED = "FeatureCreated";
18 /// Event ID that data of feature is updated (comes with ModelAPI_FeatureUpdatedMessage)
19 static const char * EVENT_FEATURE_UPDATED = "FeatureUpdated";
20 /// Event ID that data of feature is deleted (comes with ModelAPI_FeatureDeletedMessage)
21 static const char * EVENT_FEATURE_DELETED = "FeatureDeleted";
23 /// Message that feature was changed (used for Object Browser update)
24 class Model_FeatureUpdatedMessage : public Events_Message {
25 boost::shared_ptr<ModelAPI_Feature> myFeature; ///< which feature is changed
27 /// sender is not important, all information is located in the feature
28 Model_FeatureUpdatedMessage(
29 const boost::shared_ptr<ModelAPI_Feature>& theFeature,
30 const Events_ID& theEvent) : Events_Message(theEvent, 0), myFeature(theFeature)
33 /// Returns the feature that has been updated
34 boost::shared_ptr<ModelAPI_Feature> feature() const {return myFeature;}
37 /// Message that feature was deleted (used for Object Browser update)
38 class Model_FeatureDeletedMessage : public Events_Message {
39 boost::shared_ptr<ModelAPI_Document> myDoc; ///< document owner of the feature
40 std::string myGroup; ///< group identifier that contained the deleted feature
42 /// creates a message by initialization of fields
43 Model_FeatureDeletedMessage(const boost::shared_ptr<ModelAPI_Document>& theDoc,
44 const std::string& theGroup);
46 /// Returns the ID of this message (EVENT_FEATURE_DELETED)
47 static const Events_ID messageId();
49 /// Returns the feature that has been updated
50 boost::shared_ptr<ModelAPI_Document> document() const {return myDoc;}
52 /// Returns the group where the feature was deleted
53 const std::string& group() const {return myGroup;}