Template Class crc#
Defined in File crc.h
Class Documentation#
-
template<typename TCRC, TCRC tPolynomial, TCRC tInitVal, TCRC tXorOut, bool bReflectIn, bool bReflectOut>
class crc# Templated CRC calculation class.
- Template Parameters:
TCRC – The CRC type to use for the calculation.
tPolynomial – The polynomial of the CRC function.
tInitVal – The initial value to use for the calculation.
tXorOut – XOR the result with the provided value.
bReflectIn – Reflect the input bits.
bReflectOut – Reflect the output bits.
Public Functions
-
template<typename T>
TCRCType calc_checksum(const T *pData, size_t nCount) noexcept# Calculate the CRC checksum value providing a buffer with data of type T.
Remark
The CRC calculation occurs byte-wise regardless of the endianness of the the processor architecture.
- Attention
This function doesn’t reset the CRC that was calculated before.
- Template Parameters:
T – Type of the value buffer to calculate the CRC for.
- Parameters:
pData – [in] Pointer to the value buffer.
nCount – [in] Amount of values in the buffer.
- Returns:
The calculated CRC checksum.
-
template<typename T>
inline void add(T tValue) noexcept# Add one value to the calculation.
Remark
The CRC calculation occurs byte-wise regardless of the endianness of the the processor architecture.
- Template Parameters:
T – Type of the value buffer to calculate the CRC for.
- Parameters:
tValue – [in] The value to add to the calculation.
-
inline TCRCType get_checksum() const noexcept#
Get the currently calculated checksum.
- Returns:
The CRC checksum.
-
inline void set_checksum(TCRCType tCrcValue) noexcept#
Set a CRC checksum to continue the calculation with additional data.
- Parameters:
tCrcValue – [in] The previously calculated CRC value.
-
inline void reset() noexcept#
Reset the current calculation (resets the CRC value to its initial value).