Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

crc.h

Go to the documentation of this file.
00001 // 
00002 // SPUC - Signal processing using C++ - A DSP library
00003 /*---------------------------------------------------------------------------*
00004  *                                   IT++                                    *
00005  *---------------------------------------------------------------------------*
00006  * Copyright (c) 1995-2002 by Tony Ottosson, Thomas Eriksson, Pål Frenger,   *
00007  * Tobias Ringström, and Jonas Samuelsson.                                   *
00008  *                                                                           *
00009  * Permission to use, copy, modify, and distribute this software and its     *
00010  * documentation under the terms of the GNU General Public License is hereby *
00011  * granted. No representations are made about the suitability of this        *
00012  * software for any purpose. It is provided "as is" without expressed or     *
00013  * implied warranty. See the GNU General Public License for more details.    *
00014  *---------------------------------------------------------------------------*/
00015 
00026 #ifndef __crc_h
00027 #define __crc_h
00028 
00029 #include <vector.h>
00030 #include <matrix.h>
00031 #include <string>
00032 namespace SPUC {
00056 //using namespace std;
00057 class CRC_Code {
00058  public:
00059 
00061   CRC_Code() { reverse_parity = false; }
00062 
00068   CRC_Code(const string &code) { reverse_parity = false; set_code(code); }
00069 
00071   void set_generator(const bvec &poly);
00072 
00074   void set_code(const string &code);
00075 
00077   void parity(const bvec &in_bits, bvec &out);
00078 
00080   bool check_parity(const bvec &coded_bits);
00081 
00083   void encode(const bvec &in_bits, bvec &out);
00084 
00086   bvec encode(const bvec &in_bits);
00087 
00089   bool decode(const bvec &coded_bits, bvec &out);
00090 
00092   bool decode(bvec &bits);
00093 
00094  private:
00095   bool reverse_parity;
00096   bvec polynomial;
00097   int no_parity;
00098 };
00099 } 
00100 #endif // __crc_h

Generated on Fri Sep 16 11:02:19 2005 for spuc by  doxygen 1.4.4