Salome HOME
Merge branch 'Dev_1.1.1' of newgeom:newgeom into Dev_1.2.0
[modules/shaper.git] / src / Model / Model_AttributeReference.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        Model_AttributeReference.h
4 // Created:     8 May 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef Model_AttributeReference_H_
8 #define Model_AttributeReference_H_
9
10 #include "Model.h"
11 #include "ModelAPI_AttributeReference.h"
12 #include <ModelAPI_Feature.h>
13 #include <TDF_Label.hxx>
14 #include <TDF_Reference.hxx>
15
16 /**\class Model_AttributeReference
17  * \ingroup DataModel
18  * \brief Attribute that contains reference to feature (located in the same document).
19  */
20
21 class Model_AttributeReference : public ModelAPI_AttributeReference
22 {
23   Handle_TDF_Reference myRef;  ///< references to the feature label
24  public:
25   /// Defines the object referenced from this attribute
26   MODEL_EXPORT virtual void setValue(ObjectPtr theObject);
27
28   /// Returns object referenced from this attribute
29   MODEL_EXPORT virtual ObjectPtr value();
30
31   MODEL_EXPORT ~Model_AttributeReference();
32
33   MODEL_EXPORT virtual void setObject(const std::shared_ptr<ModelAPI_Object>& theObject);
34
35   /// Returns true if attribute was  initialized by some value
36   MODEL_EXPORT virtual bool isInitialized();
37
38
39 protected:
40   /// Objects are created for features automatically
41   MODEL_EXPORT Model_AttributeReference(TDF_Label& theLabel);
42
43   friend class Model_Data;
44   friend class Model_AttributeSelection;
45 };
46
47 #endif