Salome HOME
Added object, attribute and data model organization in the document.
[modules/shaper.git] / src / ModelAPI / ModelAPI_Feature.h
1 // File:        ModelAPI_Feature.hxx
2 // Created:     21 Mar 2014
3 // Author:      Mikhail PONIKAROV
4
5 #ifndef ModelAPI_Feature_HeaderFile
6 #define ModelAPI_Feature_HeaderFile
7
8 #include "ModelAPI.h"
9 #include <string>
10 #include <memory>
11
12 class ModelAPI_Object;
13
14 /**\class ModelAPI_Feature
15  * \ingroup DataModel
16  * \brief Functionality of the model object: to update result,
17  * to initialize attributes, etc.
18  */
19
20 class MODELAPI_EXPORT ModelAPI_Feature
21 {
22   std::shared_ptr<ModelAPI_Object> myData; ///< manager of the data model of a feature
23
24 public:
25   /// Returns the kind of a feature (like "Point")
26   virtual std::string getKind() = 0;
27
28   /// Request for initialization of data model of the feature: adding all attributes
29   virtual void initAttributes() = 0;
30
31   /// Computes or recomputes the result
32   virtual void execute() = 0;
33
34   /// Returns the data manager of this feature
35   std::shared_ptr<ModelAPI_Object> data() {return myData;}
36
37 protected:
38   /// Use plugin manager for features creation: this method is 
39   /// defined here only for SWIG-wrapping
40   ModelAPI_Feature()
41   {}
42
43   /// Sets the data manager of an object (document does)
44   void setData(std::shared_ptr<ModelAPI_Object> theData) {myData = theData;}
45   friend class Model_Document;
46 };
47
48 #endif