Integration of OCCT 6.5.0 from SVN
[occt.git] / src / MXCAFDoc / MXCAFDoc_DatumStorageDriver.cxx
1 // File:      MXCAFDoc_DatumStorageDriver.cxx
2 // Created:   10.12.08 09:06:26
3 // Author:    Pavel TELKOV
4 // Copyright: Open CASCADE 2008
5
6 #include <MXCAFDoc_DatumStorageDriver.ixx>
7 #include <XCAFDoc_Datum.hxx>
8 #include <PXCAFDoc_Datum.hxx>
9
10 #include <TCollection_HAsciiString.hxx>
11 #include <PCollection_HAsciiString.hxx>
12
13 //=======================================================================
14 //function : MXCAFDoc_DatumStorageDriver
15 //purpose  : 
16 //=======================================================================
17
18 MXCAFDoc_DatumStorageDriver::MXCAFDoc_DatumStorageDriver
19   (const Handle(CDM_MessageDriver)& theMsgDriver) : MDF_ASDriver (theMsgDriver)
20 {}
21
22 //=======================================================================
23 //function : VersionNumber
24 //purpose  : 
25 //=======================================================================
26
27 Standard_Integer MXCAFDoc_DatumStorageDriver::VersionNumber() const
28 { return 0; }
29
30 //=======================================================================
31 //function : SourceType
32 //purpose  : 
33 //=======================================================================
34
35 Handle(Standard_Type) MXCAFDoc_DatumStorageDriver::SourceType() const
36 {
37   static Handle(Standard_Type) sourceType = STANDARD_TYPE(XCAFDoc_Datum);
38   return sourceType;
39 }
40
41 //=======================================================================
42 //function : NewEmpty
43 //purpose  : 
44 //=======================================================================
45
46 Handle(PDF_Attribute) MXCAFDoc_DatumStorageDriver::NewEmpty() const
47 {
48   return new PXCAFDoc_Datum();
49 }
50
51 //=======================================================================
52 //function : Paste
53 //purpose  : 
54 //=======================================================================
55
56 void MXCAFDoc_DatumStorageDriver::Paste(const Handle(TDF_Attribute)& Source,
57                                          const Handle(PDF_Attribute)& Target,
58                                          const Handle(MDF_SRelocationTable)& RelocTable) const
59 {
60   Handle(XCAFDoc_Datum) S = Handle(XCAFDoc_Datum)::DownCast (Source);
61   Handle(PXCAFDoc_Datum) T = Handle(PXCAFDoc_Datum)::DownCast (Target);
62 #ifdef DEB
63   PTColStd_TransientPersistentMap& TPMap = 
64 #endif
65     RelocTable->OtherTable();
66   Handle(TCollection_HAsciiString) aNameStr = S->GetName();
67   Handle(TCollection_HAsciiString) aDescrStr = S->GetDescription();
68   Handle(TCollection_HAsciiString) anIdStr = S->GetIdentification();
69   
70   Handle(PCollection_HAsciiString) aName, aDescr, anId;
71   if ( !aNameStr.IsNull() )
72     aName = new PCollection_HAsciiString (aNameStr->String());
73   if ( !aDescrStr.IsNull() )
74     aDescr = new PCollection_HAsciiString (aDescrStr->String());
75   if ( !anIdStr.IsNull() )
76     anId = new PCollection_HAsciiString (anIdStr->String());
77
78   T->Set(aName, aDescr, anId);
79 }