Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 09:16:29

0001 // Created on: 2002-10-31
0002 // Created by: Michael SAZONOV
0003 // Copyright (c) 2002-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _BinLDrivers_DocumentRetrievalDriver_HeaderFile
0017 #define _BinLDrivers_DocumentRetrievalDriver_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 
0021 #include <BinObjMgt_Persistent.hxx>
0022 #include <BinObjMgt_RRelocationTable.hxx>
0023 #include <Standard_Integer.hxx>
0024 #include <NCollection_Map.hxx>
0025 #include <NCollection_DynamicArray.hxx>
0026 #include <BinLDrivers_DocumentSection.hxx>
0027 #include <PCDM_RetrievalDriver.hxx>
0028 #include <Standard_IStream.hxx>
0029 #include <Storage_Position.hxx>
0030 #include <Storage_Data.hxx>
0031 
0032 class BinMDF_ADriverTable;
0033 class Message_Messenger;
0034 class TCollection_ExtendedString;
0035 class CDM_Document;
0036 class CDM_Application;
0037 class TDF_Label;
0038 class BinLDrivers_DocumentSection;
0039 
0040 class BinLDrivers_DocumentRetrievalDriver : public PCDM_RetrievalDriver
0041 {
0042 
0043 public:
0044   //! Constructor
0045   Standard_EXPORT BinLDrivers_DocumentRetrievalDriver();
0046 
0047   //! retrieves the content of the file into a new Document.
0048   Standard_EXPORT void Read(
0049     const TCollection_ExtendedString&     theFileName,
0050     const occ::handle<CDM_Document>&      theNewDocument,
0051     const occ::handle<CDM_Application>&   theApplication,
0052     const occ::handle<PCDM_ReaderFilter>& theFilter   = occ::handle<PCDM_ReaderFilter>(),
0053     const Message_ProgressRange&          theProgress = Message_ProgressRange()) override;
0054 
0055   Standard_EXPORT void Read(
0056     Standard_IStream&                     theIStream,
0057     const occ::handle<Storage_Data>&      theStorageData,
0058     const occ::handle<CDM_Document>&      theDoc,
0059     const occ::handle<CDM_Application>&   theApplication,
0060     const occ::handle<PCDM_ReaderFilter>& theFilter   = occ::handle<PCDM_ReaderFilter>(),
0061     const Message_ProgressRange&          theProgress = Message_ProgressRange()) override;
0062 
0063   Standard_EXPORT virtual occ::handle<BinMDF_ADriverTable> AttributeDrivers(
0064     const occ::handle<Message_Messenger>& theMsgDriver);
0065 
0066   DEFINE_STANDARD_RTTIEXT(BinLDrivers_DocumentRetrievalDriver, PCDM_RetrievalDriver)
0067 
0068 protected:
0069   //! Read the tree from the stream <theIS> to <theLabel>
0070   Standard_EXPORT virtual int ReadSubTree(
0071     Standard_IStream&                     theIS,
0072     const TDF_Label&                      theData,
0073     const occ::handle<PCDM_ReaderFilter>& theFilter,
0074     const bool&                           theQuickPart,
0075     const bool                            theReadMissing,
0076     const Message_ProgressRange&          theRanges = Message_ProgressRange());
0077 
0078   //! define the procedure of reading a section to file.
0079   Standard_EXPORT virtual void ReadSection(BinLDrivers_DocumentSection&     theSection,
0080                                            const occ::handle<CDM_Document>& theDoc,
0081                                            Standard_IStream&                theIS);
0082 
0083   //! define the procedure of reading a shapes section to file.
0084   Standard_EXPORT virtual void ReadShapeSection(
0085     BinLDrivers_DocumentSection& theSection,
0086     Standard_IStream&            theIS,
0087     const bool                   isMess   = false,
0088     const Message_ProgressRange& theRange = Message_ProgressRange());
0089 
0090   //! checks the shapes section can be correctly retrieved.
0091   Standard_EXPORT virtual void CheckShapeSection(const Storage_Position& thePos,
0092                                                  Standard_IStream&       theIS);
0093 
0094   //! clears the reading-cash data in drivers if any.
0095   Standard_EXPORT virtual void Clear();
0096 
0097   //! Check a file version(in which file was written) with a current version.
0098   //! Redefining this method is a chance for application to read files
0099   //! written by newer applications.
0100   //! The default implementation: if the version of the file is greater than the
0101   //! current or lesser than 2, then return false, else true
0102   Standard_EXPORT virtual bool CheckDocumentVersion(const int theFileVersion,
0103                                                     const int theCurVersion);
0104 
0105   //! Return true if retrieved document allows to read parts quickly.
0106   static bool IsQuickPart(const int theFileVer);
0107 
0108   //! Enables reading in the quick part access mode.
0109   Standard_EXPORT virtual void EnableQuickPartReading(
0110     const occ::handle<Message_Messenger>& /*theMessageDriver*/,
0111     bool /*theValue*/)
0112   {
0113   }
0114 
0115   occ::handle<BinMDF_ADriverTable> myDrivers;
0116   BinObjMgt_RRelocationTable       myRelocTable;
0117   occ::handle<Message_Messenger>   myMsgDriver;
0118 
0119 private:
0120   BinObjMgt_Persistent                                  myPAtt;
0121   NCollection_Map<int>                                  myMapUnsupported;
0122   NCollection_DynamicArray<BinLDrivers_DocumentSection> mySections;
0123   NCollection_Map<int>                                  myUnresolvedLinks;
0124 };
0125 
0126 #endif // _BinLDrivers_DocumentRetrievalDriver_HeaderFile