Salome HOME
Optimized method GetSObject
[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 //=======================================================================
29 //function : GetID
30 //purpose  : 
31 //=======================================================================
32 const std::string& SALOMEDSImpl_AttributeExternalFileDef::GetID () 
33 {
34   static std::string SALOMEDSImpl_AttributeExternalFileDefID ("7123AD4C-ACDB-4e3a-8FDC-70EA164D2CBE");
35   return SALOMEDSImpl_AttributeExternalFileDefID;
36 }
37
38 //=======================================================================
39 //function : Set
40 //purpose  : 
41 //=======================================================================
42 SALOMEDSImpl_AttributeExternalFileDef*
43 SALOMEDSImpl_AttributeExternalFileDef::Set (const DF_Label& L, const std::string& S) 
44 {
45
46   SALOMEDSImpl_AttributeExternalFileDef* A = NULL;
47   if (!(A=(SALOMEDSImpl_AttributeExternalFileDef*)L.FindAttribute(SALOMEDSImpl_AttributeExternalFileDef::GetID()))) {
48     A = new  SALOMEDSImpl_AttributeExternalFileDef(); 
49     L.AddAttribute(A);
50   }
51   
52   A->SetValue (S); 
53   return A;
54 }
55
56
57 //=======================================================================
58 //function : constructor
59 //purpose  : 
60 //=======================================================================
61 SALOMEDSImpl_AttributeExternalFileDef::SALOMEDSImpl_AttributeExternalFileDef()
62 :SALOMEDSImpl_GenericAttribute("AttributeExternalFileDef")
63 {
64 }
65
66 //=======================================================================
67 //function : SetValue
68 //purpose  :
69 //=======================================================================
70 void SALOMEDSImpl_AttributeExternalFileDef::SetValue (const std::string& S)
71 {
72   CheckLocked();
73
74   if(myString == S) return;
75
76   Backup();
77
78   myString = S;
79
80   SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved 
81 }
82            
83
84
85 //=======================================================================
86 //function : ID
87 //purpose  : 
88 //=======================================================================
89 const std::string& SALOMEDSImpl_AttributeExternalFileDef::ID () const { return GetID(); }
90
91
92 //=======================================================================
93 //function : NewEmpty
94 //purpose  : 
95 //=======================================================================
96 DF_Attribute* SALOMEDSImpl_AttributeExternalFileDef::NewEmpty () const
97 {  
98   return new SALOMEDSImpl_AttributeExternalFileDef(); 
99 }
100
101 //=======================================================================
102 //function : Restore
103 //purpose  : 
104 //=======================================================================
105 void SALOMEDSImpl_AttributeExternalFileDef::Restore(DF_Attribute* with) 
106 {
107   myString = dynamic_cast<SALOMEDSImpl_AttributeExternalFileDef*>(with)->Value ();
108 }
109
110 //=======================================================================
111 //function : Paste
112 //purpose  : 
113 //=======================================================================
114 void SALOMEDSImpl_AttributeExternalFileDef::Paste (DF_Attribute* into)
115 {
116   SALOMEDSImpl_AttributeExternalFileDef* anAttr = dynamic_cast<SALOMEDSImpl_AttributeExternalFileDef*>(into); 
117   anAttr->SetValue(myString);
118 }
119