CRC32_RK
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes
CRC32_RK::State Class Reference

Class to allow calculation across multiple buffers. More...

#include <CRC32_RK.h>

Public Member Functions

 State ()
 Construct the State object for holding the CRC state.
 
virtual ~State ()
 Destructor. This object does not have any externally allocated data and the destructor is trivial.
 
uint32_t calculate (const unsigned char *buf, size_t len)
 Calculate the CRC32 for a buffer of data.
 
void clear ()
 Clear the state to be the same as when a new object is created.
 
 State (const State &other)
 Copies the state from another object during construction.
 
Stateoperator= (const State &other)
 Copy the state from another object into this object.
 
bool operator== (const State &other) const
 Returns true if this object and other have the same CRC state.
 

Protected Attributes

uint32_t crc = 0xffffffff
 The current CRC state. This is not the same as the result from calculate!
 

Detailed Description

Class to allow calculation across multiple buffers.

Call the calculate() method to add a buffer. Returns the CRC to that point.

See also the static calculate() method in the CRC32_RK class that does not require creating a State object.

Constructor & Destructor Documentation

◆ State()

CRC32_RK::State::State ( const State & other)
inline

Copies the state from another object during construction.

Parameters
other

Member Function Documentation

◆ calculate()

uint32_t CRC32_RK::State::calculate ( const unsigned char * buf,
size_t len )

Calculate the CRC32 for a buffer of data.

Parameters
bufPointer to a buffer to calculate the CRC for. Cannot be null.
lenThe length of the buffer in bytes
Returns
uint32_t The CRC32 of the data thus far

The State object contains the current CRC32 being calculated. You can call calculate multiple times on a single State instance to calculate the CRC for the entire data in chunks.

◆ operator=()

State & CRC32_RK::State::operator= ( const State & other)
inline

Copy the state from another object into this object.

Parameters
other
Returns
State&

◆ operator==()

bool CRC32_RK::State::operator== ( const State & other) const
inline

Returns true if this object and other have the same CRC state.

Parameters
other
Returns
true
false

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