diff --git a/src/BinLDrivers/BinLDrivers_DocumentRetrievalDriver.cxx b/src/BinLDrivers/BinLDrivers_DocumentRetrievalDriver.cxx index 1bd4996494..eede80cf5a 100644 --- a/src/BinLDrivers/BinLDrivers_DocumentRetrievalDriver.cxx +++ b/src/BinLDrivers/BinLDrivers_DocumentRetrievalDriver.cxx @@ -222,6 +222,7 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream& // 2a. Retrieve data from the stream: myRelocTable.Clear(); + myRelocTable.SetHeaderData(aHeaderData); mySections.Clear(); myPAtt.Init(); Handle(TDF_Data) aData = new TDF_Data(); @@ -531,4 +532,3 @@ Standard_Boolean BinLDrivers_DocumentRetrievalDriver::CheckDocumentVersion( } return Standard_True; } - diff --git a/src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx b/src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx index 04baf70745..a8313f614c 100644 --- a/src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx +++ b/src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx @@ -429,6 +429,11 @@ void BinLDrivers_DocumentStorageDriver::WriteInfoSection Standard_Integer aObjNb = 1; Standard_Integer aShemaVer = 1; + // Store the name and version of the application that has created the + // document. + theData->SetApplicationVersion(theDoc->Application()->Version()); + theData->SetApplicationName(theDoc->Application()->Name()); + aHeader.einfo += FSD_BinaryFile::WriteInfo (theOStream, aObjNb, BinLDrivers::StorageVersion(), diff --git a/src/BinObjMgt/BinObjMgt_RRelocationTable.cxx b/src/BinObjMgt/BinObjMgt_RRelocationTable.cxx new file mode 100644 index 0000000000..f06f67a73d --- /dev/null +++ b/src/BinObjMgt/BinObjMgt_RRelocationTable.cxx @@ -0,0 +1,49 @@ +// Created on: 2017-08-22 +// Created by: Benjamin BIHLER +// Copyright (c) 2017 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +//======================================================================= +//function : GetHeaderData +//purpose : getter for the file header data +//======================================================================= + +const Handle(Storage_HeaderData)& BinObjMgt_RRelocationTable::GetHeaderData() const +{ + return myHeaderData; +} + +//======================================================================= +//function : SetHeaderData +//purpose : setter for the file header data +//======================================================================= + +void BinObjMgt_RRelocationTable::SetHeaderData( + const Handle(Storage_HeaderData)& theHeaderData) +{ + myHeaderData = theHeaderData; +} + +//======================================================================= +//function : Clear +//purpose : The relocation table is cleared before/after reading in a document. +// : In this case the reference to the file header data should also be +// : cleared, because it is specific to the document. +//======================================================================= +void BinObjMgt_RRelocationTable::Clear(const Standard_Boolean doReleaseMemory) +{ + myHeaderData.Nullify(); + TColStd_DataMapOfIntegerTransient::Clear(doReleaseMemory); +} diff --git a/src/BinObjMgt/BinObjMgt_RRelocationTable.hxx b/src/BinObjMgt/BinObjMgt_RRelocationTable.hxx index 85199347a7..11de88e551 100644 --- a/src/BinObjMgt/BinObjMgt_RRelocationTable.hxx +++ b/src/BinObjMgt/BinObjMgt_RRelocationTable.hxx @@ -17,8 +17,36 @@ #define _BinObjMgt_RRelocationTable_HeaderFile #include +#include -typedef TColStd_DataMapOfIntegerTransient BinObjMgt_RRelocationTable; +//! Retrieval relocation table is modeled as a child class of +//! TColStd_DataMapOfIntegerTransient that stores a handle to the file +//! header section. With that attribute drivers have access to the file header +//! section. +class BinObjMgt_RRelocationTable : public TColStd_DataMapOfIntegerTransient +{ +public: + //! Returns a handle to the header data of the file that is begin read + Standard_EXPORT const Handle(Storage_HeaderData)& GetHeaderData() const; + + //! Sets the storage header data. + //! + //! @param theHeaderData header data of the file that is begin read + Standard_EXPORT void SetHeaderData( + const Handle(Storage_HeaderData)& theHeaderData); + + Standard_EXPORT void Clear(const Standard_Boolean doReleaseMemory = Standard_True); + + + +protected: + + + +private: + + Handle(Storage_HeaderData) myHeaderData; +}; #endif // _BinObjMgt_RRelocationTable_HeaderFile diff --git a/src/BinObjMgt/FILES b/src/BinObjMgt/FILES index bb324114b2..7954116694 100755 --- a/src/BinObjMgt/FILES +++ b/src/BinObjMgt/FILES @@ -7,5 +7,6 @@ BinObjMgt_PExtChar.hxx BinObjMgt_PInteger.hxx BinObjMgt_PReal.hxx BinObjMgt_PShortReal.hxx +BinObjMgt_RRelocationTable.cxx BinObjMgt_RRelocationTable.hxx BinObjMgt_SRelocationTable.hxx diff --git a/src/CDM/CDM_Application.cxx b/src/CDM/CDM_Application.cxx index 5b3d536fd2..f61332d971 100644 --- a/src/CDM/CDM_Application.cxx +++ b/src/CDM/CDM_Application.cxx @@ -103,3 +103,25 @@ void CDM_Application::EndOfUpdate message+=aDocument->Presentation(); Write(message.ToExtString()); } + +//======================================================================= +//function : Name +//purpose : returns the application name +//======================================================================= + +TCollection_ExtendedString CDM_Application::Name() const +{ + // Default: empty + return TCollection_ExtendedString(); +} + +//======================================================================= +//function : Version +//purpose : returns the application version +//======================================================================= + +TCollection_AsciiString CDM_Application::Version() const +{ + // Default: empty + return TCollection_AsciiString(); +} diff --git a/src/CDM/CDM_Application.hxx b/src/CDM/CDM_Application.hxx index 028a9feca9..3720527b6f 100644 --- a/src/CDM/CDM_Application.hxx +++ b/src/CDM/CDM_Application.hxx @@ -24,12 +24,14 @@ #include #include #include +#include +#include + class CDM_Reference; class CDM_MetaData; class CDM_Document; class Resource_Manager; class CDM_MessageDriver; -class TCollection_ExtendedString; class CDM_Application; @@ -60,6 +62,11 @@ public: //! writes the string in the application MessagerDriver. Standard_EXPORT void Write (const Standard_ExtString aString); + //! Returns the application name. + Standard_EXPORT virtual TCollection_ExtendedString Name() const; + + //! Returns the application version. + Standard_EXPORT virtual TCollection_AsciiString Version() const; friend class CDM_Reference; friend class CDM_MetaData;