1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModelAPI_Object.hxx
4 // Created: 19 May 2014
5 // Author: Mikhail PONIKAROV
7 #ifndef ModelAPI_Object_H_
8 #define ModelAPI_Object_H_
11 #include "ModelAPI_Data.h"
16 class ModelAPI_Document;
18 /**\class ModelAPI_Object
20 * \brief Represents any object in the data model and in the object browser.
22 * It may be feature or result of the feature. User just may set name for it
23 * or change this name later. Generic class for Feature, Body, Parameter and other
24 * objects related to the features and their results. Contains attributes of this
25 * object in the "Data".
29 std::shared_ptr<ModelAPI_Data> myData; ///< manager of the data model of a feature
30 std::shared_ptr<ModelAPI_Document> myDoc; ///< document this object belongs to
32 /// By default object is displayed in the object browser.
33 MODELAPI_EXPORT virtual bool isInHistory();
35 /// Returns the data manager of this object: attributes
36 MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Data> data() const;
38 /// Returns true if object refers to the same data model instance
39 MODELAPI_EXPORT virtual bool isSame(const std::shared_ptr<ModelAPI_Object>& theObject);
41 /// Returns document this feature belongs to
42 MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Document> document() const;
44 /// Returns the group identifier of this object
45 virtual std::string groupName() = 0;
47 /// Called on change of any argument-attribute of this object
48 /// \param theID identifier of changed attribute
50 MODELAPI_EXPORT virtual void attributeChanged(const std::string& theID);
52 /// To use virtuality for destructors
53 MODELAPI_EXPORT virtual ~ModelAPI_Object();
56 /// Sets the data manager of an object (document does)
57 MODELAPI_EXPORT virtual void setData(std::shared_ptr<ModelAPI_Data> theData);
59 /// Sets the data manager of an object (document does)
60 MODELAPI_EXPORT virtual void setDoc(std::shared_ptr<ModelAPI_Document> theDoc);
62 /// removes all fields from this feature
63 MODELAPI_EXPORT virtual void erase();
65 friend class Model_Document;
69 typedef std::shared_ptr<ModelAPI_Object> ObjectPtr;