1 // File: ModelAPI_Object.hxx
2 // Created: 19 May 2014
3 // Author: Mikhail PONIKAROV
5 #ifndef ModelAPI_Object_HeaderFile
6 #define ModelAPI_Object_HeaderFile
10 #include <boost/shared_ptr.hpp>
13 class ModelAPI_Document;
15 /**\class ModelAPI_Object
17 * \brief Represents any object in the data model and in the object browser.
19 * It may be feature or result of the feature. User just may set name for it
20 * or change this name later. Generic class for Feature, Body, Parameter and other
21 * objects related to the features and their results. Contains attributes of this
22 * object in the "Data".
26 boost::shared_ptr<ModelAPI_Data> myData; ///< manager of the data model of a feature
27 boost::shared_ptr<ModelAPI_Document> myDoc; ///< document this feature belongs to
29 /// By default object is displayed in the object browser.
30 virtual bool isInHistory() {return true;}
32 /// Returns the data manager of this object: attributes
33 virtual boost::shared_ptr<ModelAPI_Data> data() {return myData;}
35 /// Returns true if feature refers to the same data model instance
36 virtual bool isSame(const boost::shared_ptr<ModelAPI_Object>& theObject)
37 {return theObject.get() == this;}
39 /// Returns document this feature belongs to
40 virtual boost::shared_ptr<ModelAPI_Document> document()
43 /// Returns the group identifier of this object
44 virtual std::string groupName() = 0;
47 /// Sets the data manager of an object (document does)
48 virtual void setData(boost::shared_ptr<ModelAPI_Data> theData)
51 /// Sets the data manager of an object (document does)
52 virtual void setDoc(boost::shared_ptr<ModelAPI_Document> theDoc) {myDoc = theDoc;}
54 friend class Model_Document;
57 typedef boost::shared_ptr<ModelAPI_Object> ObjectPtr;