Salome HOME
NRI : Remove dependence with VISU.
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_PersRefAttribute.cxx
1 using namespace std;
2 //  File      : SALOMEDS_PersRefAttribute.cxx
3 //  Created   : Wed Nov 28 16:23:19 2001
4 //  Author    : Yves FRICAUD
5
6 //  Project   : SALOME
7 //  Module    : SALOMEDS
8 //  Copyright : Open CASCADE 2001
9 //  $Header$
10
11 #include "SALOMEDS_PersRefAttribute.ixx"
12 #include <TDataStd_Comment.hxx>
13 #include <TCollection_ExtendedString.hxx>
14
15 //=======================================================================
16 //function : GetID
17 //purpose  : 
18 //=======================================================================
19
20 const Standard_GUID& SALOMEDS_PersRefAttribute::GetID () 
21 {
22   static Standard_GUID SALOMEDS_PersRefAttributeID ("92888E06-7074-11d5-A690-0800369C8A03");
23   return SALOMEDS_PersRefAttributeID;
24 }
25
26
27
28 //=======================================================================
29 //function : Set
30 //purpose  : 
31 //=======================================================================
32
33 Handle(SALOMEDS_PersRefAttribute) SALOMEDS_PersRefAttribute::Set (const TDF_Label& L,
34                                                           const TCollection_ExtendedString& S) 
35 {
36   Handle(SALOMEDS_PersRefAttribute) A;
37   if (!L.FindAttribute(SALOMEDS_PersRefAttribute::GetID(),A)) {
38     A = new  SALOMEDS_PersRefAttribute(); 
39     L.AddAttribute(A);
40   }
41   
42   (Handle(TDataStd_Comment)::DownCast(A))->Set (S); 
43   return A;
44 }
45
46
47 //=======================================================================
48 //function : constructor
49 //purpose  : 
50 //=======================================================================
51 SALOMEDS_PersRefAttribute::SALOMEDS_PersRefAttribute()
52 {}
53
54 //=======================================================================
55 //function : ID
56 //purpose  : 
57 //=======================================================================
58
59 const Standard_GUID& SALOMEDS_PersRefAttribute::ID () const { return GetID(); }
60
61
62 //=======================================================================
63 //function : NewEmpty
64 //purpose  : 
65 //=======================================================================
66
67 Handle(TDF_Attribute) SALOMEDS_PersRefAttribute::NewEmpty () const
68 {  
69   return new SALOMEDS_PersRefAttribute(); 
70 }
71
72 //=======================================================================
73 //function : Restore
74 //purpose  : 
75 //=======================================================================
76
77 void SALOMEDS_PersRefAttribute::Restore(const Handle(TDF_Attribute)& with) 
78 {
79   TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get ();
80   TDataStd_Comment::Set(s);
81   return;
82 }
83
84 //=======================================================================
85 //function : Paste
86 //purpose  : 
87 //=======================================================================
88
89 void SALOMEDS_PersRefAttribute::Paste (const Handle(TDF_Attribute)& into,
90                            const Handle(TDF_RelocationTable)& RT) const
91 {
92   Handle(TDataStd_Comment)::DownCast (into)->Set (Get());
93 }
94