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/
20 // File : SALOMEDSImpl_AttributeIOR.cxx
21 // Author : Sergey RUIN
27 #include "SALOMEDSImpl_AttributeIOR.hxx"
28 #include <TCollection_AsciiString.hxx>
29 #include "SALOMEDSImpl_Study.hxx"
30 #include <Standard_GUID.hxx>
32 IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute )
33 IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute )
36 //=======================================================================
39 //=======================================================================
41 const Standard_GUID& SALOMEDSImpl_AttributeIOR::GetID ()
43 static Standard_GUID SALOMEDSImpl_AttributeIORID ("92888E01-7074-11d5-A690-0800369C8A03");
44 return SALOMEDSImpl_AttributeIORID;
49 //=======================================================================
52 //=======================================================================
54 Handle(SALOMEDSImpl_AttributeIOR) SALOMEDSImpl_AttributeIOR::Set (const TDF_Label& L,
55 const TCollection_ExtendedString& S)
57 Handle(SALOMEDSImpl_AttributeIOR) A;
58 if (!L.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),A)) {
59 A = new SALOMEDSImpl_AttributeIOR();
64 SALOMEDSImpl_Study::IORUpdated(A);
68 //=======================================================================
71 //=======================================================================
72 void SALOMEDSImpl_AttributeIOR::SetValue(const TCollection_ExtendedString& theValue)
76 Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(Label());
77 aStudy->AddCreatedPostponed(theValue);
78 aStudy->AddPostponed(theValue);
83 SALOMEDSImpl_Study::IORUpdated(this);
85 //SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
88 //=======================================================================
91 //=======================================================================
92 TCollection_ExtendedString SALOMEDSImpl_AttributeIOR::Value() const
97 //=======================================================================
98 //function : constructor
100 //=======================================================================
101 SALOMEDSImpl_AttributeIOR::SALOMEDSImpl_AttributeIOR()
102 :SALOMEDSImpl_GenericAttribute("AttributeIOR")
106 //=======================================================================
109 //=======================================================================
111 const Standard_GUID& SALOMEDSImpl_AttributeIOR::ID () const { return GetID(); }
114 //=======================================================================
115 //function : NewEmpty
117 //=======================================================================
119 Handle(TDF_Attribute) SALOMEDSImpl_AttributeIOR::NewEmpty () const
121 return new SALOMEDSImpl_AttributeIOR();
124 //=======================================================================
127 //=======================================================================
129 void SALOMEDSImpl_AttributeIOR::Restore(const Handle(TDF_Attribute)& with)
131 myString = Handle(SALOMEDSImpl_AttributeIOR)::DownCast (with)->Value();
135 //=======================================================================
138 //=======================================================================
140 void SALOMEDSImpl_AttributeIOR::Paste (const Handle(TDF_Attribute)& into,
141 const Handle(TDF_RelocationTable)& RT) const
143 Handle(SALOMEDSImpl_AttributeIOR)::DownCast (into)->SetValue(myString);