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