1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: Model_AttributeRefAttr.h
5 // Author: Mikhail PONIKAROV
7 #ifndef Model_AttributeRefAttr_H_
8 #define Model_AttributeRefAttr_H_
11 #include "ModelAPI_AttributeRefAttr.h"
12 #include <TDF_Label.hxx>
13 #include <TDF_Reference.hxx>
14 #include <TDataStd_Comment.hxx>
16 /**\class Model_AttributeRefAttr
18 * \brief Attribute that contains reference to an attribute of a feature
19 * (located in the same document).
22 class Model_AttributeRefAttr : public ModelAPI_AttributeRefAttr
24 Handle_TDF_Reference myRef; ///< reference to the feature label
25 TDF_Label myLab; ///< the main label of this attribute
26 ///< ID of the referenced attribute (empty if this is a reference to a feature)
27 Handle_TDataStd_Comment myID;
29 /// Returns true if this attribute references to a object (not to the attribute)
30 MODEL_EXPORT virtual bool isObject();
32 /// Defines the reference to the attribute
33 MODEL_EXPORT virtual void setAttr(std::shared_ptr<ModelAPI_Attribute> theAttr);
35 /// Returns attribute referenced from this attribute
36 MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Attribute> attr();
38 /// Defines the reference to the object
39 MODEL_EXPORT virtual void setObject(ObjectPtr theFeature);
41 /// Returns object referenced from this attribute
42 MODEL_EXPORT virtual ObjectPtr object();
44 /// Returns true if attribute was initialized by some value
45 MODEL_EXPORT virtual bool isInitialized();
48 /// Objects are created for features automatically
49 MODEL_EXPORT Model_AttributeRefAttr(TDF_Label& theLabel);
50 /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc)
51 virtual void reinit();
53 friend class Model_Data;