| 1 | // Created on: 2004-05-13 |
| 2 | // Created by: Sergey ZARITCHNY |
| 3 | // Copyright (c) 2004-2014 OPEN CASCADE SAS |
| 4 | // |
| 5 | // This file is part of Open CASCADE Technology software library. |
| 6 | // |
| 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 |
| 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. |
| 12 | // |
| 13 | // Alternatively, this file may be used under the terms of Open CASCADE |
| 14 | // commercial license or contractual agreement. |
| 15 | |
| 16 | |
| 17 | #include <BinMDF_ADriver.hxx> |
| 18 | #include <BinMFunction_FunctionDriver.hxx> |
| 19 | #include <BinObjMgt_Persistent.hxx> |
| 20 | #include <BinObjMgt_RRelocationTable.hxx> |
| 21 | #include <BinObjMgt_SRelocationTable.hxx> |
| 22 | #include <CDM_MessageDriver.hxx> |
| 23 | #include <Standard_Type.hxx> |
| 24 | #include <TDF_Attribute.hxx> |
| 25 | #include <TFunction_Function.hxx> |
| 26 | |
| 27 | IMPLEMENT_STANDARD_RTTIEXT(BinMFunction_FunctionDriver,BinMDF_ADriver) |
| 28 | |
| 29 | //======================================================================= |
| 30 | //function : BinMFunction_FunctionDriver |
| 31 | //purpose : |
| 32 | //======================================================================= |
| 33 | BinMFunction_FunctionDriver::BinMFunction_FunctionDriver |
| 34 | (const Handle(CDM_MessageDriver)& theMsgDriver) |
| 35 | : BinMDF_ADriver (theMsgDriver, STANDARD_TYPE(TFunction_Function)->Name()) |
| 36 | { |
| 37 | } |
| 38 | |
| 39 | //======================================================================= |
| 40 | //function : NewEmpty |
| 41 | //purpose : |
| 42 | //======================================================================= |
| 43 | |
| 44 | Handle(TDF_Attribute) BinMFunction_FunctionDriver::NewEmpty() const |
| 45 | { |
| 46 | return new TFunction_Function(); |
| 47 | } |
| 48 | |
| 49 | //======================================================================= |
| 50 | //function : Paste |
| 51 | //purpose : persistent -> transient (retrieve) |
| 52 | //======================================================================= |
| 53 | |
| 54 | Standard_Boolean BinMFunction_FunctionDriver::Paste |
| 55 | (const BinObjMgt_Persistent& theSource, |
| 56 | const Handle(TDF_Attribute)& theTarget, |
| 57 | BinObjMgt_RRelocationTable& ) const |
| 58 | { |
| 59 | |
| 60 | Handle(TFunction_Function) anAtt = Handle(TFunction_Function)::DownCast(theTarget); |
| 61 | Standard_GUID aGUID("00000000-0000-0000-0000-000000000000"); |
| 62 | Standard_Boolean ok = theSource >> aGUID; |
| 63 | if (ok) { |
| 64 | anAtt->SetDriverGUID(aGUID); |
| 65 | Standard_Integer aValue; |
| 66 | ok = theSource >> aValue; |
| 67 | if(ok) |
| 68 | anAtt->SetFailure(aValue); |
| 69 | } |
| 70 | return ok; |
| 71 | } |
| 72 | |
| 73 | //======================================================================= |
| 74 | //function : Paste |
| 75 | //purpose : transient -> persistent (store) |
| 76 | //======================================================================= |
| 77 | |
| 78 | void BinMFunction_FunctionDriver::Paste (const Handle(TDF_Attribute)& theSource, |
| 79 | BinObjMgt_Persistent& theTarget, |
| 80 | BinObjMgt_SRelocationTable& ) const |
| 81 | { |
| 82 | Handle(TFunction_Function) aS = Handle(TFunction_Function)::DownCast (theSource); |
| 83 | theTarget << aS->GetDriverGUID(); |
| 84 | theTarget << aS->GetFailure(); |
| 85 | } |
| 86 | |