Salome HOME
Update the internal persistence mechanism of documents identification: on load/save...
[modules/shaper.git] / src / Model / Model_AttributeDocRef.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        Model_AttributeDocRef.h
4 // Created:     2 Apr 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef Model_AttributeDocRef_H_
8 #define Model_AttributeDocRef_H_
9
10 #include "Model.h"
11 #include "ModelAPI_AttributeDocRef.h"
12 #include <TDataStd_Integer.hxx>
13 #include <TDF_Label.hxx>
14
15 /**\class Model_AttributeDocRef
16  * \ingroup DataModel
17  * \brief Attribute that contains reference to another document.
18  */
19
20 class Model_AttributeDocRef : public ModelAPI_AttributeDocRef
21 {
22   Handle(TDataStd_Integer) myID; ///< persistent and unique identifier of the document in the application
23  public:
24
25   /// Defines the document referenced from this attribute
26   MODEL_EXPORT virtual void setValue(std::shared_ptr<ModelAPI_Document> theDoc);
27
28   /// Returns document referenced from this attribute
29   MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> value();
30
31   /// Returns the persisten ID of the document
32   MODEL_EXPORT virtual int docId();
33
34  protected:
35   /// Initializes attibutes
36   Model_AttributeDocRef(TDF_Label& theLabel);
37
38   friend class Model_Data;
39 };
40
41 #endif