Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[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/ or email : webmaster.salome@opencascade.com
19 //
20 //  File   : SALOMEDSImpl_AttributeIOR.cxx
21 //  Author : Sergey RUIN
22 //  Module : SALOME
23
24 #include "SALOMEDSImpl_AttributeIOR.hxx"
25 #include <TCollection_AsciiString.hxx>
26 #include "SALOMEDSImpl_Study.hxx"
27 #include <Standard_GUID.hxx>
28
29 #ifndef WNT
30 using namespace std;
31 #endif
32
33 IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute )
34 IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute )
35
36
37 //=======================================================================
38 //function : GetID
39 //purpose  : 
40 //=======================================================================
41
42 const Standard_GUID& SALOMEDSImpl_AttributeIOR::GetID () 
43 {
44   static Standard_GUID SALOMEDSImpl_AttributeIORID ("92888E01-7074-11d5-A690-0800369C8A03");
45   return SALOMEDSImpl_AttributeIORID;
46 }
47
48
49
50 //=======================================================================
51 //function : Set
52 //purpose  : 
53 //=======================================================================
54
55 Handle(SALOMEDSImpl_AttributeIOR) SALOMEDSImpl_AttributeIOR::Set (const TDF_Label& L,
56                                                                   const TCollection_ExtendedString& S) 
57 {
58   Handle(SALOMEDSImpl_AttributeIOR) A;
59   if (!L.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),A)) {
60     A = new  SALOMEDSImpl_AttributeIOR(); 
61     L.AddAttribute(A);
62   }
63
64   A->SetValue(S); 
65   SALOMEDSImpl_Study::IORUpdated(A);
66   return A;
67 }
68
69 //=======================================================================
70 //function : SetValue
71 //purpose  : 
72 //=======================================================================
73 void SALOMEDSImpl_AttributeIOR::SetValue(const TCollection_ExtendedString& theValue)
74 {
75   CheckLocked();
76
77   Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(Label());
78   aStudy->AddCreatedPostponed(theValue);
79   aStudy->AddPostponed(theValue);
80
81   Backup();
82   myString = theValue;
83
84   SALOMEDSImpl_Study::IORUpdated(this);
85
86   //SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved 
87 }
88
89 //=======================================================================
90 //function : Value
91 //purpose  : 
92 //=======================================================================
93 TCollection_ExtendedString SALOMEDSImpl_AttributeIOR::Value() const
94 {
95   return myString;
96 }
97
98 //=======================================================================
99 //function : constructor
100 //purpose  : 
101 //=======================================================================
102 SALOMEDSImpl_AttributeIOR::SALOMEDSImpl_AttributeIOR()
103 :SALOMEDSImpl_GenericAttribute("AttributeIOR")
104 {
105 }
106
107 //=======================================================================
108 //function : ID
109 //purpose  : 
110 //=======================================================================
111
112 const Standard_GUID& SALOMEDSImpl_AttributeIOR::ID () const { return GetID(); }
113
114
115 //=======================================================================
116 //function : NewEmpty
117 //purpose  : 
118 //=======================================================================
119
120 Handle(TDF_Attribute) SALOMEDSImpl_AttributeIOR::NewEmpty () const
121 {  
122   return new SALOMEDSImpl_AttributeIOR(); 
123 }
124
125 //=======================================================================
126 //function : Restore
127 //purpose  : 
128 //=======================================================================
129
130 void SALOMEDSImpl_AttributeIOR::Restore(const Handle(TDF_Attribute)& with) 
131 {
132   myString = Handle(SALOMEDSImpl_AttributeIOR)::DownCast (with)->Value();
133   return;
134 }
135
136 //=======================================================================
137 //function : Paste
138 //purpose  : 
139 //=======================================================================
140
141 void SALOMEDSImpl_AttributeIOR::Paste (const Handle(TDF_Attribute)& into,
142                                        const Handle(TDF_RelocationTable)& RT) const
143 {
144   Handle(SALOMEDSImpl_AttributeIOR)::DownCast (into)->SetValue(myString);
145 }
146