1 // File : SALOMEDSImpl_AttributeReference.cxx
2 // Author : Sergey RUIN
5 #include "SALOMEDSImpl_AttributeReference.hxx"
6 #include <TDF_Tool.hxx>
7 #include <TDF_Data.hxx>
8 #include <TDF_RelocationTable.hxx>
12 IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeReference, SALOMEDSImpl_GenericAttribute )
13 IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeReference, SALOMEDSImpl_GenericAttribute )
16 //=======================================================================
19 //=======================================================================
20 const Standard_GUID& SALOMEDSImpl_AttributeReference::GetID ()
22 static Standard_GUID refID ("D913E0B3-0A9F-4ea6-9480-18A9B72D9D86");
26 Handle(SALOMEDSImpl_AttributeReference) SALOMEDSImpl_AttributeReference::Set(const TDF_Label& theLabel,
27 const TDF_Label& theRefLabel)
29 Handle(SALOMEDSImpl_AttributeReference) A;
30 if (!theLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), A)) {
31 A = new SALOMEDSImpl_AttributeReference();
32 theLabel.AddAttribute(A);
39 //=======================================================================
42 //=======================================================================
43 void SALOMEDSImpl_AttributeReference::Set(const TDF_Label& Origin)
47 if(myLabel == Origin) return;
52 SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
55 //=======================================================================
58 //=======================================================================
59 const Standard_GUID& SALOMEDSImpl_AttributeReference::ID () const { return GetID(); }
62 TCollection_AsciiString SALOMEDSImpl_AttributeReference::Save()
64 TCollection_AsciiString anEntry;
65 TDF_Tool::Entry(myLabel, anEntry);
69 void SALOMEDSImpl_AttributeReference::Load(const TCollection_AsciiString& value)
72 TDF_Tool::Label(Label().Data(), value, aLabel);
76 //=======================================================================
79 //=======================================================================
80 Handle(TDF_Attribute) SALOMEDSImpl_AttributeReference::NewEmpty () const
82 return new SALOMEDSImpl_AttributeReference();
85 //=======================================================================
88 //=======================================================================
90 void SALOMEDSImpl_AttributeReference::Restore(const Handle(TDF_Attribute)& With)
92 myLabel = Handle(SALOMEDSImpl_AttributeReference)::DownCast (With)->Get ();
95 //=======================================================================
98 //=======================================================================
100 void SALOMEDSImpl_AttributeReference::Paste (const Handle(TDF_Attribute)& Into,
101 const Handle(TDF_RelocationTable)& RT) const
104 if (!myLabel.IsNull()) {
105 if (!RT->HasRelocation(myLabel,tLab)) tLab = myLabel;
107 Handle(SALOMEDSImpl_AttributeReference)::DownCast(Into)->Set(tLab);