1 // Created on: 2008-12-10
2 // Created by: Pavel TELKOV
3 // Copyright (c) 2008-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
17 #include <BinMXCAFDoc_DatumDriver.hxx>
18 #include <BinObjMgt_Persistent.hxx>
19 #include <Message_Messenger.hxx>
20 #include <Standard_Type.hxx>
21 #include <TCollection_HAsciiString.hxx>
22 #include <TColStd_Array1OfReal.hxx>
23 #include <TColStd_HArray1OfReal.hxx>
24 #include <TDF_Attribute.hxx>
25 #include <XCAFDoc_Datum.hxx>
27 IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_DatumDriver,BinMDF_ADriver)
29 //=======================================================================
30 //function : Constructor
32 //=======================================================================
33 BinMXCAFDoc_DatumDriver::BinMXCAFDoc_DatumDriver
34 (const Handle(Message_Messenger)& theMsgDriver)
35 : BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_Datum)->Name())
39 //=======================================================================
42 //=======================================================================
43 Handle(TDF_Attribute) BinMXCAFDoc_DatumDriver::NewEmpty() const
45 return new XCAFDoc_Datum();
48 //=======================================================================
51 //=======================================================================
52 Standard_Boolean BinMXCAFDoc_DatumDriver::Paste(const BinObjMgt_Persistent& theSource,
53 const Handle(TDF_Attribute)& theTarget,
54 BinObjMgt_RRelocationTable& /*theRelocTable*/) const
56 Handle(XCAFDoc_Datum) anAtt = Handle(XCAFDoc_Datum)::DownCast(theTarget);
57 TCollection_AsciiString aName, aDescr, anId;
58 if ( !(theSource >> aName >> aDescr >> anId) )
59 return Standard_False;
61 anAtt->Set(new TCollection_HAsciiString( aName ),
62 new TCollection_HAsciiString( aDescr ),
63 new TCollection_HAsciiString( anId ));
67 //=======================================================================
70 //=======================================================================
71 void BinMXCAFDoc_DatumDriver::Paste(const Handle(TDF_Attribute)& theSource,
72 BinObjMgt_Persistent& theTarget,
73 BinObjMgt_SRelocationTable& /*theRelocTable*/) const
75 Handle(XCAFDoc_Datum) anAtt = Handle(XCAFDoc_Datum)::DownCast(theSource);
76 if ( !anAtt->GetName().IsNull() )
77 theTarget << anAtt->GetName()->String();
79 theTarget << TCollection_AsciiString("");
81 if ( !anAtt->GetDescription().IsNull() )
82 theTarget << anAtt->GetDescription()->String();
84 theTarget << TCollection_AsciiString("");
86 if ( !anAtt->GetIdentification().IsNull() )
87 theTarget << anAtt->GetIdentification()->String();
89 theTarget << TCollection_AsciiString("");