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
SourceForge Logo

Generated on Sat May 25 2013 16:32:20 for IT++ by Doxygen 1.8.2