Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:02:59

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 <TColStd_MapOfInteger.hxx>
0024 #include <BinLDrivers_VectorOfDocumentSection.hxx>
0025 #include <PCDM_RetrievalDriver.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <Standard_IStream.hxx>
0028 #include <Storage_Position.hxx>
0029 #include <Storage_Data.hxx>
0030 
0031 class BinMDF_ADriverTable;
0032 class Message_Messenger;
0033 class TCollection_ExtendedString;
0034 class CDM_Document;
0035 class CDM_Application;
0036 class TDF_Label;
0037 class BinLDrivers_DocumentSection;
0038 
0039 
0040 class BinLDrivers_DocumentRetrievalDriver;
0041 DEFINE_STANDARD_HANDLE(BinLDrivers_DocumentRetrievalDriver, PCDM_RetrievalDriver)
0042 
0043 
0044 class BinLDrivers_DocumentRetrievalDriver : public PCDM_RetrievalDriver
0045 {
0046 
0047 public:
0048 
0049   
0050   //! Constructor
0051   Standard_EXPORT BinLDrivers_DocumentRetrievalDriver();
0052   
0053   //! retrieves the content of the file into a new Document.
0054   Standard_EXPORT virtual void Read (const TCollection_ExtendedString& theFileName,
0055                                      const Handle(CDM_Document)& theNewDocument, 
0056                                      const Handle(CDM_Application)& theApplication, 
0057                                      const Handle(PCDM_ReaderFilter)& theFilter = Handle(PCDM_ReaderFilter)(),
0058                                      const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
0059 
0060   Standard_EXPORT virtual void Read (Standard_IStream&               theIStream,
0061                                      const Handle(Storage_Data)&     theStorageData,
0062                                      const Handle(CDM_Document)&     theDoc,
0063                                      const Handle(CDM_Application)&  theApplication,
0064                                      const Handle(PCDM_ReaderFilter)& theFilter = Handle(PCDM_ReaderFilter)(),
0065                                      const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
0066   
0067   Standard_EXPORT virtual Handle(BinMDF_ADriverTable) AttributeDrivers (const Handle(Message_Messenger)& theMsgDriver);
0068 
0069 
0070 
0071 
0072   DEFINE_STANDARD_RTTIEXT(BinLDrivers_DocumentRetrievalDriver,PCDM_RetrievalDriver)
0073 
0074 protected:
0075 
0076   
0077   //! Read the tree from the stream <theIS> to <theLabel>
0078   Standard_EXPORT virtual Standard_Integer ReadSubTree
0079     (Standard_IStream& theIS, 
0080      const TDF_Label& theData, 
0081      const Handle(PCDM_ReaderFilter)& theFilter,
0082      const Standard_Boolean& theQuickPart,
0083      const Message_ProgressRange& theRanges = Message_ProgressRange());
0084   
0085   
0086   //! define the procedure of reading a section to file.
0087   Standard_EXPORT virtual void ReadSection
0088     (BinLDrivers_DocumentSection& theSection, 
0089      const Handle(CDM_Document)& theDoc,
0090      Standard_IStream& theIS);
0091   
0092   //! define the procedure of reading a shapes section to file.
0093   Standard_EXPORT virtual void ReadShapeSection
0094    (BinLDrivers_DocumentSection& theSection,
0095     Standard_IStream& theIS,
0096     const Standard_Boolean isMess = Standard_False,
0097     const Message_ProgressRange& theRange = Message_ProgressRange());
0098   
0099   //! checks the shapes section can be correctly retrieved.
0100   Standard_EXPORT virtual void CheckShapeSection (const Storage_Position& thePos, Standard_IStream& theIS);
0101 
0102   //! clears the reading-cash data in drivers if any.
0103   Standard_EXPORT virtual void Clear();
0104   
0105   //! Check a file version(in which file was written) with a current version.
0106   //! Redefining this method is a chance for application to read files
0107   //! written by newer applications.
0108   //! The default implementation: if the version of the file is greater than the
0109   //! current or lesser than 2, then return false, else true
0110   Standard_EXPORT virtual Standard_Boolean CheckDocumentVersion (const Standard_Integer theFileVersion, const Standard_Integer theCurVersion);
0111 
0112   //! Return true if retrieved document allows to read parts quickly.
0113   static Standard_Boolean IsQuickPart (const Standard_Integer theFileVer);
0114 
0115   //! Enables reading in the quick part access mode.
0116   Standard_EXPORT virtual void EnableQuickPartReading (const Handle(Message_Messenger)& /*theMessageDriver*/, Standard_Boolean /*theValue*/) {}
0117 
0118   Handle(BinMDF_ADriverTable) myDrivers;
0119   BinObjMgt_RRelocationTable myRelocTable;
0120   Handle(Message_Messenger) myMsgDriver;
0121 
0122 private:
0123 
0124 
0125   BinObjMgt_Persistent myPAtt;
0126   TColStd_MapOfInteger myMapUnsupported;
0127   BinLDrivers_VectorOfDocumentSection mySections;
0128 
0129 
0130 };
0131 
0132 
0133 
0134 
0135 
0136 
0137 
0138 #endif // _BinLDrivers_DocumentRetrievalDriver_HeaderFile