Salome HOME
Removed includes and libraries of OCC
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_AttributeReference.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_AttributeReference.cxx
21 //  Author : Sergey RUIN
22 //  Module : SALOME
23
24 #include "SALOMEDSImpl_AttributeReference.hxx"
25
26 using namespace std;
27
28 //=======================================================================
29 //function : GetID
30 //purpose  :
31 //=======================================================================
32 const std::string& SALOMEDSImpl_AttributeReference::GetID ()
33 {
34   static std::string refID ("D913E0B3-0A9F-4ea6-9480-18A9B72D9D86");
35   return refID;
36
37
38 SALOMEDSImpl_AttributeReference* SALOMEDSImpl_AttributeReference::Set(const DF_Label& theLabel, 
39                                                                       const DF_Label& theRefLabel)
40 {
41   SALOMEDSImpl_AttributeReference* A = NULL;
42   if (!(A=(SALOMEDSImpl_AttributeReference*)theLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
43     A = new  SALOMEDSImpl_AttributeReference(); 
44     theLabel.AddAttribute(A);
45   }
46
47   A->Set(theRefLabel);  
48   return A;  
49 }
50
51 //=======================================================================
52 //function : Set
53 //purpose  :
54 //=======================================================================
55 void SALOMEDSImpl_AttributeReference::Set(const DF_Label& Origin)
56 {
57   CheckLocked();
58
59   if(myLabel == Origin) return;
60
61   Backup();
62   myLabel = Origin;
63
64   SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved 
65 }  
66
67 //=======================================================================
68 //function : ID
69 //purpose  :
70 //=======================================================================
71 const std::string& SALOMEDSImpl_AttributeReference::ID () const { return GetID(); } 
72
73
74 string SALOMEDSImpl_AttributeReference::Save() 
75 {
76   return myLabel.Entry();
77 }
78
79 void SALOMEDSImpl_AttributeReference::Load(const string& value) 
80 {
81   myLabel = DF_Label::Label(Label(), value, true);
82 }
83
84 //=======================================================================
85 //function : NewEmpty
86 //purpose  : 
87 //=======================================================================
88 DF_Attribute* SALOMEDSImpl_AttributeReference::NewEmpty () const
89 {  
90   return new SALOMEDSImpl_AttributeReference(); 
91 }
92
93 //=======================================================================
94 //function : Restore
95 //purpose  :
96 //=======================================================================
97
98 void SALOMEDSImpl_AttributeReference::Restore(DF_Attribute* With)
99 {
100   myLabel = dynamic_cast<SALOMEDSImpl_AttributeReference*>(With)->Get ();
101 }
102
103 //=======================================================================
104 //function : Paste
105 //purpose  :
106 //=======================================================================
107
108 void SALOMEDSImpl_AttributeReference::Paste (DF_Attribute* Into)
109 {
110   dynamic_cast<SALOMEDSImpl_AttributeReference*>(Into)->Set(myLabel);
111