Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cStreamBitTree Class Reference

#include <cStreamBit.h>

Inheritance diagram for GrayLib::cStreamBitTree:
Gray::cSingleton< cStreamBitTree > Gray::cSingletonStatic< TYPE > Gray::cSingletonRegister Gray::CObject Gray::cHeapObject Gray::IHeapObject

Public Member Functions

bool InitTree ()
 
bool isInitTree () const noexcept
 
 UNITTEST_FRIEND (cStreamBit)
 
- Public Member Functions inherited from Gray::CObject
virtual ~CObject ()
 
virtual bool isValidCheck () const noexcept
 < memory allocation and structure definitions are valid. More...
 
virtual void AssertValid () const
 < memory allocation and structure definitions are valid. More...
 
virtual void Serialize (cArchive &a)
 
- Public Member Functions inherited from Gray::cHeapObject
 cHeapObject ()
 
virtual ~cHeapObject ()
 
bool IsValidInsideN (INT_PTR index) const
 
bool IsValidInsidePtr (void const *pTest) const
 
virtual size_t GetHeapStatsThis (OUT ITERATE_t &iAllocCount) const
 
virtual bool isValidCheck () const noexcept
 

Static Public Member Functions

static size_t GRAYCALL Encode (BYTE *pOutput, const BYTE *pInput, size_t inplen)
 
- Static Public Member Functions inherited from Gray::cSingleton< cStreamBitTree >
static cStreamBitTree *__stdcall get_Single ()
 
static TYPE2 *__stdcall get_SingleT ()
 
static cStreamBitTree &__stdcall I ()
 
- Static Public Member Functions inherited from Gray::cSingletonStatic< TYPE >
static bool isSingleCreated () noexcept
 
static TYPEget_SingleU () noexcept
 
static TYPEget_Single ()
 
template<class TYPE2 >
static TYPE2 *__stdcall get_SingleCast ()
 
static TYPEI () noexcept
 
- Static Public Member Functions inherited from Gray::cSingletonRegister
static void __stdcall ReleaseModule (HMODULE hMod)
 

Public Attributes

cStreamBitBranch m_Decoder [k_SIZE *2]
 build this on demand. InitTree More...
 
short m_iDecoderTree
 

Static Public Attributes

static const short k_SIZE = (256 + 1)
 
static const WORD k_EncoderData [k_SIZE]
 
- Static Public Attributes inherited from Gray::cSingletonRegister
static cThreadLockFast sm_LockSingle
 common lock for all cSingleton. More...
 

Protected Member Functions

bool AddBitBranch (short Value, WORD wCode, int iBits)
 
 cStreamBitTree ()
 
 ~cStreamBitTree ()
 
- Protected Member Functions inherited from Gray::cSingleton< cStreamBitTree >
 cSingleton (cStreamBitTree *pObject, const TYPEINFO_t &rAddrCode=typeid(cStreamBitTree)) noexcept
 
virtual ~cSingleton ()
 
- Protected Member Functions inherited from Gray::cSingletonStatic< TYPE >
 cSingletonStatic (TYPE *pObject) noexcept
 
virtual ~cSingletonStatic () noexcept
 
- Protected Member Functions inherited from Gray::cSingletonRegister
 cSingletonRegister (const TYPEINFO_t &rAddrCode) noexcept
 
virtual ~cSingletonRegister ()
 
void RegisterSingleton ()
 
- Protected Member Functions inherited from Gray::cHeapObject
const void * get_HeapPtr () const noexcept override
 Get the top level (outermost, freeable) class pointer. I can delete get_HeapPtr(). More...
 

Friends

class cSingleton< cStreamBitTree >
 

Additional Inherited Members

- Protected Attributes inherited from Gray::cSingletonRegister
HMODULE m_hModuleLoaded
 What modules loaded this ? So singletons can be destroyed if DLL/SO unloads. More...
 
- Static Protected Attributes inherited from Gray::cSingletonStatic< TYPE >
static TYPEsm_pThe = nullptr
 pointer to the one and only object of this TYPE. ASSUME automatically init to = nullptr. More...
 

Detailed Description

A very simple Binary tree for encoding/decoding the bit packing

Note
Need only one global instance of this for all instances of cStreamBitDecompress.
Use ZLIB/cStreamZLib or BZIP for better compression.

Constructor & Destructor Documentation

◆ cStreamBitTree()

GrayLib::cStreamBitTree::cStreamBitTree ( )
protected

◆ ~cStreamBitTree()

GrayLib::cStreamBitTree::~cStreamBitTree ( )
protected

Member Function Documentation

◆ AddBitBranch()

bool GrayLib::cStreamBitTree::AddBitBranch ( short  Value,
WORD  wCode,
int  iBits 
)
protected

adds a hex value related to it's binary compression code to the decompression tree.

Note
we can cut the tree in half if we trim the last branch to just hold the value!

◆ Encode()

size_t GrayLib::cStreamBitTree::Encode ( BYTE *  pOutput,
const BYTE *  pInput,
size_t  inplen 
)
static
Note
This puts a compression terminator at the end then flushes odd bits.
Returns
Output length.

◆ InitTree()

bool GrayLib::cStreamBitTree::InitTree ( )

◆ isInitTree()

bool GrayLib::cStreamBitTree::isInitTree ( ) const
inlinenoexcept

◆ UNITTEST_FRIEND()

GrayLib::cStreamBitTree::UNITTEST_FRIEND ( cStreamBit  )

Friends And Related Function Documentation

◆ cSingleton< cStreamBitTree >

friend class cSingleton< cStreamBitTree >
friend

Member Data Documentation

◆ k_EncoderData

const WORD GrayLib::cStreamBitTree::k_EncoderData
static

◆ k_SIZE

const short GrayLib::cStreamBitTree::k_SIZE = (256 + 1)
static

◆ m_Decoder

cStreamBitBranch GrayLib::cStreamBitTree::m_Decoder[k_SIZE *2]

build this on demand. InitTree

◆ m_iDecoderTree

short GrayLib::cStreamBitTree::m_iDecoderTree

The documentation for this class was generated from the following files: