1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: Model_AttributeReference.h
5 // Author: Mikhail PONIKAROV
7 #ifndef Model_AttributeReference_H_
8 #define Model_AttributeReference_H_
11 #include "ModelAPI_AttributeReference.h"
12 #include <ModelAPI_Feature.h>
13 #include <TDF_Label.hxx>
14 #include <TDF_Reference.hxx>
16 /**\class Model_AttributeReference
18 * \brief Attribute that contains reference to feature (located in the same document).
21 class Model_AttributeReference : public ModelAPI_AttributeReference
23 TDF_Label myLab; ///< the main label of this attribute
24 Handle_TDF_Reference myRef; ///< references to the feature label
26 /// Defines the object referenced from this attribute
27 MODEL_EXPORT virtual void setValue(ObjectPtr theObject);
29 /// Returns object referenced from this attribute
30 MODEL_EXPORT virtual ObjectPtr value();
32 MODEL_EXPORT ~Model_AttributeReference();
34 MODEL_EXPORT virtual void setObject(const std::shared_ptr<ModelAPI_Object>& theObject);
36 /// Returns true if attribute was initialized by some value
37 MODEL_EXPORT virtual bool isInitialized();
41 /// Objects are created for features automatically
42 MODEL_EXPORT Model_AttributeReference(TDF_Label& theLabel);
43 /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc)
44 virtual void reinit();
46 friend class Model_Data;
47 friend class Model_AttributeSelection;