semf
crc.h
Go to the documentation of this file.
1
10#ifndef SEMF_APP_PROCESSING_CRC_H_
11#define SEMF_APP_PROCESSING_CRC_H_
12
13#include <cstddef>
14#include <cstdint>
15
16namespace semf
17{
18namespace app
19{
23class Crc
24{
25public:
26 virtual ~Crc() = default;
27
32 virtual void reset() = 0;
43 virtual const uint8_t* accumulate(const uint8_t data[], size_t size) = 0;
52 virtual const uint8_t* calculate(const uint8_t data[], size_t size) = 0;
58 virtual bool isEqual(const uint8_t data[]) = 0;
63 virtual size_t bitSize() const = 0;
68 virtual size_t byteSize() const = 0;
69};
70} /* namespace app */
71} /* namespace semf */
72#endif /* SEMF_APP_PROCESSING_CRC_H_ */
Interface for implementing cyclic redundancy check (CRC).
Definition: crc.h:24
virtual ~Crc()=default
virtual bool isEqual(const uint8_t data[])=0
Checks if previously calculated CRC is equal to the input value.
virtual const uint8_t * accumulate(const uint8_t data[], size_t size)=0
Computes the CRC of the input data using a combination of the previous CRC value and the new one.
virtual void reset()=0
Resets internal values to their initial values.
virtual const uint8_t * calculate(const uint8_t data[], size_t size)=0
Calculates the CRC of the input data.
virtual size_t bitSize() const =0
Returns the size of the CRC in bits.
virtual size_t byteSize() const =0
Returns the size of the CRC in bytes.