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 
36 namespace itpp
37 {
38 
64 class ITPP_EXPORT CRC_Code
65 {
66 public:
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 
104 private:
105  bool reverse_parity;
106  bvec polynomial;
107  int no_parity;
108 };
109 
110 } // namespace itpp
111 
112 #endif // #ifndef CRC_H
CRC_Code()
Default Constructor.
Definition: crc.h:69
Cyclic Redundancy Check Codes.
Definition: crc.h:64
CRC_Code(const std::string &code)
Set CRC code to one of the standardpolynomials using the string value.
Definition: crc.h:78
Matrix Class Definitions.
itpp namespace
Definition: itmex.h:36
void poly(const vec &r, vec &p)
Create a polynomial of the given rootsCreate a polynomial p with roots r.
Definition: poly.cpp:40
Templated Vector Class Definitions.
SourceForge Logo

Generated on Sun Apr 10 2022 12:00:00 for IT++ by Doxygen 1.8.14