summaryrefslogtreecommitdiff
path: root/gr-error-correcting-codes/src/lib/libecc/encoder.h
diff options
context:
space:
mode:
authorjcorgan2006-08-04 16:07:06 +0000
committerjcorgan2006-08-04 16:07:06 +0000
commitc5b588b8f182374d83918d810e6c59b3bd804d7e (patch)
treeb6a57dd725e90f559427778bc5ac6429b336889d /gr-error-correcting-codes/src/lib/libecc/encoder.h
parent79cf92c9a63c1887693cdff226aca116fc89ea95 (diff)
downloadgnuradio-c5b588b8f182374d83918d810e6c59b3bd804d7e.tar.gz
gnuradio-c5b588b8f182374d83918d810e6c59b3bd804d7e.tar.bz2
gnuradio-c5b588b8f182374d83918d810e6c59b3bd804d7e.zip
Merge CVS changes from FIRST_MIGRATION_2006_07_26 into trunk.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@3138 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-error-correcting-codes/src/lib/libecc/encoder.h')
-rw-r--r--gr-error-correcting-codes/src/lib/libecc/encoder.h60
1 files changed, 39 insertions, 21 deletions
diff --git a/gr-error-correcting-codes/src/lib/libecc/encoder.h b/gr-error-correcting-codes/src/lib/libecc/encoder.h
index 2c3dde13a..96ff9f411 100644
--- a/gr-error-correcting-codes/src/lib/libecc/encoder.h
+++ b/gr-error-correcting-codes/src/lib/libecc/encoder.h
@@ -23,50 +23,68 @@
#ifndef INCLUDED_ENCODER_H
#define INCLUDED_ENCODER_H
-#include "code_types.h"
-
-// the 'encoder' class is a virtual class upon which all encoder types
-// can be built.
+#include "code_io.h"
class encoder
{
+ /*
+ * class encoder
+ * A virtual class upon which all encoder types can be built.
+ * This class provides the basic methods and variables
+ * generic for all encoders.
+ */
public:
encoder () {};
virtual ~encoder () {};
+ /*
+ * compute_n_...: to be defined by inheriting classes, in order to
+ * allow for user-functions to figure out how many inputs are
+ * required to generate a given number of outputs, and vice versa.
+ * Can't define them without knowing the encoder type.
+ *
+ * Compute the number of input bits needed to produce 'n_output' bits,
+ * and the number of output bits which will be produced by 'n_input'
+ * bits ... for a single stream only.
+ */
+
virtual size_t compute_n_input_bits (size_t n_output_bits) = 0;
virtual size_t compute_n_output_bits (size_t n_input_bits) = 0;
- virtual size_t encode (const char** in_buf,
- char** out_buf,
+
+ /*
+ * encode: given the input and output buffers, either encode up to
+ * the number of output bits or encode the number of input bits
+ * ... if the buffers support either encoding amounts.
+ */
+
+ virtual size_t encode (const code_input_ptr in_buf,
+ code_output_ptr out_buf,
size_t n_bits_to_output);
- virtual size_t encode (const char** in_buf,
+ virtual size_t encode (const code_input_ptr in_buf,
size_t n_bits_to_input,
- char** out_buf);
+ code_output_ptr out_buf);
/* for remote access to internal info */
- inline size_t block_size_bits () {return (d_block_size_bits);};
- inline size_t n_code_inputs () {return (d_n_code_inputs);};
- inline size_t n_code_outputs () {return (d_n_code_outputs);};
+ inline const size_t block_size_bits () {return (d_block_size_bits);};
+ inline const size_t n_code_inputs () {return (d_n_code_inputs);};
+ inline const size_t n_code_outputs () {return (d_n_code_outputs);};
+ inline const size_t total_n_enc_bits () {return (d_total_n_enc_bits);};
protected:
- /* encode_private: encode the given in_buf and write the output bits
+ /*
+ * encode_private: encode the given in_buf and write the output bits
* to the out_buf, using internal class variables. This function is
* called from the publically available "encode()" methods, which
* first set the internal class variables before executing.
*/
- virtual void encode_private (const char** in_buf, char** out_buf) = 0;
-
- /* inheriting methods need to figure out what makes the most sense
- * for them in terms of getting new inputs and writing outputs.
- */
+ virtual void encode_private () = 0;
size_t d_block_size_bits, d_n_code_inputs, d_n_code_outputs;
- size_t d_n_enc_bits, d_total_n_enc_bits;
- size_t d_in_buf_ndx, d_out_buf_ndx;
- size_t d_in_bit_shift, d_out_bit_shift;
- size_t d_n_input_bits_left, d_n_output_bits_left;
+ size_t d_total_n_enc_bits;
+ code_input_ptr d_in_buf;
+ code_output_ptr d_out_buf;
};
#endif /* INCLUDED_ENCODER_H */