Salome HOME
Merge Dev_2.1.0 with PythonAPI branch
[modules/shaper.git] / src / Model / Model_AttributeRefAttr.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        Model_AttributeRefAttr.h
4 // Created:     8 May 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef Model_AttributeRefAttr_H_
8 #define Model_AttributeRefAttr_H_
9
10 #include "Model.h"
11 #include "ModelAPI_AttributeRefAttr.h"
12 #include <TDF_Label.hxx>
13 #include <TDF_Reference.hxx>
14 #include <TDataStd_Comment.hxx>
15
16 /**\class Model_AttributeRefAttr
17  * \ingroup DataModel
18  * \brief Attribute that contains reference to an attribute of a feature 
19  * (located in the same document).
20  */
21
22 class Model_AttributeRefAttr : public ModelAPI_AttributeRefAttr
23 {
24   Handle_TDF_Reference myRef;  ///< reference to the feature label
25   ///< ID of the referenced attirbute (empty if this is a reference to a feature)
26   Handle_TDataStd_Comment myID;
27  public:
28   /// Returns true if this attribute references to a object (not to the attribute)
29   MODEL_EXPORT virtual bool isObject();
30
31   /// Defines the reference to the attribute
32   MODEL_EXPORT virtual void setAttr(std::shared_ptr<ModelAPI_Attribute> theAttr);
33
34   /// Returns attribute referenced from this attribute
35   MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Attribute> attr();
36
37   /// Defines the reference to the object
38   MODEL_EXPORT virtual void setObject(ObjectPtr theFeature);
39
40   /// Returns object referenced from this attribute
41   MODEL_EXPORT virtual ObjectPtr object();
42
43   /// Returns true if attribute was  initialized by some value
44   MODEL_EXPORT virtual bool isInitialized();
45
46  protected:
47   /// Objects are created for features automatically
48   MODEL_EXPORT Model_AttributeRefAttr(TDF_Label& theLabel);
49
50   friend class Model_Data;
51 };
52
53 #endif