CR32614 Coding - get rid of unsused forward declarations [Adaptor2d to GccAna]
[occt.git] / src / BinLDrivers / BinLDrivers_DocumentStorageDriver.hxx
CommitLineData
42cf5bc1 1// Created on: 2002-10-29
2// Created by: Michael SAZONOV
3// Copyright (c) 2002-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#ifndef _BinLDrivers_DocumentStorageDriver_HeaderFile
17#define _BinLDrivers_DocumentStorageDriver_HeaderFile
18
19#include <Standard.hxx>
20#include <Standard_Type.hxx>
21
22#include <BinObjMgt_Persistent.hxx>
23#include <BinObjMgt_SRelocationTable.hxx>
24#include <TDF_LabelList.hxx>
25#include <TColStd_MapOfTransient.hxx>
26#include <TColStd_IndexedMapOfTransient.hxx>
27#include <BinLDrivers_VectorOfDocumentSection.hxx>
28#include <PCDM_StorageDriver.hxx>
29#include <Standard_OStream.hxx>
30#include <Standard_Boolean.hxx>
31#include <Standard_Type.hxx>
9f45d35b 32#include <TDocStd_FormatVersion.hxx>
42cf5bc1 33class BinMDF_ADriverTable;
83ae3591 34class Message_Messenger;
42cf5bc1 35class CDM_Document;
36class TDF_Label;
37class TCollection_AsciiString;
38class BinLDrivers_DocumentSection;
d5c71e20 39class BinObjMgt_Position;
42cf5bc1 40
41
42class BinLDrivers_DocumentStorageDriver;
43DEFINE_STANDARD_HANDLE(BinLDrivers_DocumentStorageDriver, PCDM_StorageDriver)
44
21c7c457 45//! persistent implementation of storage a document in a binary file
42cf5bc1 46class BinLDrivers_DocumentStorageDriver : public PCDM_StorageDriver
47{
48
49public:
50
51
52 //! Constructor
53 Standard_EXPORT BinLDrivers_DocumentStorageDriver();
6fe96f84 54
42cf5bc1 55 //! Write <theDocument> to the binary file <theFileName>
6d8f9f4a 56 Standard_EXPORT virtual void Write (const Handle(CDM_Document)& theDocument,
57 const TCollection_ExtendedString& theFileName,
7e785937 58 const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
4ff92abe 59
60 //! Write <theDocument> to theOStream
6d8f9f4a 61 Standard_EXPORT virtual void Write (const Handle(CDM_Document)& theDocument,
62 Standard_OStream& theOStream,
7e785937 63 const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
42cf5bc1 64
83ae3591 65 Standard_EXPORT virtual Handle(BinMDF_ADriverTable) AttributeDrivers (const Handle(Message_Messenger)& theMsgDriver);
42cf5bc1 66
67 //! Create a section that should be written after the OCAF data
68 Standard_EXPORT void AddSection (const TCollection_AsciiString& theName, const Standard_Boolean isPostRead = Standard_True);
69
d5c71e20 70 //! Return true if document should be stored in quick mode for partial reading
71 Standard_EXPORT Standard_Boolean IsQuickPart (const Standard_Integer theVersion) const;
42cf5bc1 72
73
92efcf78 74 DEFINE_STANDARD_RTTIEXT(BinLDrivers_DocumentStorageDriver,PCDM_StorageDriver)
42cf5bc1 75
76protected:
77
78
79 //! Write the tree under <theLabel> to the stream <theOS>
6d8f9f4a 80 Standard_EXPORT void WriteSubTree (const TDF_Label& theData,
d5c71e20 81 Standard_OStream& theOS,
82 const Standard_Boolean& theQuickPart,
7e785937 83 const Message_ProgressRange& theRange = Message_ProgressRange());
42cf5bc1 84
85 //! define the procedure of writing a section to file.
716cf4d9 86 Standard_EXPORT virtual void WriteSection (const TCollection_AsciiString& /*theName*/,
87 const Handle(CDM_Document)& /*theDoc*/,
88 Standard_OStream& /*theOS*/);
42cf5bc1 89
90 //! defines the procedure of writing a shape section to file
6d8f9f4a 91 Standard_EXPORT virtual void WriteShapeSection (BinLDrivers_DocumentSection& theDocSection,
92 Standard_OStream& theOS,
9f45d35b 93 const TDocStd_FormatVersion theDocVer,
7e785937 94 const Message_ProgressRange& theRange = Message_ProgressRange());
42cf5bc1 95
d5c71e20 96 //! Enables writing in the quick part access mode.
97 Standard_EXPORT virtual void EnableQuickPartWriting (
98 const Handle(Message_Messenger)& /*theMessageDriver*/, const Standard_Boolean /*theValue*/) {}
99
100 //! clears the writing-cash data in drivers if any.
101 Standard_EXPORT virtual void Clear();
102
42cf5bc1 103 Handle(BinMDF_ADriverTable) myDrivers;
104 BinObjMgt_SRelocationTable myRelocTable;
83ae3591 105 Handle(Message_Messenger) myMsgDriver;
42cf5bc1 106
107private:
108
42cf5bc1 109 Standard_EXPORT void FirstPass (const TDF_Label& theRoot);
110
111 //! Returns true if <L> and its sub-labels do not contain
112 //! attributes to store
113 Standard_EXPORT Standard_Boolean FirstPassSubTree (const TDF_Label& L, TDF_LabelList& ListOfEmptyL);
114
b81b237f 115 //! Write info section using FSD_BinaryFile driver
4ff92abe 116 Standard_EXPORT void WriteInfoSection (const Handle(CDM_Document)& theDocument, Standard_OStream& theOStream);
42cf5bc1 117
118 Standard_EXPORT void UnsupportedAttrMsg (const Handle(Standard_Type)& theType);
119
d5c71e20 120 //! Writes sizes along the file where it is needed for quick part mode
121 Standard_EXPORT void WriteSizes (Standard_OStream& theOS);
122
42cf5bc1 123 BinObjMgt_Persistent myPAtt;
42cf5bc1 124 TDF_LabelList myEmptyLabels;
125 TColStd_MapOfTransient myMapUnsupported;
126 TColStd_IndexedMapOfTransient myTypesMap;
127 BinLDrivers_VectorOfDocumentSection mySections;
4ff92abe 128 TCollection_ExtendedString myFileName;
d5c71e20 129 //! Sizes of labels and some attributes that will be stored in the second pass
130 NCollection_List<Handle(BinObjMgt_Position)> mySizesToWrite;
42cf5bc1 131};
132
42cf5bc1 133#endif // _BinLDrivers_DocumentStorageDriver_HeaderFile