Salome HOME
Merge branch 'master' of newgeom:newgeom.git
[modules/shaper.git] / src / Model / Model_Object.h
index d96f90b181f061c6b56989f5e3d52be99f6de234..6b1f785f4a6da6fd62553fb362d4482bb4fa5afb 100644 (file)
@@ -19,15 +19,20 @@ class ModelAPI_Attribute;
  * to get/set attributes from the document and compute result of an operation.
  */
 
-class Model_Object: public ModelAPI_Object
+class MODEL_EXPORT Model_Object: public ModelAPI_Object
 {
   TDF_Label myLab; ///< label of the feature in the document
   /// All attributes of the object identified by the attribute ID
   std::map<std::string, std::shared_ptr<ModelAPI_Attribute> > myAttrs;
 
+  std::shared_ptr<ModelAPI_Document> myDoc; ///< document this feature belongs to
+
   Model_Object();
 
+  TDF_Label label() {return myLab;}
+
   friend class Model_Document;
+  friend class Model_Iterator;
 
 public:
   /// Returns the name of the feature visible by the user in the object browser
@@ -35,7 +40,9 @@ public:
   /// Defines the name of the feature visible by the user in the object browser
   virtual void setName(std::string theName);
   /// Returns the attribute that references to another document
-  std::shared_ptr<ModelAPI_AttributeDocRef> docRef(const std::string theID);
+  virtual std::shared_ptr<ModelAPI_AttributeDocRef> docRef(const std::string theID);
+  /// Returns the attribute that contains real value with double precision
+  virtual std::shared_ptr<ModelAPI_AttributeDouble> real(const std::string theID);
 
   /// Initializes object by the attributes: must be called just after the object is created
   /// for each attribute of the object
@@ -43,8 +50,14 @@ public:
   /// \param theAttrType type of the created attribute (received from the type method)
   virtual void addAttribute(std::string theID, std::string theAttrType);
 
+  /// Returns the document of this data
+  virtual std::shared_ptr<ModelAPI_Document> document() {return myDoc;}
+
   /// Puts feature to the document data sub-structure
   void setLabel(TDF_Label& theLab);
+
+  /// Sets the document of this data
+  virtual void setDocument(const std::shared_ptr<ModelAPI_Document>& theDoc) {myDoc = theDoc;}
 };
 
 #endif