1 // Created on: 2008-12-10
2 // Created by: Pavel TELKOV
3 // Copyright (c) 2008-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
21 #include <BinMXCAFDoc_DatumDriver.ixx>
22 #include <XCAFDoc_Datum.hxx>
24 #include <TCollection_HAsciiString.hxx>
25 #include <TColStd_Array1OfReal.hxx>
26 #include <TColStd_HArray1OfReal.hxx>
28 //=======================================================================
29 //function : Constructor
31 //=======================================================================
32 BinMXCAFDoc_DatumDriver::BinMXCAFDoc_DatumDriver
33 (const Handle(CDM_MessageDriver)& theMsgDriver)
34 : BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_Datum)->Name())
38 //=======================================================================
41 //=======================================================================
42 Handle(TDF_Attribute) BinMXCAFDoc_DatumDriver::NewEmpty() const
44 return new XCAFDoc_Datum();
47 //=======================================================================
50 //=======================================================================
51 Standard_Boolean BinMXCAFDoc_DatumDriver::Paste(const BinObjMgt_Persistent& theSource,
52 const Handle(TDF_Attribute)& theTarget,
53 BinObjMgt_RRelocationTable& /*theRelocTable*/) const
55 Handle(XCAFDoc_Datum) anAtt = Handle(XCAFDoc_Datum)::DownCast(theTarget);
56 TCollection_AsciiString aName, aDescr, anId;
57 if ( !(theSource >> aName >> aDescr >> anId) )
58 return Standard_False;
60 anAtt->Set(new TCollection_HAsciiString( aName ),
61 new TCollection_HAsciiString( aDescr ),
62 new TCollection_HAsciiString( anId ));
66 //=======================================================================
69 //=======================================================================
70 void BinMXCAFDoc_DatumDriver::Paste(const Handle(TDF_Attribute)& theSource,
71 BinObjMgt_Persistent& theTarget,
72 BinObjMgt_SRelocationTable& /*theRelocTable*/) const
74 Handle(XCAFDoc_Datum) anAtt = Handle(XCAFDoc_Datum)::DownCast(theSource);
75 if ( !anAtt->GetName().IsNull() )
76 theTarget << anAtt->GetName()->String();
78 theTarget << TCollection_AsciiString("");
80 if ( !anAtt->GetDescription().IsNull() )
81 theTarget << anAtt->GetDescription()->String();
83 theTarget << TCollection_AsciiString("");
85 if ( !anAtt->GetIdentification().IsNull() )
86 theTarget << anAtt->GetIdentification()->String();
88 theTarget << TCollection_AsciiString("");