IT++ Logo
crc.h
Go to the documentation of this file.
1
29#ifndef CRC_H
30#define CRC_H
31
32#include <itpp/base/vec.h>
33#include <itpp/base/mat.h>
34#include <itpp/itexports.h>
35
36namespace itpp
37{
38
64class ITPP_EXPORT CRC_Code
65{
66public:
67
69 CRC_Code() { reverse_parity = false; }
70
78 CRC_Code(const std::string &code) { reverse_parity = false; set_code(code); }
79
81 void set_generator(const bvec &poly);
82
84 void set_code(const std::string &code);
85
87 void parity(const bvec &in_bits, bvec &out) const;
88
90 bool check_parity(const bvec &coded_bits) const;
91
93 void encode(const bvec &in_bits, bvec &out) const;
94
96 bvec encode(const bvec &in_bits) const;
97
99 bool decode(const bvec &coded_bits, bvec &out) const;
100
102 bool decode(bvec &bits) const;
103
104private:
105 bool reverse_parity;
106 bvec polynomial;
107 int no_parity;
108};
109
110} // namespace itpp
111
112#endif // #ifndef CRC_H
Cyclic Redundancy Check Codes.
Definition crc.h:65
CRC_Code(const std::string &code)
Set CRC code to one of the standardpolynomials using the string value.
Definition crc.h:78
CRC_Code()
Default Constructor.
Definition crc.h:69
Matrix Class Definitions.
itpp namespace
Definition itmex.h:37
Templated Vector Class Definitions.
SourceForge Logo

Generated on Tue Dec 10 2024 04:49:37 for IT++ by Doxygen 1.12.0