00001 00030 #ifndef CRC_H 00031 #define CRC_H 00032 00033 #include <itpp/base/vec.h> 00034 #include <itpp/base/mat.h> 00035 00036 00037 namespace itpp { 00038 00064 class CRC_Code { 00065 public: 00066 00068 CRC_Code() { reverse_parity = false; } 00069 00077 CRC_Code(const std::string &code) { reverse_parity = false; set_code(code); } 00078 00080 void set_generator(const bvec &poly); 00081 00083 void set_code(const std::string &code); 00084 00086 void parity(const bvec &in_bits, bvec &out) const; 00087 00089 bool check_parity(const bvec &coded_bits) const; 00090 00092 void encode(const bvec &in_bits, bvec &out) const; 00093 00095 bvec encode(const bvec &in_bits) const; 00096 00098 bool decode(const bvec &coded_bits, bvec &out) const; 00099 00101 bool decode(bvec &bits) const; 00102 00103 private: 00104 bool reverse_parity; 00105 bvec polynomial; 00106 int no_parity; 00107 }; 00108 00109 } // namespace itpp 00110 00111 #endif // #ifndef CRC_H
Generated on Sat Apr 19 10:43:53 2008 for IT++ by Doxygen 1.5.5