Salome HOME
Copyrights update
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_AttributeIOR.cxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/
19 //
20 //  File   : SALOMEDSImpl_AttributeIOR.cxx
21 //  Author : Sergey RUIN
22 //  Module : SALOME
23
24 #ifndef WNT
25 using namespace std;
26 #endif
27 #include "SALOMEDSImpl_AttributeIOR.hxx"
28 #include <TCollection_AsciiString.hxx>
29 #include "SALOMEDSImpl_Study.hxx"
30 #include <Standard_GUID.hxx>
31
32 IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute )
33 IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute )
34
35
36 //=======================================================================
37 //function : GetID
38 //purpose  : 
39 //=======================================================================
40
41 const Standard_GUID& SALOMEDSImpl_AttributeIOR::GetID () 
42 {
43   static Standard_GUID SALOMEDSImpl_AttributeIORID ("92888E01-7074-11d5-A690-0800369C8A03");
44   return SALOMEDSImpl_AttributeIORID;
45 }
46
47
48
49 //=======================================================================
50 //function : Set
51 //purpose  : 
52 //=======================================================================
53
54 Handle(SALOMEDSImpl_AttributeIOR) SALOMEDSImpl_AttributeIOR::Set (const TDF_Label& L,
55                                                                   const TCollection_ExtendedString& S) 
56 {
57   Handle(SALOMEDSImpl_AttributeIOR) A;
58   if (!L.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),A)) {
59     A = new  SALOMEDSImpl_AttributeIOR(); 
60     L.AddAttribute(A);
61   }
62
63   A->SetValue(S); 
64   SALOMEDSImpl_Study::IORUpdated(A);
65   return A;
66 }
67
68 //=======================================================================
69 //function : SetValue
70 //purpose  : 
71 //=======================================================================
72 void SALOMEDSImpl_AttributeIOR::SetValue(const TCollection_ExtendedString& theValue)
73 {
74   CheckLocked();
75
76   Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(Label());
77   aStudy->AddCreatedPostponed(theValue);
78   aStudy->AddPostponed(theValue);
79
80   Backup();
81   myString = theValue;
82
83   SALOMEDSImpl_Study::IORUpdated(this);
84
85   //SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved 
86 }
87
88 //=======================================================================
89 //function : Value
90 //purpose  : 
91 //=======================================================================
92 TCollection_ExtendedString SALOMEDSImpl_AttributeIOR::Value() const
93 {
94   return myString;
95 }
96
97 //=======================================================================
98 //function : constructor
99 //purpose  : 
100 //=======================================================================
101 SALOMEDSImpl_AttributeIOR::SALOMEDSImpl_AttributeIOR()
102 :SALOMEDSImpl_GenericAttribute("AttributeIOR")
103 {
104 }
105
106 //=======================================================================
107 //function : ID
108 //purpose  : 
109 //=======================================================================
110
111 const Standard_GUID& SALOMEDSImpl_AttributeIOR::ID () const { return GetID(); }
112
113
114 //=======================================================================
115 //function : NewEmpty
116 //purpose  : 
117 //=======================================================================
118
119 Handle(TDF_Attribute) SALOMEDSImpl_AttributeIOR::NewEmpty () const
120 {  
121   return new SALOMEDSImpl_AttributeIOR(); 
122 }
123
124 //=======================================================================
125 //function : Restore
126 //purpose  : 
127 //=======================================================================
128
129 void SALOMEDSImpl_AttributeIOR::Restore(const Handle(TDF_Attribute)& with) 
130 {
131   myString = Handle(SALOMEDSImpl_AttributeIOR)::DownCast (with)->Value();
132   return;
133 }
134
135 //=======================================================================
136 //function : Paste
137 //purpose  : 
138 //=======================================================================
139
140 void SALOMEDSImpl_AttributeIOR::Paste (const Handle(TDF_Attribute)& into,
141                                        const Handle(TDF_RelocationTable)& RT) const
142 {
143   Handle(SALOMEDSImpl_AttributeIOR)::DownCast (into)->SetValue(myString);
144 }
145