1 // Created on: 2001-08-24
2 // Created by: Alexnder GRIGORIEV
3 // Copyright (c) 2001-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 <BinMDataStd_VariableDriver.hxx>
18 #include <BinObjMgt_Persistent.hxx>
19 #include <Message_Messenger.hxx>
20 #include <Standard_Type.hxx>
21 #include <TCollection_AsciiString.hxx>
22 #include <TDataStd_Variable.hxx>
23 #include <TDF_Attribute.hxx>
25 IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_VariableDriver,BinMDF_ADriver)
27 //=======================================================================
28 //function : BinMDataStd_VariableDriver
29 //purpose : Constructor
30 //=======================================================================
31 BinMDataStd_VariableDriver::BinMDataStd_VariableDriver
32 (const Handle(Message_Messenger)& theMsgDriver)
33 : BinMDF_ADriver (theMsgDriver, NULL)
36 //=======================================================================
39 //=======================================================================
40 Handle(TDF_Attribute) BinMDataStd_VariableDriver::NewEmpty() const
42 return (new TDataStd_Variable());
45 //=======================================================================
48 //=======================================================================
49 Standard_Boolean BinMDataStd_VariableDriver::Paste
50 (const BinObjMgt_Persistent& theSource,
51 const Handle(TDF_Attribute)& theTarget,
52 BinObjMgt_RRelocationTable& ) const
54 Handle(TDataStd_Variable) aV = Handle(TDataStd_Variable)::DownCast(theTarget);
56 Standard_Boolean isConstant;
57 if (! (theSource >> isConstant))
58 return Standard_False;
59 aV->Constant (isConstant);
61 TCollection_AsciiString anStr;
62 if (! (theSource >> anStr))
63 return Standard_False;
69 //=======================================================================
72 //=======================================================================
73 void BinMDataStd_VariableDriver::Paste (const Handle(TDF_Attribute)& theSource,
74 BinObjMgt_Persistent& theTarget,
75 BinObjMgt_SRelocationTable& ) const
77 Handle(TDataStd_Variable) aV = Handle(TDataStd_Variable)::DownCast(theSource);
78 theTarget << aV->IsConstant() << aV->Unit();