Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[modules/shaper.git] / src / Model / Model_Data.h
index 01b66978090198dfd92624ff87ca61e941e795de..5a2f6296e1a385745534e42fd2c56312aa4be27a 100644 (file)
@@ -17,6 +17,7 @@
 #include <ModelAPI_AttributeReference.h>
 #include <ModelAPI_AttributeRefList.h>
 #include <ModelAPI_AttributeString.h>
+#include <ModelAPI_AttributeIntArray.h>
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_Object.h>
@@ -49,6 +50,8 @@ class Model_Data : public ModelAPI_Data
 
   /// List of attributes referenced to owner (updated only during the transaction change)
   std::set<AttributePtr> myRefsToMe;
+  /// flag that may block the "attribute updated" sending
+  bool mySendAttributeUpdated;
 
   Model_Data();
 
@@ -98,6 +101,10 @@ class Model_Data : public ModelAPI_Data
   /// Returns the attribute that contains real value with double precision
   MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeString>
     string(const std::string& theID);
+  /// Returns the attribute that contains integer values array
+  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeIntArray>
+    intArray(const std::string& theID);
+
   /// Returns the generic attribute by identifier
   /// \param theID identifier of the attribute
   MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Attribute> attribute(const std::string& theID);
@@ -127,11 +134,15 @@ class Model_Data : public ModelAPI_Data
   /// for each attribute of the object
   /// \param theID identifier of the attribute that can be referenced by this ID later
   /// \param theAttrType type of the created attribute (received from the type method)
-  MODEL_EXPORT virtual void addAttribute(const std::string& theID, const std::string theAttrType);
+  /// \returns the just created attribute
+  MODEL_EXPORT virtual AttributePtr 
+    addAttribute(const std::string& theID, const std::string theAttrType);
 
   /// Useful method for "set" methods of the attributes: sends an UPDATE event and
   /// makes attribute initialized
   MODEL_EXPORT virtual void sendAttributeUpdated(ModelAPI_Attribute* theAttr);
+  /// Blocks sending "attribute updated" if theBlock is true
+  MODEL_EXPORT virtual void blockSendAttributeUpdated(const bool theBlock);
 
   /// Puts feature to the document data sub-structure
   MODEL_EXPORT void setLabel(TDF_Label theLab);
@@ -157,17 +168,22 @@ class Model_Data : public ModelAPI_Data
   /// Returns the identifier of feature-owner, unique in this document
   MODEL_EXPORT virtual int featureId() const;
 
-  // returns all objects referenced to this
+  /// returns all objects referenced to this
   MODEL_EXPORT virtual const std::set<AttributePtr>& refsToMe() {return myRefsToMe;}
 
+  /// returns all references by attributes of this data
+  /// \param theRefs returned list of pairs: id of referenced attribute and list of referenced objects
+  MODEL_EXPORT virtual void referencesToObjects(
+    std::list<std::pair<std::string, std::list<ObjectPtr> > >& theRefs);
+
+  /// Copies all atributes content into theTarget data
+  MODEL_EXPORT virtual void copyTo(std::shared_ptr<ModelAPI_Data> theTarget);
+
 private:
-  // removes all information about back references
+  /// removes all information about back references
   void eraseBackReferences();
   // adds a back reference (with identifier which attribute references to this object
   void addBackReference(FeaturePtr theFeature, std::string theAttrID);
-  // returns all references by attributes of this data
-  // \param the returned list of pairs: id of referenced attribute and list of referenced objects
-  void referencesToObjects(std::list<std::pair<std::string, std::list<ObjectPtr> > >& theRefs);
 };
 
 #endif