Salome HOME
Sending events on attributes data changed
[modules/shaper.git] / src / ModelAPI / ModelAPI_Attribute.h
1 // File:        ModelAPI_Attribute.h
2 // Created:     2 Apr 2014
3 // Author:      Mikhail PONIKAROV
4
5 #ifndef ModelAPI_Attribute_HeaderFile
6 #define ModelAPI_Attribute_HeaderFile
7
8 #include "ModelAPI.h"
9 #include <string>
10 #include <boost/shared_ptr.hpp>
11
12 class ModelAPI_Feature;
13
14 /**\class ModelAPI_Attribute
15  * \ingroup DataModel
16  * \brief Generic attribute of the Object.
17  */
18 class ModelAPI_Attribute
19 {
20   ///< needed here to emit signal that feature changed on change of the attribute
21   boost::shared_ptr<ModelAPI_Feature> myFeature;
22 public:
23   
24   /// Returns the type of this class of attributes, not static method
25   MODELAPI_EXPORT virtual std::string attributeType() = 0;
26
27   /// To virtually destroy the fields of successors
28   MODELAPI_EXPORT virtual ~ModelAPI_Attribute() {}
29
30   MODELAPI_EXPORT void setFeature(const boost::shared_ptr<ModelAPI_Feature>& theFeature)
31     {myFeature = theFeature;}
32
33   MODELAPI_EXPORT const boost::shared_ptr<ModelAPI_Feature>& feature()
34   {return myFeature;}
35 protected:
36   /// Objects are created for features automatically
37   ModelAPI_Attribute(){}
38
39 };
40
41 #endif