0026936: Drawbacks of inlining in new type system in OCCT 7.0 -- automatic
[occt.git] / src / BinMDataStd / BinMDataStd_VariableDriver.cxx
CommitLineData
b311480e 1// Created on: 2001-08-24
2// Created by: Alexnder GRIGORIEV
973c2be1 3// Copyright (c) 2001-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
42cf5bc1 16
17#include <BinMDataStd_VariableDriver.hxx>
18#include <BinObjMgt_Persistent.hxx>
19#include <CDM_MessageDriver.hxx>
20#include <Standard_Type.hxx>
7fd59977 21#include <TCollection_AsciiString.hxx>
42cf5bc1 22#include <TDataStd_Variable.hxx>
23#include <TDF_Attribute.hxx>
7fd59977 24
92efcf78 25IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_VariableDriver,BinMDF_ADriver)
26
7fd59977 27//=======================================================================
28//function : BinMDataStd_VariableDriver
29//purpose : Constructor
30//=======================================================================
31BinMDataStd_VariableDriver::BinMDataStd_VariableDriver
32 (const Handle(CDM_MessageDriver)& theMsgDriver)
33 : BinMDF_ADriver (theMsgDriver, NULL)
34{}
35
36//=======================================================================
37//function : NewEmpty
38//purpose :
39//=======================================================================
40Handle(TDF_Attribute) BinMDataStd_VariableDriver::NewEmpty() const
41{
42 return (new TDataStd_Variable());
43}
44
45//=======================================================================
46//function : Paste
47//purpose :
48//=======================================================================
49Standard_Boolean BinMDataStd_VariableDriver::Paste
50 (const BinObjMgt_Persistent& theSource,
51 const Handle(TDF_Attribute)& theTarget,
52 BinObjMgt_RRelocationTable& ) const
53{
54 Handle(TDataStd_Variable) aV = Handle(TDataStd_Variable)::DownCast(theTarget);
55
56 Standard_Boolean isConstant;
57 if (! (theSource >> isConstant))
58 return Standard_False;
59 aV->Constant (isConstant);
60
61 TCollection_AsciiString anStr;
62 if (! (theSource >> anStr))
63 return Standard_False;
64 aV->Unit(anStr);
65
66 return Standard_True;
67}
68
69//=======================================================================
70//function : Paste
71//purpose :
72//=======================================================================
73void BinMDataStd_VariableDriver::Paste (const Handle(TDF_Attribute)& theSource,
74 BinObjMgt_Persistent& theTarget,
75 BinObjMgt_SRelocationTable& ) const
76{
77 Handle(TDataStd_Variable) aV = Handle(TDataStd_Variable)::DownCast(theSource);
78 theTarget << aV->IsConstant() << aV->Unit();
79}