Salome HOME
f64099472953f3f4b7abd49140764ab220957a01
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_AttributeExternalFileDef.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_AttributeExternalFileDef.cxx
21 //  Author : Sergey RUIN
22 //  Module : SALOME
23
24 #include "SALOMEDSImpl_AttributeExternalFileDef.hxx"
25
26 using namespace std;
27
28 IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeExternalFileDef, SALOMEDSImpl_GenericAttribute )
29 IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeExternalFileDef, SALOMEDSImpl_GenericAttribute )
30
31 //=======================================================================
32 //function : GetID
33 //purpose  : 
34 //=======================================================================
35 const Standard_GUID& SALOMEDSImpl_AttributeExternalFileDef::GetID () 
36 {
37   static Standard_GUID SALOMEDSImpl_AttributeExternalFileDefID ("7123AD4C-ACDB-4e3a-8FDC-70EA164D2CBE");
38   return SALOMEDSImpl_AttributeExternalFileDefID;
39 }
40
41 //=======================================================================
42 //function : Set
43 //purpose  : 
44 //=======================================================================
45 Handle(SALOMEDSImpl_AttributeExternalFileDef) 
46 SALOMEDSImpl_AttributeExternalFileDef::Set (const TDF_Label& L, const TCollection_ExtendedString& S) 
47 {
48
49   Handle(SALOMEDSImpl_AttributeExternalFileDef) A;
50   if (!L.FindAttribute(SALOMEDSImpl_AttributeExternalFileDef::GetID(),A)) {
51     A = new  SALOMEDSImpl_AttributeExternalFileDef(); 
52     L.AddAttribute(A);
53   }
54   
55   A->SetValue (S); 
56   return A;
57 }
58
59
60 //=======================================================================
61 //function : constructor
62 //purpose  : 
63 //=======================================================================
64 SALOMEDSImpl_AttributeExternalFileDef::SALOMEDSImpl_AttributeExternalFileDef()
65 :SALOMEDSImpl_GenericAttribute("AttributeExternalFileDef")
66 {
67 }
68
69 //=======================================================================
70 //function : SetValue
71 //purpose  :
72 //=======================================================================
73 void SALOMEDSImpl_AttributeExternalFileDef::SetValue (const TCollection_ExtendedString& S)
74 {
75   CheckLocked();
76
77   if(myString == S) return;
78
79   Backup();
80
81   myString = S;
82
83   SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved 
84 }
85            
86
87
88 //=======================================================================
89 //function : ID
90 //purpose  : 
91 //=======================================================================
92 const Standard_GUID& SALOMEDSImpl_AttributeExternalFileDef::ID () const { return GetID(); }
93
94
95 //=======================================================================
96 //function : NewEmpty
97 //purpose  : 
98 //=======================================================================
99 Handle(TDF_Attribute) SALOMEDSImpl_AttributeExternalFileDef::NewEmpty () const
100 {  
101   return new SALOMEDSImpl_AttributeExternalFileDef(); 
102 }
103
104 //=======================================================================
105 //function : Restore
106 //purpose  : 
107 //=======================================================================
108 void SALOMEDSImpl_AttributeExternalFileDef::Restore(const Handle(TDF_Attribute)& with) 
109 {
110   myString = Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast (with)->Value ();
111 }
112
113 //=======================================================================
114 //function : Paste
115 //purpose  : 
116 //=======================================================================
117 void SALOMEDSImpl_AttributeExternalFileDef::Paste (const Handle(TDF_Attribute)& into,
118                                                    const Handle(TDF_RelocationTable)& RT) const
119 {
120   Handle(SALOMEDSImpl_AttributeExternalFileDef) anAttr = Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(into); 
121   anAttr->SetValue(myString);
122 }
123