42cf5bc1 |
1 | // Created by: Alexander GRIGORIEV |
2 | // Copyright (c) 2007-2014 OPEN CASCADE SAS |
3 | // |
4 | // This file is part of Open CASCADE Technology software library. |
5 | // |
6 | // This library is free software; you can redistribute it and/or modify it under |
7 | // the terms of the GNU Lesser General Public License version 2.1 as published |
8 | // by the Free Software Foundation, with special exception defined in the file |
9 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
10 | // distribution for complete text of the license and disclaimer of any warranty. |
11 | // |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
14 | |
15 | #ifndef _BinLDrivers_DocumentSection_HeaderFile |
16 | #define _BinLDrivers_DocumentSection_HeaderFile |
17 | |
18 | #include <Standard.hxx> |
19 | #include <Standard_DefineAlloc.hxx> |
20 | #include <Standard_Handle.hxx> |
21 | |
22 | #include <TCollection_AsciiString.hxx> |
23 | #include <Standard_Size.hxx> |
24 | #include <Standard_Boolean.hxx> |
25 | #include <Standard_OStream.hxx> |
26 | #include <Standard_IStream.hxx> |
27 | class TCollection_AsciiString; |
28 | |
29 | |
30 | //! More or less independent part of the saved/restored document |
31 | //! that is distinct from OCAF data themselves but may be referred |
32 | //! by them. |
33 | class BinLDrivers_DocumentSection |
34 | { |
35 | public: |
36 | |
37 | DEFINE_STANDARD_ALLOC |
38 | |
39 | |
40 | //! Empty constructor |
41 | Standard_EXPORT BinLDrivers_DocumentSection(); |
42 | |
43 | //! Constructor |
44 | Standard_EXPORT BinLDrivers_DocumentSection(const TCollection_AsciiString& theName, const Standard_Boolean isPostRead); |
45 | |
46 | //! Query the name of the section. |
47 | Standard_EXPORT const TCollection_AsciiString& Name() const; |
48 | |
49 | //! Query the status: if the Section should be read after OCAF; |
50 | //! False means that the Section is read before starting to |
51 | //! read OCAF data. |
52 | Standard_EXPORT Standard_Boolean IsPostRead() const; |
53 | |
54 | //! Query the offset of the section in the persistent file |
41fbbba8 |
55 | Standard_EXPORT uint64_t Offset() const; |
42cf5bc1 |
56 | |
57 | //! Set the offset of the section in the persistent file |
41fbbba8 |
58 | Standard_EXPORT void SetOffset (const uint64_t theOffset); |
42cf5bc1 |
59 | |
60 | //! Query the length of the section in the persistent file |
41fbbba8 |
61 | Standard_EXPORT uint64_t Length() const; |
42cf5bc1 |
62 | |
63 | //! Set the length of the section in the persistent file |
41fbbba8 |
64 | Standard_EXPORT void SetLength (const uint64_t theLength); |
42cf5bc1 |
65 | |
66 | //! Create a Section entry in the Document TOC (list of sections) |
67 | Standard_EXPORT void WriteTOC (Standard_OStream& theOS); |
68 | |
69 | //! Save Offset and Length data into the Section entry |
70 | //! in the Document TOC (list of sections) |
41fbbba8 |
71 | Standard_EXPORT void Write (Standard_OStream& theOS, const uint64_t theOffset); |
42cf5bc1 |
72 | |
73 | //! Fill a DocumentSection instance from the data that are read |
74 | //! from TOC. |
75 | Standard_EXPORT static void ReadTOC (BinLDrivers_DocumentSection& theSection, Standard_IStream& theIS); |
76 | |
77 | |
78 | |
79 | |
80 | protected: |
81 | |
82 | |
83 | |
84 | |
85 | |
86 | private: |
87 | |
88 | |
89 | |
90 | TCollection_AsciiString myName; |
41fbbba8 |
91 | uint64_t myValue[2]; |
42cf5bc1 |
92 | Standard_Boolean myIsPostRead; |
93 | |
94 | |
95 | }; |
96 | |
97 | |
98 | |
99 | |
100 | |
101 | |
102 | |
103 | #endif // _BinLDrivers_DocumentSection_HeaderFile |