CRC Class Reference

Object representing an updateable CRC-32 checksum. More...

#include <crc.h>

Public Member Functions

 CRC ()
 Construct a new CRC object.
void UpdateData (const unsigned char *buf, unsigned bytes)
 Update CRC over the data in buf.
void UpdateData (const std::string &buf)
 Update CRC over the data in buf.
bool UpdateFile (const std::string &filename)
 Update CRC over the data in the specified file.
void ResetCRC ()
 Resets CRC data to original state.
unsigned int GetCRC () const

Static Private Member Functions

static void GenerateCRCTable ()
 Generate the lookup table used for CRC calculation.

Private Attributes

unsigned int crc

Static Private Attributes

static unsigned int crcTable [256]

Detailed Description

Object representing an updateable CRC-32 checksum.

Definition at line 7 of file crc.h.


Constructor & Destructor Documentation

CRC::CRC (  ) 

Construct a new CRC object.

This generates the CRC table if it is the first CRC object being constructed.

Definition at line 33 of file crc.cpp.


Member Function Documentation

void CRC::GenerateCRCTable (  )  [static, private]

Generate the lookup table used for CRC calculation.

Code taken from http://paul.rutgers.edu/~rhoads/Code/crc-32b.c

Definition at line 11 of file crc.cpp.

unsigned int CRC::GetCRC (  )  const [inline]

Definition at line 18 of file crc.h.

void CRC::ResetCRC (  ) 

Resets CRC data to original state.

Definition at line 48 of file crc.cpp.

void CRC::UpdateData ( const std::string &  buf  ) 

Update CRC over the data in buf.

Definition at line 55 of file crc.cpp.

void CRC::UpdateData ( const unsigned char *  buf,
unsigned  bytes 
)

Update CRC over the data in buf.

Definition at line 41 of file crc.cpp.

bool CRC::UpdateFile ( const std::string &  filename  ) 

Update CRC over the data in the specified file.

Returns:
true on success, false if file could not be opened.

Definition at line 63 of file crc.cpp.


Field Documentation

unsigned int CRC::crc [private]

Definition at line 24 of file crc.h.

unsigned int CRC::crcTable [static, private]

Definition at line 21 of file crc.h.


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

Generated on Thu Dec 29 00:11:43 2011 for SpringLobby by doxygen 1.6.3