Salome HOME
refs #30 - Sketch base GUI: create, draw lines
[modules/shaper.git] / src / ModelAPI / ModelAPI_Data.h
index c8f006ea5a8a7258049dbe032119832a24bbe238..f8dd2289673e932f53d9d01a26df8e5acee9c17b 100644 (file)
@@ -7,11 +7,15 @@
 
 #include "ModelAPI.h"
 #include <string>
-#include <memory>
+#include <boost/shared_ptr.hpp>
 
 class ModelAPI_AttributeDocRef;
 class ModelAPI_AttributeDouble;
+class ModelAPI_AttributeReference;
+class ModelAPI_AttributeRefAttr;
+class ModelAPI_AttributeRefList;
 class ModelAPI_Document;
+class ModelAPI_Attribute;
 
 /**\class ModelAPI_Data
  * \ingroup DataModel
@@ -30,9 +34,26 @@ public:
   virtual void setName(std::string theName) = 0;
 
   /// Returns the attribute that references to another document
-  virtual std::shared_ptr<ModelAPI_AttributeDocRef> docRef(const std::string theID) = 0;
+  virtual boost::shared_ptr<ModelAPI_AttributeDocRef> docRef(const std::string theID) = 0;
   /// Returns the attribute that contains real value with double precision
-  virtual std::shared_ptr<ModelAPI_AttributeDouble> real(const std::string theID) = 0;
+  virtual boost::shared_ptr<ModelAPI_AttributeDouble> real(const std::string theID) = 0;
+  /// Returns the attribute that contains reference to a feature
+  virtual boost::shared_ptr<ModelAPI_AttributeReference> reference(const std::string theID) = 0;
+  /// Returns the attribute that contains reference to an attribute of a feature
+  virtual boost::shared_ptr<ModelAPI_AttributeRefAttr> refattr(const std::string theID) = 0;
+  /// Returns the attribute that contains list of references to features
+  virtual boost::shared_ptr<ModelAPI_AttributeRefList> reflist(const std::string theID) = 0;
+
+  /// Returns the generic attribute by identifier
+  /// \param theID identifier of the attribute
+  virtual boost::shared_ptr<ModelAPI_Attribute> attribute(const std::string theID) = 0;
+  /// Identifier by the id (not fast, iteration by map)
+  /// \param theAttr attribute already created in this data
+  virtual const std::string& id(const boost::shared_ptr<ModelAPI_Attribute> theAttr) = 0;
+  /// Returns true if data belongs to same features
+  virtual bool isEqual(const boost::shared_ptr<ModelAPI_Data> theData) = 0;
+  /// Returns true if it is correctly connected t othe data model
+  virtual bool isValid() = 0;
 
   /// Initializes object by the attributes: must be called just after the object is created
   /// for each attribute of the object
@@ -40,9 +61,6 @@ public:
   /// \param theAttrType type of the created attribute (received from the type method)
   virtual void addAttribute(std::string theID, std::string theAttrType) = 0;
 
-  /// Returns the document of this data
-  virtual std::shared_ptr<ModelAPI_Document> document() = 0;
-
   /// To virtually destroy the fields of successors
   virtual ~ModelAPI_Data() {}
 
@@ -52,4 +70,7 @@ protected:
   {}
 };
 
+typedef boost::shared_ptr<ModelAPI_Data> DataPtr;
+
+
 #endif