HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_CompressedBlockIndex.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_CompressedBlockIndex.h
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef UT_COMPRESSEDBLOCKINDEX_H_
12 #define UT_COMPRESSEDBLOCKINDEX_H_
13 
14 #include "UT_API.h"
15 #include "UT_Array.h"
16 #include "UT_IntrusivePtr.h"
17 
18 class UT_IStream;
19 
20 typedef int64 BlockLocationType;
21 
23  : public UT_IntrusiveRefCounter<UT_CompressedBlockIndex>
24 {
25 public:
28 
29  /// Sets the blocksize and the size of the last block.
30  /// Last block size used for end of stream calculations.
31  void setBlockSize(exint blockSize, exint lastBlockSize);
32 
33  /// Adds entry to the end of the index
34  void append(BlockLocationType entry);
35 
36  /// Removes the last entry
37  void removeLast();
38 
39  /// Get's the total uncompressed size of the stream with this block index
40  exint getTotalUncompressedSize();
41 
42  /// Retrieves the location of the start of the block containing
43  /// the given offset in uncompressed file
44  BlockLocationType getCompressedBlockOffset(exint uncompressedOffset);
45 
46  /// Retrieves the location of the start of the block containing
47  /// the given offset (given from the end of the file) in uncompressed file
48  BlockLocationType getCompressedBlockOffsetFromEnd(exint uncompressedOffsetFromEnd);
49 
50  /// Get the block number given offset in compressed file
51  exint getBlockNumberCompressedOffset(BlockLocationType compressedOffset);
52 
53  /// Get the length in the file of the entire index section (for seeking)
54  int64 getLength();
55 
56  /// Get the block size of the compressed blocks
57  exint getBlockSize();
58 
59  /// Get the size of the last compressed block
60  exint getLastBlockSize();
61 
62 
63  /// Write index to stream
64  void writeToStream(std::ostream* out);
65 
66  /// Read index from stream
67  void readFromStream(UT_IStream* in, int64 indexLength);
68 
69  /// Dump information
70  void dump(const char *msg="") const;
71 
72 private:
74 
75  exint myBlockSize;
76 
77  exint myLastBlockSize;
78 };
79 
81 
82 #endif // UT_COMPRESSEDBLOCKINDEX_H_
UT_IntrusivePtr< UT_CompressedBlockIndex > UT_CompressedBlockIndexPtr
int64 exint
Definition: SYS_Types.h:125
#define UT_API
Definition: UT_API.h:14
A reference counter base class for use with UT_IntrusivePtr.
GLuint in
Definition: glew.h:11552
long long int64
Definition: SYS_Types.h:116
int64 BlockLocationType