1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : SALOMEDSImpl_AttributeReference.cxx
21 // Author : Sergey RUIN
24 #include "SALOMEDSImpl_AttributeReference.hxx"
28 //=======================================================================
31 //=======================================================================
32 const std::string& SALOMEDSImpl_AttributeReference::GetID ()
34 static std::string refID ("D913E0B3-0A9F-4ea6-9480-18A9B72D9D86");
38 SALOMEDSImpl_AttributeReference* SALOMEDSImpl_AttributeReference::Set(const DF_Label& theLabel,
39 const DF_Label& theRefLabel)
41 SALOMEDSImpl_AttributeReference* A = NULL;
42 if (!(A=(SALOMEDSImpl_AttributeReference*)theLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
43 A = new SALOMEDSImpl_AttributeReference();
44 theLabel.AddAttribute(A);
51 //=======================================================================
54 //=======================================================================
55 void SALOMEDSImpl_AttributeReference::Set(const DF_Label& Origin)
59 if(myLabel == Origin) return;
64 SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
67 //=======================================================================
70 //=======================================================================
71 const std::string& SALOMEDSImpl_AttributeReference::ID () const { return GetID(); }
74 string SALOMEDSImpl_AttributeReference::Save()
76 return myLabel.Entry();
79 void SALOMEDSImpl_AttributeReference::Load(const string& value)
81 myLabel = DF_Label::Label(Label(), value, true);
84 //=======================================================================
87 //=======================================================================
88 DF_Attribute* SALOMEDSImpl_AttributeReference::NewEmpty () const
90 return new SALOMEDSImpl_AttributeReference();
93 //=======================================================================
96 //=======================================================================
98 void SALOMEDSImpl_AttributeReference::Restore(DF_Attribute* With)
100 myLabel = dynamic_cast<SALOMEDSImpl_AttributeReference*>(With)->Get ();
103 //=======================================================================
106 //=======================================================================
108 void SALOMEDSImpl_AttributeReference::Paste (DF_Attribute* Into)
110 dynamic_cast<SALOMEDSImpl_AttributeReference*>(Into)->Set(myLabel);