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_AttributeIOR.cxx
21 // Author : Sergey RUIN
24 #include "SALOMEDSImpl_AttributeIOR.hxx"
25 #include <TCollection_AsciiString.hxx>
26 #include "SALOMEDSImpl_Study.hxx"
27 #include <Standard_GUID.hxx>
33 IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute )
34 IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute )
37 //=======================================================================
40 //=======================================================================
42 const Standard_GUID& SALOMEDSImpl_AttributeIOR::GetID ()
44 static Standard_GUID SALOMEDSImpl_AttributeIORID ("92888E01-7074-11d5-A690-0800369C8A03");
45 return SALOMEDSImpl_AttributeIORID;
50 //=======================================================================
53 //=======================================================================
55 Handle(SALOMEDSImpl_AttributeIOR) SALOMEDSImpl_AttributeIOR::Set (const TDF_Label& L,
56 const TCollection_ExtendedString& S)
58 Handle(SALOMEDSImpl_AttributeIOR) A;
59 if (!L.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),A)) {
60 A = new SALOMEDSImpl_AttributeIOR();
65 SALOMEDSImpl_Study::IORUpdated(A);
69 //=======================================================================
72 //=======================================================================
73 void SALOMEDSImpl_AttributeIOR::SetValue(const TCollection_ExtendedString& theValue)
77 Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(Label());
78 aStudy->AddCreatedPostponed(theValue);
79 aStudy->AddPostponed(theValue);
84 SALOMEDSImpl_Study::IORUpdated(this);
86 //SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
89 //=======================================================================
92 //=======================================================================
93 TCollection_ExtendedString SALOMEDSImpl_AttributeIOR::Value() const
98 //=======================================================================
99 //function : constructor
101 //=======================================================================
102 SALOMEDSImpl_AttributeIOR::SALOMEDSImpl_AttributeIOR()
103 :SALOMEDSImpl_GenericAttribute("AttributeIOR")
107 //=======================================================================
110 //=======================================================================
112 const Standard_GUID& SALOMEDSImpl_AttributeIOR::ID () const { return GetID(); }
115 //=======================================================================
116 //function : NewEmpty
118 //=======================================================================
120 Handle(TDF_Attribute) SALOMEDSImpl_AttributeIOR::NewEmpty () const
122 return new SALOMEDSImpl_AttributeIOR();
125 //=======================================================================
128 //=======================================================================
130 void SALOMEDSImpl_AttributeIOR::Restore(const Handle(TDF_Attribute)& with)
132 myString = Handle(SALOMEDSImpl_AttributeIOR)::DownCast (with)->Value();
136 //=======================================================================
139 //=======================================================================
141 void SALOMEDSImpl_AttributeIOR::Paste (const Handle(TDF_Attribute)& into,
142 const Handle(TDF_RelocationTable)& RT) const
144 Handle(SALOMEDSImpl_AttributeIOR)::DownCast (into)->SetValue(myString);