Salome HOME
Added object, attribute and data model organization in the document.
[modules/shaper.git] / src / ModelAPI / ModelAPI_Feature.h
index 2c9339c7410305e9336e93fa85ae8442ff97c44c..a33d05084ea4c88675d15d9b6a653e2ebf9eecdd 100644 (file)
@@ -7,27 +7,42 @@
 
 #include "ModelAPI.h"
 #include <string>
+#include <memory>
 
-class ModelAPI_Feature;
+class ModelAPI_Object;
 
 /**\class ModelAPI_Feature
  * \ingroup DataModel
- * \brief General object of the application that allows
- * to get/set attributes from the document and compute result of an operation.
+ * \brief Functionality of the model object: to update result,
+ * to initialize attributes, etc.
  */
 
 class MODELAPI_EXPORT ModelAPI_Feature
 {
+  std::shared_ptr<ModelAPI_Object> myData; ///< manager of the data model of a feature
+
 public:
   /// Returns the kind of a feature (like "Point")
-  virtual std::string GetKind() = 0;
+  virtual std::string getKind() = 0;
+
+  /// Request for initialization of data model of the feature: adding all attributes
+  virtual void initAttributes() = 0;
+
+  /// Computes or recomputes the result
+  virtual void execute() = 0;
+
+  /// Returns the data manager of this feature
+  std::shared_ptr<ModelAPI_Object> data() {return myData;}
 
 protected:
   /// Use plugin manager for features creation: this method is 
   /// defined here only for SWIG-wrapping
   ModelAPI_Feature()
-  {
-  }
+  {}
+
+  /// Sets the data manager of an object (document does)
+  void setData(std::shared_ptr<ModelAPI_Object> theData) {myData = theData;}
+  friend class Model_Document;
 };
 
 #endif