Salome HOME
BoxFeature is rewritten + small corrections in APIs
[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_H_
6 #define ModelAPI_AttributeRefAttr_H_
7
8 #include "ModelAPI_Attribute.h"
9 #include "ModelAPI_Feature.h"
10
11 /**\class ModelAPI_AttributeRefAttr
12  * \ingroup DataModel
13  * \brief Attribute that contains reference to an attribute of a feature or reference to 
14  * a feature (switchable)
15  */
16
17 class ModelAPI_AttributeRefAttr : public ModelAPI_Attribute
18 {
19  public:
20   /// Returns true if this attribute references to a object (not to the attribute)
21   MODELAPI_EXPORT virtual bool isObject() = 0;
22
23   /// Defines the reference to the attribute
24   MODELAPI_EXPORT virtual void setAttr(AttributePtr theAttr) = 0;
25
26   /// Returns attribute referenced from this attribute
27   MODELAPI_EXPORT virtual AttributePtr attr() = 0;
28
29   /// Defines the reference to the object
30   MODELAPI_EXPORT virtual void setObject(ObjectPtr theFeature) = 0;
31
32   /// Returns object referenced from this attribute
33   MODELAPI_EXPORT virtual ObjectPtr object() = 0;
34
35   /// Returns the type of this class of attributes
36   MODELAPI_EXPORT static std::string type()
37   {
38     return "RefAttr";
39   }
40
41   /// Returns the type of this class of attributes, not static method
42   MODELAPI_EXPORT virtual std::string attributeType()
43   {
44     return type();
45   }
46
47   /// To virtually destroy the fields of successors
48   MODELAPI_EXPORT virtual ~ModelAPI_AttributeRefAttr()
49   {
50   }
51
52  protected:
53   /// Objects are created for features automatically
54   MODELAPI_EXPORT ModelAPI_AttributeRefAttr()
55   {
56   }
57 };
58
59 typedef std::shared_ptr<ModelAPI_AttributeRefAttr> AttributeRefAttrPtr;
60
61 #endif