1 // File: ModelAPI_Object.hxx
2 // Created: 19 May 2014
3 // Author: Mikhail PONIKAROV
5 #ifndef ModelAPI_Object_H_
6 #define ModelAPI_Object_H_
9 #include "ModelAPI_Data.h"
11 #include <boost/shared_ptr.hpp>
14 class ModelAPI_Document;
16 /**\class ModelAPI_Object
18 * \brief Represents any object in the data model and in the object browser.
20 * It may be feature or result of the feature. User just may set name for it
21 * or change this name later. Generic class for Feature, Body, Parameter and other
22 * objects related to the features and their results. Contains attributes of this
23 * object in the "Data".
27 boost::shared_ptr<ModelAPI_Data> myData; ///< manager of the data model of a feature
28 boost::shared_ptr<ModelAPI_Document> myDoc; ///< document this object belongs to
30 /// By default object is displayed in the object browser.
31 virtual bool isInHistory()
36 /// Returns the data manager of this object: attributes
37 virtual boost::shared_ptr<ModelAPI_Data> data()
42 /// Returns true if object refers to the same data model instance
43 virtual bool isSame(const boost::shared_ptr<ModelAPI_Object>& theObject)
45 return theObject.get() == this;
48 /// Returns document this feature belongs to
49 virtual boost::shared_ptr<ModelAPI_Document> document()
54 /// Returns the group identifier of this object
55 virtual std::string groupName() = 0;
58 /// Sets the data manager of an object (document does)
59 virtual void setData(boost::shared_ptr<ModelAPI_Data> theData)
64 /// Sets the data manager of an object (document does)
65 virtual void setDoc(boost::shared_ptr<ModelAPI_Document> theDoc)
70 /// removes all fields from this feature
71 MODELAPI_EXPORT virtual void erase() {
72 if (myData) myData->erase();
76 friend class Model_Document;
80 typedef boost::shared_ptr<ModelAPI_Object> ObjectPtr;