1 // SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SALOMEDS_IORAttribute.cxx
25 // Author : Yves FRICAUD
29 #include <TDataStd_Comment.hxx>
30 #include <TCollection_ExtendedString.hxx>
32 #include "SALOMEDS_IORAttribute.ixx"
33 #include "SALOMEDS_Study_i.hxx"
37 //=======================================================================
40 //=======================================================================
42 const Standard_GUID& SALOMEDS_IORAttribute::GetID ()
44 static Standard_GUID SALOMEDS_IORAttributeID ("92888E01-7074-11d5-A690-0800369C8A03");
45 return SALOMEDS_IORAttributeID;
50 //=======================================================================
53 //=======================================================================
55 Handle(SALOMEDS_IORAttribute) SALOMEDS_IORAttribute::Set (const TDF_Label& L,
56 const TCollection_ExtendedString& S,
57 SALOMEDS_Study_i* theStudy)
59 Handle(SALOMEDS_IORAttribute) A;
60 if (!L.FindAttribute(SALOMEDS_IORAttribute::GetID(),A)) {
61 A = new SALOMEDS_IORAttribute();
65 (Handle(TDataStd_Comment)::DownCast(A))->Set (S);
66 theStudy->IORUpdated(A);
70 //=======================================================================
71 //function : constructor
73 //=======================================================================
74 SALOMEDS_IORAttribute::SALOMEDS_IORAttribute()
77 //=======================================================================
80 //=======================================================================
82 const Standard_GUID& SALOMEDS_IORAttribute::ID () const { return GetID(); }
85 //=======================================================================
88 //=======================================================================
90 Handle(TDF_Attribute) SALOMEDS_IORAttribute::NewEmpty () const
92 return new SALOMEDS_IORAttribute();
95 //=======================================================================
98 //=======================================================================
100 void SALOMEDS_IORAttribute::Restore(const Handle(TDF_Attribute)& with)
102 TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get ();
103 TDataStd_Comment::Set(s);
107 //=======================================================================
110 //=======================================================================
112 void SALOMEDS_IORAttribute::Paste (const Handle(TDF_Attribute)& into,
113 const Handle(TDF_RelocationTable)& RT) const
115 Handle(TDataStd_Comment)::DownCast (into)->Set (Get());