帮忙解释个程序
#include "stdafx.h"#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "memory.h"
#include "conio.h"
#include "lzwcode.h"
#include "lzwtable.h"
/*
class CLZWEncodeTable
*/
CLZWDecodeTable::CLZWDecodeTable(BOOL fInit)
{
m_pbContain=NULL;
m_dwTableEntryNumber=0;
if(fInit)
InitLZWTable();
}
CLZWDecodeTable::~CLZWDecodeTable()
{
ClearDecodeTable();
}
void CLZWDecodeTable::ClearDecodeTable(void)
{
if(m_pbContain==NULL)
return;
for(int i=0;i<4096;i++)
{
if(m_pbContain[i])
delete (m_pbContain[i]);
}
delete m_pbContain;
m_pbContain=NULL;
m_dwTableEntryNumber=0;
}
void CLZWDecodeTable::InitLZWTable(void)
{
ClearDecodeTable();
m_pbContain=new BYTE*[4096];
int iSize=sizeof(m_pbContain);
//if(NULL==m_pbContain)
// AfxMessageBox("error new m_pbContain=BYTE*[4096]");
for(int i=0;i<4096;i++)
{
m_pbContain[i]=NULL;
}
for(i=0;i<=255;i++)
{
m_pbContain[i]=new BYTE[1+2];
*((WORD*)m_pbContain[i])=1;
m_pbContain[i][2]=(BYTE)i;
}
m_dwTableEntryNumber=LZW_BEGIN_ENTRY;
}
BYTE* CLZWDecodeTable::GetMatchData(WORD wCode)
{
return m_pbContain[wCode];
}
void CLZWDecodeTable::AddToChild(WORD wCode,BYTE *pbContain,int iLength)
{
ASSERT(wCode<4096);
if(m_pbContain[wCode])
delete m_pbContain[wCode];
m_pbContain[wCode]=new BYTE[iLength+2];
*((WORD*)m_pbContain[wCode])=(WORD)iLength;
memcpy(m_pbContain[wCode]+2,pbContain,iLength);
}
/*
class CLZWEncodeTable
*/
CLZWEncodeTable::CLZWEncodeTable(BOOL fInit)