2 // File : SALOMEDS_PersRefAttribute.cxx
3 // Created : Wed Nov 28 16:23:19 2001
4 // Author : Yves FRICAUD
8 // Copyright : Open CASCADE 2001
11 #include "SALOMEDS_PersRefAttribute.ixx"
12 #include <TDataStd_Comment.hxx>
13 #include <TCollection_ExtendedString.hxx>
15 //=======================================================================
18 //=======================================================================
20 const Standard_GUID& SALOMEDS_PersRefAttribute::GetID ()
22 static Standard_GUID SALOMEDS_PersRefAttributeID ("92888E06-7074-11d5-A690-0800369C8A03");
23 return SALOMEDS_PersRefAttributeID;
28 //=======================================================================
31 //=======================================================================
33 Handle(SALOMEDS_PersRefAttribute) SALOMEDS_PersRefAttribute::Set (const TDF_Label& L,
34 const TCollection_ExtendedString& S)
36 Handle(SALOMEDS_PersRefAttribute) A;
37 if (!L.FindAttribute(SALOMEDS_PersRefAttribute::GetID(),A)) {
38 A = new SALOMEDS_PersRefAttribute();
42 (Handle(TDataStd_Comment)::DownCast(A))->Set (S);
47 //=======================================================================
48 //function : constructor
50 //=======================================================================
51 SALOMEDS_PersRefAttribute::SALOMEDS_PersRefAttribute()
54 //=======================================================================
57 //=======================================================================
59 const Standard_GUID& SALOMEDS_PersRefAttribute::ID () const { return GetID(); }
62 //=======================================================================
65 //=======================================================================
67 Handle(TDF_Attribute) SALOMEDS_PersRefAttribute::NewEmpty () const
69 return new SALOMEDS_PersRefAttribute();
72 //=======================================================================
75 //=======================================================================
77 void SALOMEDS_PersRefAttribute::Restore(const Handle(TDF_Attribute)& with)
79 TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get ();
80 TDataStd_Comment::Set(s);
84 //=======================================================================
87 //=======================================================================
89 void SALOMEDS_PersRefAttribute::Paste (const Handle(TDF_Attribute)& into,
90 const Handle(TDF_RelocationTable)& RT) const
92 Handle(TDataStd_Comment)::DownCast (into)->Set (Get());