1 // Created on: 2004-05-13
2 // Created by: Sergey ZARITCHNY
3 // Copyright (c) 2004-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
22 #include <BinMFunction_FunctionDriver.ixx>
23 #include <CDM_MessageDriver.hxx>
24 #include <TDF_Attribute.hxx>
25 #include <TFunction_Function.hxx>
26 #include <BinMDF_ADriver.hxx>
27 #include <BinObjMgt_Persistent.hxx>
28 #include <BinObjMgt_RRelocationTable.hxx>
29 #include <BinObjMgt_SRelocationTable.hxx>
30 //=======================================================================
31 //function : BinMFunction_FunctionDriver
33 //=======================================================================
35 BinMFunction_FunctionDriver::BinMFunction_FunctionDriver
36 (const Handle(CDM_MessageDriver)& theMsgDriver)
37 : BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TFunction_Function)->Name())
41 //=======================================================================
44 //=======================================================================
46 Handle(TDF_Attribute) BinMFunction_FunctionDriver::NewEmpty() const
48 return new TFunction_Function();
51 //=======================================================================
53 //purpose : persistent -> transient (retrieve)
54 //=======================================================================
56 Standard_Boolean BinMFunction_FunctionDriver::Paste
57 (const BinObjMgt_Persistent& theSource,
58 const Handle(TDF_Attribute)& theTarget,
59 BinObjMgt_RRelocationTable& ) const
62 Handle(TFunction_Function) anAtt = Handle(TFunction_Function)::DownCast(theTarget);
63 Standard_GUID aGUID("00000000-0000-0000-0000-000000000000");
64 Standard_Boolean ok = theSource >> aGUID;
66 anAtt->SetDriverGUID(aGUID);
67 Standard_Integer aValue;
68 ok = theSource >> aValue;
70 anAtt->SetFailure(aValue);
75 //=======================================================================
77 //purpose : transient -> persistent (store)
78 //=======================================================================
80 void BinMFunction_FunctionDriver::Paste (const Handle(TDF_Attribute)& theSource,
81 BinObjMgt_Persistent& theTarget,
82 BinObjMgt_SRelocationTable& ) const
84 Handle(TFunction_Function) aS = Handle(TFunction_Function)::DownCast (theSource);
85 theTarget << aS->GetDriverGUID();
86 theTarget << aS->GetFailure();