Salome HOME
This commit was generated by cvs2git to create tag 'V1_4_0b2'.
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_FileType.cxx
1 //  SALOME SALOMEDS : data structure of SALOME and sources of Salome data server 
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SALOMEDS_FileType.cxx
25 //  Author : Yves FRICAUD
26 //  Module : SALOME
27 //  $Header: 
28
29 #include "SALOMEDS_FileType.ixx"
30 #include <TDataStd_Comment.hxx>
31 #include <TCollection_ExtendedString.hxx>
32 using namespace std;
33
34 //=======================================================================
35 //function : GetID
36 //purpose  : 
37 //=======================================================================
38
39 const Standard_GUID& SALOMEDS_FileType::GetID () 
40 {
41   static Standard_GUID SALOMEDS_FileTypeID ("0181B525-3F15-4ab2-9DE3-5E2F54B5F340");
42   return SALOMEDS_FileTypeID;
43 }
44
45
46
47 //=======================================================================
48 //function : Set
49 //purpose  : 
50 //=======================================================================
51
52 Handle(SALOMEDS_FileType) SALOMEDS_FileType::Set (const TDF_Label& L,
53                                                                 const TCollection_ExtendedString& S) 
54 {
55
56   Handle(SALOMEDS_FileType) A;
57   if (!L.FindAttribute(SALOMEDS_FileType::GetID(),A)) {
58     A = new  SALOMEDS_FileType(); 
59     L.AddAttribute(A);
60   }
61   
62   (Handle(TDataStd_Comment)::DownCast(A))->Set (S); 
63   return A;
64 }
65
66
67 //=======================================================================
68 //function : constructor
69 //purpose  : 
70 //=======================================================================
71 SALOMEDS_FileType::SALOMEDS_FileType()
72 {}
73
74 //=======================================================================
75 //function : ID
76 //purpose  : 
77 //=======================================================================
78
79 const Standard_GUID& SALOMEDS_FileType::ID () const { return GetID(); }
80
81
82 //=======================================================================
83 //function : NewEmpty
84 //purpose  : 
85 //=======================================================================
86
87 Handle(TDF_Attribute) SALOMEDS_FileType::NewEmpty () const
88 {  
89   return new SALOMEDS_FileType(); 
90 }
91
92 //=======================================================================
93 //function : Restore
94 //purpose  : 
95 //=======================================================================
96
97 void SALOMEDS_FileType::Restore(const Handle(TDF_Attribute)& with) 
98 {
99   TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get ();
100   TDataStd_Comment::Set(s);
101   return;
102 }
103
104 //=======================================================================
105 //function : Paste
106 //purpose  : 
107 //=======================================================================
108
109 void SALOMEDS_FileType::Paste (const Handle(TDF_Attribute)& into,
110                            const Handle(TDF_RelocationTable)& RT) const
111 {
112   Handle(TDataStd_Comment)::DownCast (into)->Set (Get());
113 }
114