SDHLibrary-CPP 0.0.2.10SCHUNK GmbH & Co. KG
C++ access library for SCHUNK Dextrous Hand SDH

SDH::cCRC Class Reference

Cyclic Redundancy Code checker class, used for protecting communication against transmission errors. More...

#include <crc.h>

Inheritance diagram for SDH::cCRC:

List of all members.

Public Member Functions

 cCRC (tCRCValue const *_crc_table, tCRCValue _initial_value)
 constructor: create a new cCRC object and initialize the current value of the CRC checksum. crc_table is the CRC table to use.
tCRCValue AddByte (unsigned char byte)
 insert byte into CRC calculation and return the new current CRC checksum
tCRCValue AddBytes (unsigned char *bytes, int nb_bytes)
 insert nb_bytes from bytes into CRC calculation and return the new current CRC checksum
tCRCValue GetCRC ()
 return the current CRC value
UInt8 GetCRC_LB ()
 return the low byte of the current CRC value
UInt8 GetCRC_HB ()
 return the high byte of the current CRC value
tCRCValue Reset ()
 reset the current CRC value to its initial value and return it;

Protected Attributes

tCRCValue current_crc
 current value of the CRC checksum
tCRCValue initial_value
 initial value of the CRC checksum
tCRCValue const * crc_table
 table with precalculated CRC values

Detailed Description

Cyclic Redundancy Code checker class, used for protecting communication against transmission errors.

Generic class to calculate a CRC using a given, precalculated table.

Use derived classes like cCRC_DSACON32m with a specifically set CRC table.


Constructor & Destructor Documentation

SDH::cCRC::cCRC ( tCRCValue const *  _crc_table,
tCRCValue  _initial_value 
) [inline]

constructor: create a new cCRC object and initialize the current value of the CRC checksum. crc_table is the CRC table to use.


Member Function Documentation

tCRCValue SDH::cCRC::AddByte ( unsigned char  byte) [inline]

insert byte into CRC calculation and return the new current CRC checksum

tCRCValue SDH::cCRC::AddBytes ( unsigned char *  bytes,
int  nb_bytes 
) [inline]

insert nb_bytes from bytes into CRC calculation and return the new current CRC checksum

tCRCValue SDH::cCRC::GetCRC ( ) [inline]

return the current CRC value

UInt8 SDH::cCRC::GetCRC_HB ( ) [inline]

return the high byte of the current CRC value

UInt8 SDH::cCRC::GetCRC_LB ( ) [inline]

return the low byte of the current CRC value

tCRCValue SDH::cCRC::Reset ( ) [inline]

reset the current CRC value to its initial value and return it;


Member Data Documentation

tCRCValue const* SDH::cCRC::crc_table [protected]

table with precalculated CRC values

current value of the CRC checksum

initial value of the CRC checksum


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