|
||||
File indexing completed on 2025-01-18 10:03:00
0001 // Copyright (c) 2020 OPEN CASCADE SAS 0002 // 0003 // This file is part of Open CASCADE Technology software library. 0004 // 0005 // This library is free software; you can redistribute it and/or modify it under 0006 // the terms of the GNU Lesser General Public License version 2.1 as published 0007 // by the Free Software Foundation, with special exception defined in the file 0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0009 // distribution for complete text of the license and disclaimer of any warranty. 0010 // 0011 // Alternatively, this file may be used under the terms of Open CASCADE 0012 // commercial license or contractual agreement. 0013 0014 #ifndef _BinMDF_DerivedDriver_HeaderFile 0015 #define _BinMDF_DerivedDriver_HeaderFile 0016 0017 #include <BinMDF_ADriver.hxx> 0018 0019 //! A universal driver for the attribute that inherits another attribute with 0020 //! ready to used persistence mechanism implemented (already has a driver to store/retrieve). 0021 class BinMDF_DerivedDriver : public BinMDF_ADriver 0022 { 0023 DEFINE_STANDARD_RTTIEXT(BinMDF_DerivedDriver, BinMDF_ADriver) 0024 public: 0025 0026 //! Creates a derivative persistence driver for theDerivative attribute by reusage of theBaseDriver 0027 //! @param theDerivative an instance of the attribute, just created, detached from any label 0028 //! @param theBaseDriver a driver of the base attribute, called by Paste methods 0029 BinMDF_DerivedDriver (const Handle(TDF_Attribute)& theDerivative, 0030 const Handle(BinMDF_ADriver)& theBaseDriver) 0031 : BinMDF_ADriver(theBaseDriver->MessageDriver()), myDerivative(theDerivative), myBaseDirver(theBaseDriver) {} 0032 0033 //! Creates a new instance of the derivative attribute 0034 virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE { return myDerivative->NewEmpty(); } 0035 0036 //! Reuses the base driver to read the base fields 0037 virtual Standard_Boolean Paste (const BinObjMgt_Persistent& theSource, 0038 const Handle(TDF_Attribute)& theTarget, 0039 BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE 0040 { 0041 Standard_Boolean aResult = myBaseDirver->Paste (theSource, theTarget, theRelocTable); 0042 theTarget->AfterRetrieval(); // to allow synchronization of the derived attribute with the base content 0043 return aResult; 0044 } 0045 0046 //! Reuses the base driver to store the base fields 0047 virtual void Paste (const Handle(TDF_Attribute)& theSource, 0048 BinObjMgt_Persistent& theTarget, 0049 BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE 0050 { 0051 myBaseDirver->Paste(theSource, theTarget, theRelocTable); 0052 } 0053 0054 protected: 0055 Handle(TDF_Attribute) myDerivative; //!< the derivative attribute that inherits the base 0056 Handle(BinMDF_ADriver) myBaseDirver; //!< the base attribute driver to be reused here 0057 }; 0058 0059 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |