0024023: Revamp the OCCT Handle -- ambiguity
[occt.git] / src / BinMFunction / BinMFunction_FunctionDriver.cxx
CommitLineData
b311480e 1// Created on: 2004-05-13
2// Created by: Sergey ZARITCHNY
973c2be1 3// Copyright (c) 2004-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
16#include <BinMFunction_FunctionDriver.ixx>
17#include <CDM_MessageDriver.hxx>
18#include <TDF_Attribute.hxx>
19#include <TFunction_Function.hxx>
20#include <BinMDF_ADriver.hxx>
21#include <BinObjMgt_Persistent.hxx>
22#include <BinObjMgt_RRelocationTable.hxx>
23#include <BinObjMgt_SRelocationTable.hxx>
24//=======================================================================
25//function : BinMFunction_FunctionDriver
26//purpose :
27//=======================================================================
28
29BinMFunction_FunctionDriver::BinMFunction_FunctionDriver
30 (const Handle(CDM_MessageDriver)& theMsgDriver)
31 : BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TFunction_Function)->Name())
32{
33}
34
35//=======================================================================
36//function : NewEmpty
37//purpose :
38//=======================================================================
39
40Handle(TDF_Attribute) BinMFunction_FunctionDriver::NewEmpty() const
41{
42 return new TFunction_Function();
43}
44
45//=======================================================================
46//function : Paste
47//purpose : persistent -> transient (retrieve)
48//=======================================================================
49
50Standard_Boolean BinMFunction_FunctionDriver::Paste
51 (const BinObjMgt_Persistent& theSource,
52 const Handle(TDF_Attribute)& theTarget,
53 BinObjMgt_RRelocationTable& ) const
54{
55
56 Handle(TFunction_Function) anAtt = Handle(TFunction_Function)::DownCast(theTarget);
57 Standard_GUID aGUID("00000000-0000-0000-0000-000000000000");
58 Standard_Boolean ok = theSource >> aGUID;
59 if (ok) {
60 anAtt->SetDriverGUID(aGUID);
61 Standard_Integer aValue;
62 ok = theSource >> aValue;
63 if(ok)
64 anAtt->SetFailure(aValue);
65 }
66 return ok;
67}
68
69//=======================================================================
70//function : Paste
71//purpose : transient -> persistent (store)
72//=======================================================================
73
74void BinMFunction_FunctionDriver::Paste (const Handle(TDF_Attribute)& theSource,
75 BinObjMgt_Persistent& theTarget,
76 BinObjMgt_SRelocationTable& ) const
77{
78 Handle(TFunction_Function) aS = Handle(TFunction_Function)::DownCast (theSource);
79 theTarget << aS->GetDriverGUID();
80 theTarget << aS->GetFailure();
81}
82