00001 // 00002 // SPUC - Signal processing using C++ - A DSP library 00003 /*---------------------------------------------------------------------------* 00004 * IT++ * 00005 *---------------------------------------------------------------------------* 00006 * Copyright (c) 1995-2001 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 __hamming_h 00027 #define __hamming_h 00028 00029 #include <vector.h> 00030 #include <matrix.h> 00031 namespace SPUC { 00036 class Hamming_Code { 00037 public: 00039 Hamming_Code(short m); 00041 bvec encode(const bvec &uncoded_bits); 00043 bvec decode(const bvec &coded_bits); 00045 short get_n() { return n; }; 00047 short get_k() { return k; }; 00049 bmat get_H() { return H; }; 00051 bmat get_G() { return G; }; 00052 private: 00053 short n, k; 00054 bmat H, G; 00055 void generate_H(void); 00056 void generate_G(void); 00057 }; 00058 } 00059 #endif // __hamming_h