Salome HOME
Replace boost::shared_ptr<ModelAPI_Feature> on FeaturePtr
[modules/shaper.git] / src / ModelAPI / ModelAPI_Object.h
index 7f78a35ce277e7b98bb3ae200087394094398b61..581f045884c0e45f2bf4efc43271fbfa47634611 100644 (file)
@@ -1,48 +1,38 @@
 // File:        ModelAPI_Object.hxx
-// Created:     21 Mar 2014
+// Created:     19 May 2014
 // Author:      Mikhail PONIKAROV
 
 #ifndef ModelAPI_Object_HeaderFile
 #define ModelAPI_Object_HeaderFile
 
-#include "ModelAPI.h"
-#include <string>
-#include <memory>
+#include "ModelAPI_Feature.h"
 
-class ModelAPI_AttributeDocRef;
-class ModelAPI_AttributeDouble;
+#include <boost/shared_ptr.hpp>
 
 /**\class ModelAPI_Object
  * \ingroup DataModel
- * \brief General object of the application that allows
- * to get/set attributes from the document and compute result of an operation.
+ * \brief Represents the result of some feature in the object browser
+ * under the specific folder. Just a reference to specific feature-operation
+ * with possibility to rename it.
  */
-
-class MODELAPI_EXPORT ModelAPI_Object
+class ModelAPI_Object : public ModelAPI_Feature
 {
 public:
 
-  /// Returns the name of the feature visible by the user in the object browser
-  virtual std::string getName() = 0;
-
-  /// Defines the name of the feature visible by the user in the object browser
-  virtual void setName(std::string theName) = 0;
+  /// It is never located in history
+  MODELAPI_EXPORT virtual bool isInHistory() {return false;}
 
-  /// Returns the attribute that references to another document
-  virtual std::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;
+  /// Reference to the feature-operation that produces this object
+  MODELAPI_EXPORT virtual FeaturePtr featureRef() = 0;
 
-  /// Initializes object by the attributes: must be called just after the object is created
-  /// 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)
-  virtual void addAttribute(std::string theID, std::string theAttrType) = 0;
+  /// Returns the name of this object (by default equal to the name of feature)
+  MODELAPI_EXPORT virtual std::string getName() = 0;
 
-protected:
-  /// Objects are created for features automatically
-  ModelAPI_Object()
-  {}
+  /// Defines the name of the object
+  MODELAPI_EXPORT virtual void setName(std::string theName) = 0;
 };
 
+
+typedef boost::shared_ptr<ModelAPI_Object> ObjectPtr;
+
 #endif