Integration of OCCT 6.5.0 from SVN
[occt.git] / src / BinMFunction / BinMFunction_FunctionDriver.cxx
CommitLineData
7fd59977 1// File: BinMFunction_FunctionDriver.cxx
2// Created: Thu May 13 14:46:12 2004
3// Author: Sergey ZARITCHNY <szy@opencascade.com>
4// Copyright: Open CasCade S.A. 2004
5
6
7#include <BinMFunction_FunctionDriver.ixx>
8#include <CDM_MessageDriver.hxx>
9#include <TDF_Attribute.hxx>
10#include <TFunction_Function.hxx>
11#include <BinMDF_ADriver.hxx>
12#include <BinObjMgt_Persistent.hxx>
13#include <BinObjMgt_RRelocationTable.hxx>
14#include <BinObjMgt_SRelocationTable.hxx>
15//=======================================================================
16//function : BinMFunction_FunctionDriver
17//purpose :
18//=======================================================================
19
20BinMFunction_FunctionDriver::BinMFunction_FunctionDriver
21 (const Handle(CDM_MessageDriver)& theMsgDriver)
22 : BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TFunction_Function)->Name())
23{
24}
25
26//=======================================================================
27//function : NewEmpty
28//purpose :
29//=======================================================================
30
31Handle(TDF_Attribute) BinMFunction_FunctionDriver::NewEmpty() const
32{
33 return new TFunction_Function();
34}
35
36//=======================================================================
37//function : Paste
38//purpose : persistent -> transient (retrieve)
39//=======================================================================
40
41Standard_Boolean BinMFunction_FunctionDriver::Paste
42 (const BinObjMgt_Persistent& theSource,
43 const Handle(TDF_Attribute)& theTarget,
44 BinObjMgt_RRelocationTable& ) const
45{
46
47 Handle(TFunction_Function) anAtt = Handle(TFunction_Function)::DownCast(theTarget);
48 Standard_GUID aGUID("00000000-0000-0000-0000-000000000000");
49 Standard_Boolean ok = theSource >> aGUID;
50 if (ok) {
51 anAtt->SetDriverGUID(aGUID);
52 Standard_Integer aValue;
53 ok = theSource >> aValue;
54 if(ok)
55 anAtt->SetFailure(aValue);
56 }
57 return ok;
58}
59
60//=======================================================================
61//function : Paste
62//purpose : transient -> persistent (store)
63//=======================================================================
64
65void BinMFunction_FunctionDriver::Paste (const Handle(TDF_Attribute)& theSource,
66 BinObjMgt_Persistent& theTarget,
67 BinObjMgt_SRelocationTable& ) const
68{
69 Handle(TFunction_Function) aS = Handle(TFunction_Function)::DownCast (theSource);
70 theTarget << aS->GetDriverGUID();
71 theTarget << aS->GetFailure();
72}
73