0024166: Unable to create file with "Save" menu of voxeldemo Qt sample
[occt.git] / src / BinMFunction / BinMFunction_FunctionDriver.cxx
CommitLineData
b311480e 1// Created on: 2004-05-13
2// Created by: Sergey ZARITCHNY
3// Copyright (c) 2004-2012 OPEN CASCADE SAS
4//
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.
9//
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.
12//
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.
19
7fd59977 20
21
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
32//purpose :
33//=======================================================================
34
35BinMFunction_FunctionDriver::BinMFunction_FunctionDriver
36 (const Handle(CDM_MessageDriver)& theMsgDriver)
37 : BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TFunction_Function)->Name())
38{
39}
40
41//=======================================================================
42//function : NewEmpty
43//purpose :
44//=======================================================================
45
46Handle(TDF_Attribute) BinMFunction_FunctionDriver::NewEmpty() const
47{
48 return new TFunction_Function();
49}
50
51//=======================================================================
52//function : Paste
53//purpose : persistent -> transient (retrieve)
54//=======================================================================
55
56Standard_Boolean BinMFunction_FunctionDriver::Paste
57 (const BinObjMgt_Persistent& theSource,
58 const Handle(TDF_Attribute)& theTarget,
59 BinObjMgt_RRelocationTable& ) const
60{
61
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;
65 if (ok) {
66 anAtt->SetDriverGUID(aGUID);
67 Standard_Integer aValue;
68 ok = theSource >> aValue;
69 if(ok)
70 anAtt->SetFailure(aValue);
71 }
72 return ok;
73}
74
75//=======================================================================
76//function : Paste
77//purpose : transient -> persistent (store)
78//=======================================================================
79
80void BinMFunction_FunctionDriver::Paste (const Handle(TDF_Attribute)& theSource,
81 BinObjMgt_Persistent& theTarget,
82 BinObjMgt_SRelocationTable& ) const
83{
84 Handle(TFunction_Function) aS = Handle(TFunction_Function)::DownCast (theSource);
85 theTarget << aS->GetDriverGUID();
86 theTarget << aS->GetFailure();
87}
88