IT++ Logo Newcom Logo

crc.h

Go to the documentation of this file.
00001 
00033 #ifndef CRC_H
00034 #define CRC_H
00035 
00036 #include <itpp/base/vec.h>
00037 #include <itpp/base/mat.h>
00038 
00039 
00040 namespace itpp {
00041 
00067   class CRC_Code {
00068   public:
00069 
00071     CRC_Code() { reverse_parity = false; }
00072 
00080     CRC_Code(const std::string &code) { reverse_parity = false; set_code(code); }
00081 
00083     void set_generator(const bvec &poly);
00084 
00086     void set_code(const std::string &code);
00087 
00089     void parity(const bvec &in_bits, bvec &out);
00090 
00092     bool check_parity(const bvec &coded_bits);
00093 
00095     void encode(const bvec &in_bits, bvec &out);
00096 
00098     bvec encode(const bvec &in_bits);
00099 
00101     bool decode(const bvec &coded_bits, bvec &out);
00102 
00104     bool decode(bvec &bits);
00105 
00106   private:
00107     bool reverse_parity;
00108     bvec polynomial;
00109     int no_parity;
00110   };
00111 
00112 } // namespace itpp
00113 
00114 #endif // #ifndef CRC_H
SourceForge Logo

Generated on Wed Mar 21 12:21:41 2007 for IT++ by Doxygen 1.4.7