IT++ Logo
channel_code.h
Go to the documentation of this file.
1 
29 #ifndef CHANNEL_CODE_H
30 #define CHANNEL_CODE_H
31 
32 #include <itpp/base/vec.h>
33 #include <itpp/comm/modulator.h>
34 #include <itpp/itexports.h>
35 
36 namespace itpp
37 {
38 
43 //---------------------- BCH --------------------------------------
44 
50 class ITPP_EXPORT Channel_Code
51 {
52 public:
56  virtual ~Channel_Code() {}
57 
59  virtual void encode(const bvec &uncoded_bits, bvec &coded_bits) = 0;
61  virtual bvec encode(const bvec &uncoded_bits) = 0;
62 
64  virtual void decode(const bvec &codedbits, bvec &decoded_bits) = 0;
66  //virtual bvec decode(const bvec &coded_bits);
67  virtual bvec decode(const bvec &coded_bits) = 0;
68 
70  virtual void decode(const vec &received_signal, bvec &decoded_bits) = 0;
72  //virtual bvec decode(const vec &received_signal);
73  virtual bvec decode(const vec &received_signal) = 0;
74 
76  virtual double get_rate() const = 0;
77 };
78 
79 
86 class ITPP_EXPORT Dummy_Code : public Channel_Code
87 {
88 public:
92  virtual ~Dummy_Code() {}
93 
95  virtual void encode(const bvec &uncoded_bits, bvec &coded_bits) { coded_bits = uncoded_bits; }
97  virtual bvec encode(const bvec &uncoded_bits) { return uncoded_bits; }
98 
100  virtual void decode(const bvec &coded_bits, bvec &decoded_bits) { decoded_bits = coded_bits; }
102  virtual bvec decode(const bvec &coded_bits) { return coded_bits; }
103 
105  virtual void decode(const vec &received_signal, bvec &decoded_bits) { BPSK bpsk; bpsk.demodulate_bits(received_signal, decoded_bits); }
107  virtual bvec decode(const vec &received_signal) { bvec out; decode(received_signal, out); return out; }
108 
110  virtual double get_rate() const { return 1.0; }
111 };
112 
113 
114 
115 } // namespace itpp
116 
117 #endif // #ifndef CHANNEL_CODE_H
SourceForge Logo

Generated on Sat Jul 6 2013 10:54:22 for IT++ by Doxygen 1.8.2