0024927: Getting rid of "Persistent" functionality -- Code
[occt.git] / src / MXCAFDoc / MXCAFDoc_DatumRetrievalDriver.cxx
1 // Created on: 2008-12-10
2 // Created by: Pavel TELKOV
3 // Copyright (c) 2008-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #include <MXCAFDoc_DatumRetrievalDriver.ixx>
17 #include <PXCAFDoc_Datum.hxx>
18 #include <XCAFDoc_Datum.hxx>
19
20 #include <TCollection_HAsciiString.hxx>
21 #include <PCollection_HAsciiString.hxx>
22
23
24 //=======================================================================
25 //function : MCAFDoc_DatumRetrievalDriver
26 //purpose  : 
27 //=======================================================================
28
29 MXCAFDoc_DatumRetrievalDriver::MXCAFDoc_DatumRetrievalDriver
30   (const Handle(CDM_MessageDriver)& theMsgDriver) : MDF_ARDriver (theMsgDriver)
31 {}
32
33 //=======================================================================
34 //function : VersionNumber
35 //purpose  : 
36 //=======================================================================
37
38 Standard_Integer MXCAFDoc_DatumRetrievalDriver::VersionNumber() const
39 { return 0; }
40
41 //=======================================================================
42 //function : SourceType
43 //purpose  : 
44 //=======================================================================
45
46 Handle(Standard_Type) MXCAFDoc_DatumRetrievalDriver::SourceType() const
47 {
48   static Handle(Standard_Type) sourceType = STANDARD_TYPE(PXCAFDoc_Datum);
49   return sourceType;
50 }
51
52 //=======================================================================
53 //function : NewEmpty
54 //purpose  : 
55 //=======================================================================
56
57 Handle(TDF_Attribute) MXCAFDoc_DatumRetrievalDriver::NewEmpty() const
58 {
59   return new XCAFDoc_Datum();
60 }
61
62 //=======================================================================
63 //function : Paste
64 //purpose  : 
65 //=======================================================================
66
67 void MXCAFDoc_DatumRetrievalDriver::Paste(const Handle(PDF_Attribute)& Source,
68                                            const Handle(TDF_Attribute)& Target,
69                                            const Handle(MDF_RRelocationTable)& /*RelocTable*/) const
70 {
71   Handle(PXCAFDoc_Datum) S = Handle(PXCAFDoc_Datum)::DownCast (Source);
72   Handle(XCAFDoc_Datum) T = Handle(XCAFDoc_Datum)::DownCast (Target);
73   
74   Handle(TCollection_HAsciiString) aName, aDescr, anId;
75   if ( !S->GetName().IsNull() )
76     aName = new TCollection_HAsciiString( (S->GetName())->Convert() );
77   if ( !S->GetDescription().IsNull() )
78     aDescr = new TCollection_HAsciiString( (S->GetDescription())->Convert() );
79   if ( !S->GetIdentification().IsNull() )
80     anId = new TCollection_HAsciiString( (S->GetIdentification())->Convert() );
81
82   T->Set(aName, aDescr, anId);
83 }