Salome HOME
Merge remote-tracking branch 'remotes/origin/master' into SolveSpace
[modules/shaper.git] / src / ModelAPI / ModelAPI_AttributeRefAttr.h
1 // File:        ModelAPI_AttributeRefAttr.h
2 // Created:     8 May 2014
3 // Author:      Mikhail PONIKAROV
4
5 #ifndef ModelAPI_AttributeRefAttr_HeaderFile
6 #define ModelAPI_AttributeRefAttr_HeaderFile
7
8 #include "ModelAPI_Attribute.h"
9
10 /**\class ModelAPI_AttributeRefAttr
11  * \ingroup DataModel
12  * \brief Attribute that contains reference to an attribute of a feature or reference to 
13  * a feature (switchable)
14  */
15
16 class ModelAPI_AttributeRefAttr : public ModelAPI_Attribute
17 {
18 public:
19   /// Returns true if this attribute references to a feature (not to the attribute)
20   MODELAPI_EXPORT virtual bool isFeature() = 0;
21
22   /// Defines the reference to the attribute
23   MODELAPI_EXPORT virtual void setAttr(boost::shared_ptr<ModelAPI_Attribute> theAttr) = 0;
24
25   /// Returns attribute referenced from this attribute
26   MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Attribute> attr() = 0;
27
28   /// Defines the reference to the feature
29   MODELAPI_EXPORT virtual void setFeature(boost::shared_ptr<ModelAPI_Feature> theFeature) = 0;
30
31   /// Returns feature referenced from this attribute
32   MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> feature() = 0;
33
34   /// Returns the type of this class of attributes
35   MODELAPI_EXPORT static std::string type() {return "RefAttr";}
36
37   /// Returns the type of this class of attributes, not static method
38   MODELAPI_EXPORT virtual std::string attributeType() {return type();}
39
40   /// To virtually destroy the fields of successors
41   MODELAPI_EXPORT virtual ~ModelAPI_AttributeRefAttr() {}
42
43 protected:
44   /// Objects are created for features automatically
45   MODELAPI_EXPORT ModelAPI_AttributeRefAttr()
46   {}
47 };
48
49 #endif