KSquare Utilities
SimpleCompressor.h
Go to the documentation of this file.
1 /* SimpleCompressor.h -- A simple Run Length compression algorithm.
2  * Copyright (C) 1994-2014 Kurt Kramer
3  * For conditions of distribution and use, see copyright notice in KKB.h
4  */
5 #ifndef _SIMPLECOMPRESSOR_
6 #define _SIMPLECOMPRESSOR_
7 
8 namespace KKB
9 {
11  {
12  public:
13  SimpleCompressor (kkuint32 estimatedMaxBuffSize);
14 
15  SimpleCompressor (uchar* compressdBuff);
16 
17  ~SimpleCompressor ();
18 
19  void AddByte (uchar b);
20 
21 
22  void Add16BitInt (kkuint32 i);
23 
24  uchar* CreateCompressedBuffer (kkuint32& compressedBuffserSize);
25 
26 
27  static
28  uchar* Decompress (const uchar* compressedBuff,
29  kkuint32 compressedBuffLen,
30  kkuint32& unCompressedSize
31  );
32 
33 
34  private:
35  void AddByteToCmpressedBuffer (uchar* compressedBuff,
36  kkuint32& compressedBuffUsed,
37  uchar b
38  );
39 
40 
41  kkuint32 CalcCompressedBytesNeeded ();
42 
43 
44  uchar* buffBytes;
45  uchar* buffLens;
46  kkuint32 buffSize;
47  kkuint32 buffSpaceUsed;
48 
49  kkuint32 lastBuffByteUsed;
50 
51  kkuint32 growthRate;
52  };
53 } /* KKB */
54 
55 
56 
57 #endif
void Add16BitInt(kkuint32 i)
static uchar * Decompress(const uchar *compressedBuff, kkuint32 compressedBuffLen, kkuint32 &unCompressedSize)
SimpleCompressor(uchar *compressdBuff)
unsigned __int32 kkuint32
Definition: KKBaseTypes.h:89
KKTHread * KKTHreadPtr
SimpleCompressor(kkuint32 estimatedMaxBuffSize)
unsigned char uchar
Unsigned character.
Definition: KKBaseTypes.h:77
uchar * CreateCompressedBuffer(kkuint32 &compressedBuffserSize)