1 // File: MXCAFDoc_DatumStorageDriver.cxx
2 // Created: 10.12.08 09:06:26
3 // Author: Pavel TELKOV
4 // Copyright: Open CASCADE 2008
6 #include <MXCAFDoc_DatumStorageDriver.ixx>
7 #include <XCAFDoc_Datum.hxx>
8 #include <PXCAFDoc_Datum.hxx>
10 #include <TCollection_HAsciiString.hxx>
11 #include <PCollection_HAsciiString.hxx>
13 //=======================================================================
14 //function : MXCAFDoc_DatumStorageDriver
16 //=======================================================================
18 MXCAFDoc_DatumStorageDriver::MXCAFDoc_DatumStorageDriver
19 (const Handle(CDM_MessageDriver)& theMsgDriver) : MDF_ASDriver (theMsgDriver)
22 //=======================================================================
23 //function : VersionNumber
25 //=======================================================================
27 Standard_Integer MXCAFDoc_DatumStorageDriver::VersionNumber() const
30 //=======================================================================
31 //function : SourceType
33 //=======================================================================
35 Handle(Standard_Type) MXCAFDoc_DatumStorageDriver::SourceType() const
37 static Handle(Standard_Type) sourceType = STANDARD_TYPE(XCAFDoc_Datum);
41 //=======================================================================
44 //=======================================================================
46 Handle(PDF_Attribute) MXCAFDoc_DatumStorageDriver::NewEmpty() const
48 return new PXCAFDoc_Datum();
51 //=======================================================================
54 //=======================================================================
56 void MXCAFDoc_DatumStorageDriver::Paste(const Handle(TDF_Attribute)& Source,
57 const Handle(PDF_Attribute)& Target,
58 const Handle(MDF_SRelocationTable)& RelocTable) const
60 Handle(XCAFDoc_Datum) S = Handle(XCAFDoc_Datum)::DownCast (Source);
61 Handle(PXCAFDoc_Datum) T = Handle(PXCAFDoc_Datum)::DownCast (Target);
62 Handle(TCollection_HAsciiString) aNameStr = S->GetName();
63 Handle(TCollection_HAsciiString) aDescrStr = S->GetDescription();
64 Handle(TCollection_HAsciiString) anIdStr = S->GetIdentification();
66 Handle(PCollection_HAsciiString) aName, aDescr, anId;
67 if ( !aNameStr.IsNull() )
68 aName = new PCollection_HAsciiString (aNameStr->String());
69 if ( !aDescrStr.IsNull() )
70 aDescr = new PCollection_HAsciiString (aDescrStr->String());
71 if ( !anIdStr.IsNull() )
72 anId = new PCollection_HAsciiString (anIdStr->String());
74 T->Set(aName, aDescr, anId);