ldas-tools-framecpp 3.0.4
Loading...
Searching...
No Matches
FrameCPP::Common::cksum_impl< CRC > Class Template Reference

Compute CRC checksum with length encoding. More...

#include <cksum.hh>

Inheritance diagram for FrameCPP::Common::cksum_impl< CRC >:
Collaboration diagram for FrameCPP::Common::cksum_impl< CRC >:

Public Types

typedef CRC crc_type
 CRC algorithm.
 
typedef std::size_t size_type
 Type which holds the number of bytes processed.
 
typedef uint32_t value_type
 Type to hold the calculated checksum.
 

Public Member Functions

void process_bytes (void const *buffer, size_type byte_count)
 Updates the interim CRC.
 
value_type checksum () const
 Retrieve the CRC value.
 
void reset ()
 Allow the stucture to be reused.
 
void process_bytes (void const *buffer, size_type byte_count)
 Updates the interim CRC.
 
value_type checksum () const
 Retrieve the CRC value.
 
void reset ()
 Allow the stucture to be reused.
 

Private Member Functions

void finalize ()
 Finish calculating the checksum.
 
void finalize ()
 Finish calculating the checksum.
 

Private Attributes

size_type length = 0
 Number of bytes processed.
 
bool finished = false
 Keep track of state.
 

Detailed Description

template<typename CRC>
class FrameCPP::Common::cksum_impl< CRC >

Compute CRC checksum with length encoding.


This implements the calculation of a CRC checksum with

the addition of the number of bytes at the end.


This implements the calculation of a CRC checksum with

the addition of the number of bytes at the end.

Member Typedef Documentation

◆ crc_type

template<typename CRC >
typedef CRC FrameCPP::Common::cksum_impl< CRC >::crc_type

CRC algorithm.

◆ size_type

template<typename CRC >
typedef std::size_t FrameCPP::Common::cksum_impl< CRC >::size_type

Type which holds the number of bytes processed.

◆ value_type

template<typename CRC >
typedef uint32_t FrameCPP::Common::cksum_impl< CRC >::value_type

Type to hold the calculated checksum.

Member Function Documentation

◆ checksum() [1/2]

template<typename CRC >
value_type FrameCPP::Common::cksum_impl< CRC >::checksum ( ) const
inline

Retrieve the CRC value.


Returns

The calculated CRC value

◆ checksum() [2/2]

template<typename CRC >
value_type FrameCPP::Common::cksum_impl< CRC >::checksum ( ) const
inline

Retrieve the CRC value.


Returns

The calculated CRC value

◆ finalize() [1/2]

template<typename CRC >
void FrameCPP::Common::cksum_impl< CRC >::finalize ( )
inlineprivate

Finish calculating the checksum.


As part of calculating the checksum, the length is

added to final calculation

◆ finalize() [2/2]

template<typename CRC >
void FrameCPP::Common::cksum_impl< CRC >::finalize ( )
inlineprivate

Finish calculating the checksum.


As part of calculating the checksum, the length is

added to final calculation

◆ process_bytes() [1/2]

template<typename CRC >
void FrameCPP::Common::cksum_impl< CRC >::process_bytes ( void const * buffer,
size_type byte_count )
inline

Updates the interim CRC.


Parameters
[in]bufferBuffer of bytes to be applied to the interim CRC
[in]byte_count

Number of bytes in buffer to be applied to the interim CRC

◆ process_bytes() [2/2]

template<typename CRC >
void FrameCPP::Common::cksum_impl< CRC >::process_bytes ( void const * buffer,
size_type byte_count )
inline

Updates the interim CRC.


Parameters
[in]bufferBuffer of bytes to be applied to the interim CRC
[in]byte_count

Number of bytes in buffer to be applied to the interim CRC

◆ reset() [1/2]

template<typename CRC >
void FrameCPP::Common::cksum_impl< CRC >::reset ( )
inline

Allow the stucture to be reused.


This method resets the CRC state back to its initial configuration allowing it to be used to calculate

a new CRC checksum.

◆ reset() [2/2]

template<typename CRC >
void FrameCPP::Common::cksum_impl< CRC >::reset ( )
inline

Allow the stucture to be reused.


This method resets the CRC state back to its initial configuration allowing it to be used to calculate

a new CRC checksum.

Member Data Documentation

◆ finished

template<typename CRC >
bool FrameCPP::Common::cksum_impl< CRC >::finished = false
private

Keep track of state.

◆ length

template<typename CRC >
size_type FrameCPP::Common::cksum_impl< CRC >::length = 0
private

Number of bytes processed.


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