summaryrefslogtreecommitdiff
path: root/gr-trellis/lib
diff options
context:
space:
mode:
authorMarcus Müller <marcus@hostalia.de>2018-08-31 23:02:22 +0200
committerMarcus Müller <marcus@hostalia.de>2018-08-31 23:02:22 +0200
commit254fe5e89403d4de1fa6663d09efdf946996aff3 (patch)
tree62877d7ac7fdedf6c397c51e22ac6f97eba97ddf /gr-trellis/lib
parent896d1c9da31963ecf5b0d90942c2af51ca998a69 (diff)
parent5ad935c3a3dd46ce2860b13e2b774e4841784616 (diff)
Merge remote-tracking branch 'origin/next' into merge_next
Diffstat (limited to 'gr-trellis/lib')
-rw-r--r--gr-trellis/lib/CMakeLists.txt36
-rw-r--r--gr-trellis/lib/encoder_XX_impl.cc.t118
-rw-r--r--gr-trellis/lib/encoder_impl.cc131
-rw-r--r--gr-trellis/lib/encoder_impl.h (renamed from gr-trellis/lib/encoder_XX_impl.h.t)21
-rw-r--r--gr-trellis/lib/metrics_impl.cc (renamed from gr-trellis/lib/metrics_X_impl.cc.t)76
-rw-r--r--gr-trellis/lib/metrics_impl.h (renamed from gr-trellis/lib/metrics_X_impl.h.t)24
-rw-r--r--gr-trellis/lib/pccc_decoder_blk_impl.cc (renamed from gr-trellis/lib/pccc_decoder_X_impl.cc.t)41
-rw-r--r--gr-trellis/lib/pccc_decoder_blk_impl.h (renamed from gr-trellis/lib/pccc_decoder_X_impl.h.t)18
-rw-r--r--gr-trellis/lib/pccc_decoder_combined_blk_impl.cc (renamed from gr-trellis/lib/pccc_decoder_combined_XX_impl.cc.t)61
-rw-r--r--gr-trellis/lib/pccc_decoder_combined_blk_impl.h (renamed from gr-trellis/lib/pccc_decoder_combined_XX_impl.h.t)25
-rw-r--r--gr-trellis/lib/pccc_encoder_impl.cc (renamed from gr-trellis/lib/pccc_encoder_XX_impl.cc.t)42
-rw-r--r--gr-trellis/lib/pccc_encoder_impl.h (renamed from gr-trellis/lib/pccc_encoder_XX_impl.h.t)19
-rw-r--r--gr-trellis/lib/sccc_decoder_blk_impl.cc (renamed from gr-trellis/lib/sccc_decoder_X_impl.cc.t)41
-rw-r--r--gr-trellis/lib/sccc_decoder_blk_impl.h (renamed from gr-trellis/lib/sccc_decoder_X_impl.h.t)18
-rw-r--r--gr-trellis/lib/sccc_decoder_combined_blk_impl.cc (renamed from gr-trellis/lib/sccc_decoder_combined_XX_impl.cc.t)62
-rw-r--r--gr-trellis/lib/sccc_decoder_combined_blk_impl.h (renamed from gr-trellis/lib/sccc_decoder_combined_XX_impl.h.t)25
-rw-r--r--gr-trellis/lib/sccc_encoder_impl.cc (renamed from gr-trellis/lib/sccc_encoder_XX_impl.cc.t)44
-rw-r--r--gr-trellis/lib/sccc_encoder_impl.h (renamed from gr-trellis/lib/sccc_encoder_XX_impl.h.t)19
-rw-r--r--gr-trellis/lib/siso_combined_f_impl.cc48
-rw-r--r--gr-trellis/lib/siso_f_impl.cc24
-rw-r--r--gr-trellis/lib/viterbi_combined_XX_impl.cc.t155
-rw-r--r--gr-trellis/lib/viterbi_combined_impl.cc176
-rw-r--r--gr-trellis/lib/viterbi_combined_impl.h (renamed from gr-trellis/lib/viterbi_combined_XX_impl.h.t)27
-rw-r--r--gr-trellis/lib/viterbi_impl.cc (renamed from gr-trellis/lib/viterbi_X_impl.cc.t)83
-rw-r--r--gr-trellis/lib/viterbi_impl.h (renamed from gr-trellis/lib/viterbi_X_impl.h.t)18
25 files changed, 718 insertions, 634 deletions
diff --git a/gr-trellis/lib/CMakeLists.txt b/gr-trellis/lib/CMakeLists.txt
index a5b3cf019c..968de82879 100644
--- a/gr-trellis/lib/CMakeLists.txt
+++ b/gr-trellis/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012,2014 Free Software Foundation, Inc.
+# Copyright 2012,2014,2018 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -34,36 +34,30 @@ if(ENABLE_GR_CTRLPORT)
ADD_DEFINITIONS(-DGR_CTRLPORT)
endif(ENABLE_GR_CTRLPORT)
-#######################################################################
-# Invoke macro to generate various sources and headers
-########################################################################
-include(GrMiscUtils)
-GR_EXPAND_X_CC_H(trellis encoder_XX_impl bb bs bi ss si ii)
-GR_EXPAND_X_CC_H(trellis sccc_encoder_XX_impl bb bs bi ss si ii)
-GR_EXPAND_X_CC_H(trellis pccc_encoder_XX_impl bb bs bi ss si ii)
-GR_EXPAND_X_CC_H(trellis metrics_X_impl s i f c)
-GR_EXPAND_X_CC_H(trellis viterbi_X_impl b s i)
-GR_EXPAND_X_CC_H(trellis viterbi_combined_XX_impl sb ss si ib is ii fb fs fi cb cs ci)
-GR_EXPAND_X_CC_H(trellis sccc_decoder_X_impl b s i)
-GR_EXPAND_X_CC_H(trellis sccc_decoder_combined_XX_impl fb fs fi cb cs ci)
-GR_EXPAND_X_CC_H(trellis pccc_decoder_X_impl b s i)
-GR_EXPAND_X_CC_H(trellis pccc_decoder_combined_XX_impl fb fs fi cb cs ci)
-
########################################################################
# Setup library
########################################################################
list(APPEND trellis_sources
- ${generated_sources}
base.cc
calc_metric.cc
core_algorithms.cc
+ encoder_impl.cc
fsm.cc
interleaver.cc
quicksort_index.cc
constellation_metrics_cf_impl.cc
+ metrics_impl.cc
+ pccc_decoder_blk_impl.cc
+ pccc_encoder_impl.cc
+ pccc_decoder_combined_blk_impl.cc
permutation_impl.cc
+ sccc_decoder_blk_impl.cc
+ sccc_decoder_combined_blk_impl.cc
+ sccc_encoder_impl.cc
siso_f_impl.cc
siso_combined_f_impl.cc
+ viterbi_impl.cc
+ viterbi_combined_impl.cc
)
list(APPEND trellis_libs
@@ -88,9 +82,9 @@ ENDIF(MSVC)
add_library(gnuradio-trellis SHARED ${trellis_sources})
target_link_libraries(gnuradio-trellis ${trellis_libs})
-GR_LIBRARY_FOO(gnuradio-trellis RUNTIME_COMPONENT "trellis_runtime" DEVEL_COMPONENT "trellis_devel")
+GR_LIBRARY_FOO(gnuradio-trellis)
add_dependencies(gnuradio-trellis
- trellis_generated_includes trellis_generated_swigs
+ trellis_generated_swigs
gnuradio-runtime gnuradio-digital)
if(ENABLE_STATIC_LIBS)
@@ -108,7 +102,7 @@ if(ENABLE_STATIC_LIBS)
add_library(gnuradio-trellis_static STATIC ${trellis_sources})
add_dependencies(gnuradio-trellis_static
- trellis_generated_includes trellis_generated_swigs
+ trellis_generated_swigs
gnuradio-runtime_static gnuradio-digital_static
)
@@ -118,6 +112,6 @@ if(ENABLE_STATIC_LIBS)
endif(NOT WIN32)
install(TARGETS gnuradio-trellis_static
- ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "trellis_devel" # .lib file
+ ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
)
endif(ENABLE_STATIC_LIBS)
diff --git a/gr-trellis/lib/encoder_XX_impl.cc.t b/gr-trellis/lib/encoder_XX_impl.cc.t
deleted file mode 100644
index 3a004a2f94..0000000000
--- a/gr-trellis/lib/encoder_XX_impl.cc.t
+++ /dev/null
@@ -1,118 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "@NAME@.h"
-#include <gnuradio/io_signature.h>
-#include <iostream>
-
-namespace gr {
- namespace trellis {
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const fsm &FSM, int ST)
- {
- return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(FSM,ST,0,false));
- }
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const fsm &FSM, int ST, int K)
- {
- return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(FSM,ST,K,true));
- }
-
- @IMPL_NAME@::@IMPL_NAME@(const fsm &FSM, int ST, int K, bool B)
- : sync_block("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)),
- io_signature::make(1, 1, sizeof(@O_TYPE@))),
- d_FSM(FSM),
- d_ST(ST),
- d_K(K),
- d_B(B)
- {
- }
-
- void @IMPL_NAME@::set_FSM(const fsm &FSM)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_FSM = FSM;
- }
-
- void @IMPL_NAME@::set_ST(int ST)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_ST = ST;
- }
-
- void @IMPL_NAME@::set_K(int K)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_K = K;
- }
-
- @IMPL_NAME@::~@IMPL_NAME@()
- {
- }
-
- int
- @IMPL_NAME@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- gr::thread::scoped_lock guard(d_setlock);
- int ST_tmp = 0;
-
- if (d_B){ // blockwise operation
- int nblocks = noutput_items /d_K;
- const @I_TYPE@ *in = (const @I_TYPE@*)input_items[0];
- @O_TYPE@ *out = (@O_TYPE@ *) output_items[0];
- for(int n = 0; n < nblocks; n++) {
- ST_tmp = d_ST;
- for(int i = 0; i < d_K; i++) {
- out[n*d_K+i] = (@O_TYPE@)d_FSM.OS()[ST_tmp*d_FSM.I()+in[n*d_K+i]];
- ST_tmp = (int)d_FSM.NS()[ST_tmp*d_FSM.I()+in[n*d_K+i]];
- }
- }
- return nblocks*d_K;
- } // end blockwise operation
- else{ // streaming operation
- const @I_TYPE@ *in = (const @I_TYPE@*)input_items[0];
- @O_TYPE@ *out = (@O_TYPE@ *) output_items[0];
- ST_tmp = d_ST;
- for(int i = 0; i < noutput_items; i++) {
- out[i] = (@O_TYPE@)d_FSM.OS()[ST_tmp*d_FSM.I()+in[i]];
- ST_tmp = (int)d_FSM.NS()[ST_tmp*d_FSM.I()+in[i]];
- }
- d_ST = ST_tmp;
- return noutput_items;
- } // end streaming operation
- }
-
- } /* namespace trellis */
-} /* namespace gr */
diff --git a/gr-trellis/lib/encoder_impl.cc b/gr-trellis/lib/encoder_impl.cc
new file mode 100644
index 0000000000..ecb0410a5f
--- /dev/null
+++ b/gr-trellis/lib/encoder_impl.cc
@@ -0,0 +1,131 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "encoder_impl.h"
+#include <gnuradio/io_signature.h>
+#include <iostream>
+
+namespace gr {
+ namespace trellis {
+
+ template <class IN_T, class OUT_T>
+ typename encoder<IN_T,OUT_T>::sptr
+ encoder<IN_T,OUT_T>::make(const fsm &FSM, int ST)
+ {
+ return gnuradio::get_initial_sptr
+ (new encoder_impl<IN_T,OUT_T>(FSM,ST,0,false));
+ }
+
+ template <class IN_T, class OUT_T>
+ typename encoder<IN_T,OUT_T>::sptr
+ encoder<IN_T,OUT_T>::make(const fsm &FSM, int ST, int K)
+ {
+ return gnuradio::get_initial_sptr
+ (new encoder_impl<IN_T,OUT_T>(FSM,ST,K,true));
+ }
+
+ template <class IN_T, class OUT_T>
+ encoder_impl<IN_T,OUT_T>::encoder_impl(const fsm &FSM, int ST, int K, bool B)
+ : sync_block("encoder<IN_T,OUT_T>",
+ io_signature::make(1, 1, sizeof(IN_T)),
+ io_signature::make(1, 1, sizeof(OUT_T))),
+ d_FSM(FSM),
+ d_ST(ST),
+ d_K(K),
+ d_B(B)
+ {
+ }
+
+ template <class IN_T, class OUT_T>
+ void encoder_impl<IN_T,OUT_T>::set_FSM(const fsm &FSM)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_FSM = FSM;
+ }
+
+ template <class IN_T, class OUT_T>
+ void encoder_impl<IN_T,OUT_T>::set_ST(int ST)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_ST = ST;
+ }
+
+ template <class IN_T, class OUT_T>
+ void encoder_impl<IN_T,OUT_T>::set_K(int K)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_K = K;
+ }
+
+ template <class IN_T, class OUT_T>
+ encoder_impl<IN_T,OUT_T>::~encoder_impl()
+ {
+ }
+
+ template <class IN_T, class OUT_T>
+ int
+ encoder_impl<IN_T,OUT_T>::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ int ST_tmp = 0;
+
+ if (d_B){ // blockwise operation
+ int nblocks = noutput_items /d_K;
+ const IN_T *in = (const IN_T*)input_items[0];
+ OUT_T *out = (OUT_T *) output_items[0];
+ for(int n = 0; n < nblocks; n++) {
+ ST_tmp = d_ST;
+ for(int i = 0; i < d_K; i++) {
+ out[n*d_K+i] = (OUT_T)d_FSM.OS()[ST_tmp*d_FSM.I()+in[n*d_K+i]];
+ ST_tmp = (int)d_FSM.NS()[ST_tmp*d_FSM.I()+in[n*d_K+i]];
+ }
+ }
+ return nblocks*d_K;
+ } // end blockwise operation
+ else{ // streaming operation
+ const IN_T *in = (const IN_T*)input_items[0];
+ OUT_T *out = (OUT_T *) output_items[0];
+ ST_tmp = d_ST;
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = (OUT_T)d_FSM.OS()[ST_tmp*d_FSM.I()+in[i]];
+ ST_tmp = (int)d_FSM.NS()[ST_tmp*d_FSM.I()+in[i]];
+ }
+ d_ST = ST_tmp;
+ return noutput_items;
+ } // end streaming operation
+ }
+ template class encoder<std::uint8_t, std::uint8_t>;
+ template class encoder<std::uint8_t, std::int16_t>;
+ template class encoder<std::uint8_t, std::int32_t>;
+ template class encoder<std::int16_t, std::int16_t>;
+ template class encoder<std::int16_t, std::int32_t>;
+ template class encoder<std::int32_t, std::int32_t>;
+
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/lib/encoder_XX_impl.h.t b/gr-trellis/lib/encoder_impl.h
index 2b0ff31f4d..5832b9d848 100644
--- a/gr-trellis/lib/encoder_XX_impl.h.t
+++ b/gr-trellis/lib/encoder_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,28 +20,27 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
+#ifndef ENCODER_IMPL_H
+#define ENCODER_IMPL_H
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <gnuradio/trellis/@BASE_NAME@.h>
+#include <gnuradio/trellis/encoder.h>
namespace gr {
namespace trellis {
- class @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T, class OUT_T>
+ class encoder_impl : public encoder<IN_T,OUT_T>
{
private:
fsm d_FSM;
int d_ST;
int d_K;
bool d_B;
-
+
public:
- @IMPL_NAME@(const fsm &FSM, int ST, int K, bool B);
- ~@IMPL_NAME@();
+ encoder_impl(const fsm &FSM, int ST, int K, bool B);
+ ~encoder_impl();
fsm FSM() const { return d_FSM;; }
int ST() const { return d_ST; }
@@ -57,4 +56,4 @@ namespace gr {
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* ENCODER_IMPL_H */
diff --git a/gr-trellis/lib/metrics_X_impl.cc.t b/gr-trellis/lib/metrics_impl.cc
index 08dc2d1b17..1ed6c69803 100644
--- a/gr-trellis/lib/metrics_X_impl.cc.t
+++ b/gr-trellis/lib/metrics_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,12 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME@.h"
+#include "metrics_impl.h"
#include <gnuradio/io_signature.h>
#include <assert.h>
#include <stdexcept>
@@ -35,61 +34,69 @@
namespace gr {
namespace trellis {
- @BASE_NAME@::sptr
- @BASE_NAME@::make(int O, int D, const std::vector<@I_TYPE@> &TABLE,
+ template <class T>
+ typename metrics<T>::sptr
+ metrics<T>::make(int O, int D, const std::vector<T> &TABLE,
digital::trellis_metric_type_t TYPE)
{
return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(O,D,TABLE,TYPE));
+ (new metrics_impl<T>(O,D,TABLE,TYPE));
}
- @IMPL_NAME@::@IMPL_NAME@(int O, int D, const std::vector<@I_TYPE@> &TABLE,
+ template <class T>
+ metrics_impl<T>::metrics_impl(int O, int D, const std::vector<T> &TABLE,
digital::trellis_metric_type_t TYPE)
- : block("@BASE_NAME@",
- io_signature::make(1, -1, sizeof (@I_TYPE@)),
+ : block("metrics",
+ io_signature::make(1, -1, sizeof (T)),
io_signature::make(1, -1, sizeof (float))),
d_O(O), d_D(D), d_TYPE(TYPE), d_TABLE(TABLE)
{
- set_relative_rate ((uint64_t)d_O, (uint64_t)d_D);
- set_output_multiple ((int)d_O);
+ this->set_relative_rate ((uint64_t)d_O, (uint64_t)d_D);
+ this->set_output_multiple ((int)d_O);
}
- void @IMPL_NAME@::set_O(int O)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_O = O;
- set_relative_rate ((uint64_t)d_O, (uint64_t)d_D);
- set_output_multiple ((int)d_O);
+ template <class T>
+ void metrics_impl<T>::set_O(int O)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_O = O;
+ this->set_relative_rate ((uint64_t)d_O, (uint64_t)d_D);
+ this->set_output_multiple ((int)d_O);
}
- void @IMPL_NAME@::set_D(int D)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_D = D;
- set_relative_rate ((uint64_t)d_O, (uint64_t)d_D);
+ template <class T>
+ void metrics_impl<T>::set_D(int D)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_D = D;
+ this->set_relative_rate ((uint64_t)d_O, (uint64_t)d_D);
}
+ template <class T>
void
- @IMPL_NAME@::set_TYPE(digital::trellis_metric_type_t type)
+ metrics_impl<T>::set_TYPE(digital::trellis_metric_type_t type)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(this->d_setlock);
d_TYPE = type;
}
+ template <class T>
void
- @IMPL_NAME@::set_TABLE(const std::vector<@I_TYPE@> &table)
+ metrics_impl<T>::set_TABLE(const std::vector<T> &table)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(this->d_setlock);
d_TABLE = table;
}
- @IMPL_NAME@::~@IMPL_NAME@()
+ template <class T>
+ metrics_impl<T>::~metrics_impl()
{
}
+ template <class T>
void
- @IMPL_NAME@::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+ metrics_impl<T>::forecast(int noutput_items, gr_vector_int &ninput_items_required)
{
int input_required = d_D * noutput_items / d_O;
unsigned ninputs = ninput_items_required.size();
@@ -97,17 +104,18 @@ namespace gr {
ninput_items_required[i] = input_required;
}
+ template <class T>
int
- @IMPL_NAME@::general_work(int noutput_items,
+ metrics_impl<T>::general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(this->d_setlock);
int nstreams = input_items.size();
for(int m = 0; m < nstreams; m++) {
- const @I_TYPE@ *in = (@I_TYPE@*)input_items[m];
+ const T *in = (T*)input_items[m];
float *out = (float*)output_items[m];
for(int i = 0; i < noutput_items / d_O ; i++) {
@@ -115,9 +123,13 @@ namespace gr {
}
}
- consume_each(d_D * noutput_items / d_O);
+ this->consume_each(d_D * noutput_items / d_O);
return noutput_items;
}
+template class metrics<std::int16_t>;
+template class metrics<std::int32_t>;
+template class metrics<float>;
+template class metrics<gr_complex>;
} /* namespace trellis */
} /* namespace gr */
diff --git a/gr-trellis/lib/metrics_X_impl.h.t b/gr-trellis/lib/metrics_impl.h
index 9323ae4645..95c5f44845 100644
--- a/gr-trellis/lib/metrics_X_impl.h.t
+++ b/gr-trellis/lib/metrics_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,38 +20,38 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef METRICS_IMPL_H
+#define METRICS_IMPL_H
-#include <gnuradio/trellis/@BASE_NAME@.h>
+#include <gnuradio/trellis/metrics.h>
namespace gr {
namespace trellis {
- class @IMPL_NAME@ : public @BASE_NAME@
+template<class T>
+ class metrics_impl : public metrics<T>
{
private:
int d_O;
int d_D;
digital::trellis_metric_type_t d_TYPE;
- std::vector<@I_TYPE@> d_TABLE;
+ std::vector<T> d_TABLE;
public:
- @IMPL_NAME@(int O, int D, const std::vector<@I_TYPE@> &TABLE,
+ metrics_impl(int O, int D, const std::vector<T> &TABLE,
digital::trellis_metric_type_t TYPE);
- ~@IMPL_NAME@();
+ ~metrics_impl();
int O() const { return d_O; }
int D() const { return d_D; }
digital::trellis_metric_type_t TYPE() const { return d_TYPE; }
- std::vector<@I_TYPE@> TABLE() const { return d_TABLE; }
+ std::vector<T> TABLE() const { return d_TABLE; }
void set_O(int O);
void set_D(int D);
void set_TYPE(digital::trellis_metric_type_t type);
- void set_TABLE(const std::vector<@I_TYPE@> &table);
+ void set_TABLE(const std::vector<T> &table);
void forecast(int noutput_items,
gr_vector_int &ninput_items_required);
@@ -65,4 +65,4 @@ namespace gr {
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* METRICS_IMPL_H */
diff --git a/gr-trellis/lib/pccc_decoder_X_impl.cc.t b/gr-trellis/lib/pccc_decoder_blk_impl.cc
index 14c169272a..b001998416 100644
--- a/gr-trellis/lib/pccc_decoder_X_impl.cc.t
+++ b/gr-trellis/lib/pccc_decoder_blk_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,12 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME@.h"
+#include "pccc_decoder_blk_impl.h"
#include <gnuradio/io_signature.h>
#include <iostream>
#include <gnuradio/trellis/core_algorithms.h>
@@ -34,10 +33,9 @@
namespace gr {
namespace trellis {
- static const float INF = 1.0e9;
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const fsm &FSM1, int ST10, int ST1K,
+ template <class T>
+ typename pccc_decoder_blk<T>::sptr
+ pccc_decoder_blk<T>::make(const fsm &FSM1, int ST10, int ST1K,
const fsm &FSM2, int ST20, int ST2K,
const interleaver &INTERLEAVER,
int blocklength,
@@ -45,7 +43,7 @@ namespace gr {
siso_type_t SISO_TYPE)
{
return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(FSM1, ST10, ST1K,
+ (new pccc_decoder_blk_impl<T>(FSM1, ST10, ST1K,
FSM2, ST20, ST2K,
INTERLEAVER,
blocklength,
@@ -53,15 +51,16 @@ namespace gr {
SISO_TYPE));
}
- @IMPL_NAME@::@IMPL_NAME@(const fsm &FSM1, int ST10, int ST1K,
+ template <class T>
+ pccc_decoder_blk_impl<T>::pccc_decoder_blk_impl(const fsm &FSM1, int ST10, int ST1K,
const fsm &FSM2, int ST20, int ST2K,
const interleaver &INTERLEAVER,
int blocklength,
int repetitions,
siso_type_t SISO_TYPE)
- : block("@BASE_NAME@",
+ : block("pccc_decoder_blk",
io_signature::make(1, 1, sizeof(float)),
- io_signature::make(1, 1, sizeof(@O_TYPE@))),
+ io_signature::make(1, 1, sizeof(T))),
d_FSM1(FSM1), d_ST10(ST10), d_ST1K(ST1K),
d_FSM2(FSM2), d_ST20(ST20), d_ST2K(ST2K),
d_INTERLEAVER(INTERLEAVER),
@@ -69,16 +68,18 @@ namespace gr {
d_repetitions(repetitions),
d_SISO_TYPE(SISO_TYPE)
{
- set_relative_rate (1, (uint64_t)(d_FSM1.O() * d_FSM2.O()));
- set_output_multiple (d_blocklength);
+ this->set_relative_rate (1, (uint64_t)(d_FSM1.O() * d_FSM2.O()));
+ this->set_output_multiple (d_blocklength);
}
- @IMPL_NAME@::~@IMPL_NAME@()
+ template <class T>
+ pccc_decoder_blk_impl<T>::~pccc_decoder_blk_impl()
{
}
+ template <class T>
void
- @IMPL_NAME@::forecast(int noutput_items,
+ pccc_decoder_blk_impl<T>::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
int input_required = d_FSM1.O() * d_FSM2.O() * noutput_items;
@@ -87,8 +88,9 @@ namespace gr {
//===========================================================
+ template <class T>
int
- @IMPL_NAME@::general_work(int noutput_items,
+ pccc_decoder_blk_impl<T>::general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
@@ -102,7 +104,7 @@ namespace gr {
p2min = &min_star;
const float *in = (const float *) input_items[0];
- @O_TYPE@ *out = (@O_TYPE@ *) output_items[0];
+ T *out = (T *) output_items[0];
for(int n=0;n<nblocks;n++) {
pccc_decoder(d_FSM1, d_ST10, d_ST1K,
d_FSM2, d_ST20, d_ST2K,
@@ -112,9 +114,12 @@ namespace gr {
&(out[n*d_blocklength]));
}
- consume_each(d_FSM1.O() * d_FSM2.O() * noutput_items);
+ this->consume_each(d_FSM1.O() * d_FSM2.O() * noutput_items);
return noutput_items;
}
+template class pccc_decoder_blk<std::uint8_t>;
+template class pccc_decoder_blk<std::int16_t>;
+template class pccc_decoder_blk<std::int32_t>;
} /* namespace trellis */
} /* namespace gr */
diff --git a/gr-trellis/lib/pccc_decoder_X_impl.h.t b/gr-trellis/lib/pccc_decoder_blk_impl.h
index 43a7257fc5..ed4e2d24a6 100644
--- a/gr-trellis/lib/pccc_decoder_X_impl.h.t
+++ b/gr-trellis/lib/pccc_decoder_blk_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,17 +20,17 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef PCCC_DECODER_BLK_IMPL_H
+#define PCCC_DECODER_BLK_IMPL_H
-#include <gnuradio/trellis/@BASE_NAME@.h>
+#include <gnuradio/trellis/pccc_decoder_blk.h>
namespace gr {
namespace trellis {
- class @IMPL_NAME@ : public @BASE_NAME@
+template<class T>
+ class pccc_decoder_blk_impl : public pccc_decoder_blk<T>
{
private:
fsm d_FSM1;
@@ -46,13 +46,13 @@ namespace gr {
std::vector<float> d_buffer;
public:
- @IMPL_NAME@(const fsm &FSM1, int ST10, int ST1K,
+ pccc_decoder_blk_impl(const fsm &FSM1, int ST10, int ST1K,
const fsm &FSM2, int ST20, int ST2K,
const interleaver &INTERLEAVER,
int blocklength,
int repetitions,
siso_type_t SISO_TYPE);
- ~@IMPL_NAME@();
+ ~pccc_decoder_blk_impl();
fsm FSM1() const { return d_FSM1; }
fsm FSM2() const { return d_FSM2; }
@@ -77,4 +77,4 @@ namespace gr {
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* PCCC_DECODER_BLK_IMPL_H */
diff --git a/gr-trellis/lib/pccc_decoder_combined_XX_impl.cc.t b/gr-trellis/lib/pccc_decoder_combined_blk_impl.cc
index fdde7a0e5d..a1e0772ab8 100644
--- a/gr-trellis/lib/pccc_decoder_combined_XX_impl.cc.t
+++ b/gr-trellis/lib/pccc_decoder_combined_blk_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,11 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME@.h"
+#include "pccc_decoder_combined_blk_impl.h"
#include <gnuradio/io_signature.h>
#include <iostream>
#include <gnuradio/trellis/core_algorithms.h>
@@ -34,39 +32,39 @@
namespace gr {
namespace trellis {
- static const float INF = 1.0e9;
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const fsm &FSMo, int STo0, int SToK,
+ template <class IN_T,class OUT_T>
+ typename pccc_decoder_combined_blk<IN_T,OUT_T>::sptr
+ pccc_decoder_combined_blk<IN_T,OUT_T>::make(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
const interleaver &INTERLEAVER,
int blocklength,
int repetitions,
siso_type_t SISO_TYPE,
int D,
- const std::vector<@I_TYPE@> &TABLE,
+ const std::vector<IN_T> &TABLE,
digital::trellis_metric_type_t METRIC_TYPE,
float scaling)
{
return gnuradio::get_initial_sptr
- (new @NAME@(FSMo, STo0, SToK, FSMi, STi0, STiK,
+ (new pccc_decoder_combined_blk_impl<IN_T,OUT_T>(FSMo, STo0, SToK, FSMi, STi0, STiK,
INTERLEAVER, blocklength, repetitions,
SISO_TYPE, D, TABLE,METRIC_TYPE, scaling));
}
- @IMPL_NAME@::@IMPL_NAME@(const fsm &FSMo, int STo0, int SToK,
+ template <class IN_T,class OUT_T>
+ pccc_decoder_combined_blk_impl<IN_T,OUT_T>::pccc_decoder_combined_blk_impl(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
const interleaver &INTERLEAVER,
int blocklength,
int repetitions,
siso_type_t SISO_TYPE,
int D,
- const std::vector<@I_TYPE@> &TABLE,
+ const std::vector<IN_T> &TABLE,
digital::trellis_metric_type_t METRIC_TYPE,
float scaling)
- : block("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)),
- io_signature::make(1, 1, sizeof(@O_TYPE@))),
+ : block("pccc_decoder_combined_blk<IN_T,OUT_T>",
+ io_signature::make(1, 1, sizeof(IN_T)),
+ io_signature::make(1, 1, sizeof(OUT_T))),
d_FSMo(FSMo), d_STo0(STo0), d_SToK(SToK),
d_FSMi(FSMi), d_STi0(STi0), d_STiK(STiK),
d_INTERLEAVER(INTERLEAVER),
@@ -79,23 +77,26 @@ namespace gr {
d_scaling(scaling)
{
assert(d_FSMo.I() == d_FSMi.I());
- set_relative_rate (1, (uint64_t) d_D);
- set_output_multiple (d_blocklength);
+ this->set_relative_rate (1, (uint64_t) d_D);
+ this->set_output_multiple (d_blocklength);
}
- @IMPL_NAME@::~@IMPL_NAME@()
+ template <class IN_T,class OUT_T>
+ pccc_decoder_combined_blk_impl<IN_T,OUT_T>::~pccc_decoder_combined_blk_impl()
{
}
+ template <class IN_T,class OUT_T>
void
- @IMPL_NAME@::set_scaling(float scaling)
+ pccc_decoder_combined_blk_impl<IN_T,OUT_T>::set_scaling(float scaling)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(this->d_setlock);
d_scaling = scaling;
}
+ template <class IN_T,class OUT_T>
void
- @IMPL_NAME@::forecast(int noutput_items,
+ pccc_decoder_combined_blk_impl<IN_T,OUT_T>::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
int input_required = d_D * noutput_items;
@@ -104,13 +105,14 @@ namespace gr {
//===========================================================
+ template <class IN_T,class OUT_T>
int
- @IMPL_NAME@::general_work(int noutput_items,
+ pccc_decoder_combined_blk_impl<IN_T,OUT_T>::general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(this->d_setlock);
int nblocks = noutput_items / d_blocklength;
float (*p2min)(float, float) = NULL;
@@ -119,8 +121,8 @@ namespace gr {
else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT)
p2min = &min_star;
- const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0];
- @O_TYPE@ *out = (@O_TYPE@ *) output_items[0];
+ const IN_T *in = (const IN_T *) input_items[0];
+ OUT_T *out = (OUT_T *) output_items[0];
for (int n=0;n<nblocks;n++) {
pccc_decoder_combined(d_FSMo, d_STo0, d_SToK,
d_FSMi, d_STi0, d_STiK,
@@ -133,9 +135,16 @@ namespace gr {
&(out[n*d_blocklength]));
}
- consume_each(d_D * noutput_items);
+ this->consume_each(d_D * noutput_items);
return noutput_items;
}
+ template class pccc_decoder_combined_blk<float, std::uint8_t>;
+ template class pccc_decoder_combined_blk<float, std::int16_t>;
+ template class pccc_decoder_combined_blk<float, std::int32_t>;
+ template class pccc_decoder_combined_blk<gr_complex, std::uint8_t>;
+ template class pccc_decoder_combined_blk<gr_complex, std::int16_t>;
+ template class pccc_decoder_combined_blk<gr_complex, std::int32_t>;
+
} /* namespace trellis */
} /* namespace gr */
diff --git a/gr-trellis/lib/pccc_decoder_combined_XX_impl.h.t b/gr-trellis/lib/pccc_decoder_combined_blk_impl.h
index 7606017547..544a965607 100644
--- a/gr-trellis/lib/pccc_decoder_combined_XX_impl.h.t
+++ b/gr-trellis/lib/pccc_decoder_combined_blk_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,17 +20,16 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
+#ifndef PCCC_DECODER_COMBINED_BLK_IMPL_H
+#define PCCC_DECODER_COMBINED_BLK_IMPL_H
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <gnuradio/trellis/@BASE_NAME@.h>
+#include <gnuradio/trellis/pccc_decoder_combined_blk.h>
namespace gr {
namespace trellis {
- class @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T,class OUT_T>
+ class pccc_decoder_combined_blk_impl : public pccc_decoder_combined_blk<IN_T,OUT_T>
{
private:
fsm d_FSMo;
@@ -44,23 +43,23 @@ namespace gr {
int d_repetitions;
siso_type_t d_SISO_TYPE;
int d_D;
- std::vector<@I_TYPE@> d_TABLE;
+ std::vector<IN_T> d_TABLE;
digital::trellis_metric_type_t d_METRIC_TYPE;
float d_scaling;
std::vector<float> d_buffer;
public:
- @IMPL_NAME@(const fsm &FSMo, int STo0, int SToK,
+ pccc_decoder_combined_blk_impl(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
const interleaver &INTERLEAVER,
int blocklength,
int repetitions,
siso_type_t SISO_TYPE,
int D,
- const std::vector<@I_TYPE@> &TABLE,
+ const std::vector<IN_T> &TABLE,
digital::trellis_metric_type_t METRIC_TYPE,
float scaling);
- ~@IMPL_NAME@();
+ ~pccc_decoder_combined_blk_impl();
fsm FSM1() const { return d_FSMo; }
fsm FSM2() const { return d_FSMi; }
@@ -72,7 +71,7 @@ namespace gr {
int blocklength() const { return d_blocklength; }
int repetitions() const { return d_repetitions; }
int D() const { return d_D; }
- std::vector<@I_TYPE@> TABLE() const { return d_TABLE; }
+ std::vector<IN_T> TABLE() const { return d_TABLE; }
digital::trellis_metric_type_t METRIC_TYPE() const { return d_METRIC_TYPE; }
siso_type_t SISO_TYPE() const { return d_SISO_TYPE; }
float scaling() const { return d_scaling; }
@@ -90,4 +89,4 @@ namespace gr {
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* PCCC_DECODER_COMBINED_BLK_IMPL_H */
diff --git a/gr-trellis/lib/pccc_encoder_XX_impl.cc.t b/gr-trellis/lib/pccc_encoder_impl.cc
index 8fd143ca9d..2804f4b39c 100644
--- a/gr-trellis/lib/pccc_encoder_XX_impl.cc.t
+++ b/gr-trellis/lib/pccc_encoder_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,58 +20,60 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME@.h"
+#include "pccc_encoder_impl.h"
#include <gnuradio/io_signature.h>
#include <iostream>
namespace gr {
namespace trellis {
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const fsm &FSM1, int ST1,
+ template <class IN_T, class OUT_T>
+ typename pccc_encoder<IN_T,OUT_T>::sptr
+ pccc_encoder<IN_T,OUT_T>::make(const fsm &FSM1, int ST1,
const fsm &FSM2, int ST2,
const interleaver &INTERLEAVER,
int blocklength)
{
return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(FSM1, ST1, FSM2, ST2, INTERLEAVER, blocklength));
+ (new pccc_encoder_impl<IN_T,OUT_T>(FSM1, ST1, FSM2, ST2, INTERLEAVER, blocklength));
}
- @IMPL_NAME@::@IMPL_NAME@(const fsm &FSM1, int ST1,
+ template <class IN_T, class OUT_T>
+ pccc_encoder_impl<IN_T,OUT_T>::pccc_encoder_impl(const fsm &FSM1, int ST1,
const fsm &FSM2, int ST2,
const interleaver &INTERLEAVER,
int blocklength)
- : sync_block("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)),
- io_signature::make(1, 1, sizeof(@O_TYPE@))),
+ : sync_block("pccc_encoder<IN_T,OUT_T>",
+ io_signature::make(1, 1, sizeof(IN_T)),
+ io_signature::make(1, 1, sizeof(OUT_T))),
d_FSM1(FSM1), d_ST1(ST1),
d_FSM2(FSM2), d_ST2(ST2),
d_INTERLEAVER(INTERLEAVER),
d_blocklength(blocklength)
{
assert(d_FSM1.I() == d_FSM2.I());
- set_output_multiple(d_blocklength);
+ this->set_output_multiple(d_blocklength);
d_buffer.resize(d_blocklength);
}
- @IMPL_NAME@::~@IMPL_NAME@()
+ template <class IN_T, class OUT_T>
+ pccc_encoder_impl<IN_T,OUT_T>::~pccc_encoder_impl()
{
}
+ template <class IN_T, class OUT_T>
int
- @NAME@::work(int noutput_items,
+ pccc_encoder_impl<IN_T,OUT_T>::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
for(int b = 0 ; b<noutput_items/d_blocklength; b++) {
- const @I_TYPE@ *in = (const @I_TYPE@*)input_items[0]+b*d_blocklength;
- @O_TYPE@ *out = (@O_TYPE@*)output_items[0]+b*d_blocklength;
+ const IN_T *in = (const IN_T*)input_items[0]+b*d_blocklength;
+ OUT_T *out = (OUT_T*)output_items[0]+b*d_blocklength;
int ST1_tmp = d_ST1;
int ST2_tmp = d_ST2;
@@ -81,11 +83,17 @@ namespace gr {
ST1_tmp = (int) d_FSM1.NS()[ST1_tmp*d_FSM1.I()+in[i]];
int o2 = d_FSM2.OS()[ST2_tmp*d_FSM2.I()+in[k]];
ST2_tmp = (int) d_FSM2.NS()[ST2_tmp*d_FSM2.I()+in[k]];
- out[i] = (@O_TYPE@) (o1*d_FSM2.O() + o2);
+ out[i] = (OUT_T) (o1*d_FSM2.O() + o2);
}
}
return noutput_items;
}
+ template class pccc_encoder<std::uint8_t, std::uint8_t>;
+ template class pccc_encoder<std::uint8_t, std::int16_t>;
+ template class pccc_encoder<std::uint8_t, std::int32_t>;
+ template class pccc_encoder<std::int16_t, std::int16_t>;
+ template class pccc_encoder<std::int16_t, std::int32_t>;
+ template class pccc_encoder<std::int32_t, std::int32_t>;
} /* namespace trellis */
} /* namespace gr */
diff --git a/gr-trellis/lib/pccc_encoder_XX_impl.h.t b/gr-trellis/lib/pccc_encoder_impl.h
index 5561b716d3..834e8986c4 100644
--- a/gr-trellis/lib/pccc_encoder_XX_impl.h.t
+++ b/gr-trellis/lib/pccc_encoder_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,17 +20,16 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
+#ifndef PCCC_ENCODER_IMPL_H
+#define PCCC_ENCODER_IMPL_H
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <gnuradio/trellis/@BASE_NAME@.h>
+#include <gnuradio/trellis/pccc_encoder.h>
namespace gr {
namespace trellis {
- class @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T, class OUT_T>
+ class pccc_encoder_impl : public pccc_encoder<IN_T,OUT_T>
{
private:
fsm d_FSM1;
@@ -42,11 +41,11 @@ namespace gr {
std::vector<int> d_buffer;
public:
- @IMPL_NAME@(const fsm &FSM1, int ST1,
+ pccc_encoder_impl(const fsm &FSM1, int ST1,
const fsm &FSM2, int ST2,
const interleaver &INTERLEAVER,
int blocklength);
- ~@IMPL_NAME@();
+ ~pccc_encoder_impl();
fsm FSM1() const { return d_FSM1; }
int ST1() const { return d_ST1; }
@@ -63,4 +62,4 @@ namespace gr {
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* PCCC_ENCODER_IMPL_H */
diff --git a/gr-trellis/lib/sccc_decoder_X_impl.cc.t b/gr-trellis/lib/sccc_decoder_blk_impl.cc
index 9d8106b1ff..152079d94c 100644
--- a/gr-trellis/lib/sccc_decoder_X_impl.cc.t
+++ b/gr-trellis/lib/sccc_decoder_blk_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,12 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME@.h"
+#include "sccc_decoder_blk_impl.h"
#include <gnuradio/io_signature.h>
#include <iostream>
#include <gnuradio/trellis/core_algorithms.h>
@@ -34,10 +33,9 @@
namespace gr {
namespace trellis {
- static const float INF = 1.0e9;
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const fsm &FSMo, int STo0, int SToK,
+ template <class T>
+ typename sccc_decoder_blk<T>::sptr
+ sccc_decoder_blk<T>::make(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
const interleaver &INTERLEAVER,
int blocklength,
@@ -45,20 +43,21 @@ namespace gr {
siso_type_t SISO_TYPE)
{
return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(FSMo, STo0, SToK, FSMi, STi0, STiK,
+ (new sccc_decoder_blk_impl<T>(FSMo, STo0, SToK, FSMi, STi0, STiK,
INTERLEAVER, blocklength, repetitions,
SISO_TYPE));
}
- @IMPL_NAME@::@IMPL_NAME@(const fsm &FSMo, int STo0, int SToK,
+ template <class T>
+ sccc_decoder_blk_impl<T>::sccc_decoder_blk_impl(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
const interleaver &INTERLEAVER,
int blocklength,
int repetitions,
siso_type_t SISO_TYPE)
- : block("@BASE_NAME@",
+ : block("sccc_decoder_blk",
io_signature::make(1, 1, sizeof(float)),
- io_signature::make(1, 1, sizeof(@O_TYPE@))),
+ io_signature::make(1, 1, sizeof(T))),
d_FSMo(FSMo), d_STo0(STo0), d_SToK(SToK),
d_FSMi(FSMi), d_STi0(STi0), d_STiK(STiK),
d_INTERLEAVER(INTERLEAVER),
@@ -66,16 +65,18 @@ namespace gr {
d_repetitions(repetitions),
d_SISO_TYPE(SISO_TYPE)
{
- set_relative_rate(1, (uint64_t) d_FSMi.O());
- set_output_multiple(d_blocklength);
+ this->set_relative_rate(1, (uint64_t) d_FSMi.O());
+ this->set_output_multiple(d_blocklength);
}
- @IMPL_NAME@::~@IMPL_NAME@()
+ template <class T>
+ sccc_decoder_blk_impl<T>::~sccc_decoder_blk_impl()
{
}
+ template <class T>
void
- @IMPL_NAME@::forecast(int noutput_items,
+ sccc_decoder_blk_impl<T>::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
int input_required = d_FSMi.O() * noutput_items ;
@@ -84,8 +85,9 @@ namespace gr {
//===========================================================
+ template <class T>
int
- @IMPL_NAME@::general_work(int noutput_items,
+ sccc_decoder_blk_impl<T>::general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
@@ -99,7 +101,7 @@ namespace gr {
p2min = &min_star;
const float *in = (const float*)input_items[0];
- @O_TYPE@ *out = (@O_TYPE@*)output_items[0];
+ T *out = (T*)output_items[0];
for(int n = 0; n < nblocks; n++) {
sccc_decoder(d_FSMo, d_STo0, d_SToK,
@@ -110,9 +112,12 @@ namespace gr {
&(out[n*d_blocklength]));
}
- consume_each(d_FSMi.O() * noutput_items );
+ this->consume_each(d_FSMi.O() * noutput_items );
return noutput_items;
}
+template class sccc_decoder_blk<std::uint8_t>;
+template class sccc_decoder_blk<std::int16_t>;
+template class sccc_decoder_blk<std::int32_t>;
} /* namespace trellis */
} /* namespace gr */
diff --git a/gr-trellis/lib/sccc_decoder_X_impl.h.t b/gr-trellis/lib/sccc_decoder_blk_impl.h
index c79e6ebbab..0c3e2d9310 100644
--- a/gr-trellis/lib/sccc_decoder_X_impl.h.t
+++ b/gr-trellis/lib/sccc_decoder_blk_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,17 +20,17 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef SCCC_DECODER_BLK_IMPL_H
+#define SCCC_DECODER_BLK_IMPL_H
-#include <gnuradio/trellis/@BASE_NAME@.h>
+#include <gnuradio/trellis/sccc_decoder_blk.h>
namespace gr {
namespace trellis {
- class @IMPL_NAME@ : public @BASE_NAME@
+template<class T>
+ class sccc_decoder_blk_impl : public sccc_decoder_blk<T>
{
private:
fsm d_FSMo;
@@ -46,13 +46,13 @@ namespace gr {
std::vector<float> d_buffer;
public:
- @IMPL_NAME@(const fsm &FSMo, int STo0, int SToK,
+ sccc_decoder_blk_impl(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
const interleaver &INTERLEAVER,
int blocklength,
int repetitions,
siso_type_t SISO_TYPE);
- ~@IMPL_NAME@();
+ ~sccc_decoder_blk_impl();
fsm FSMo() const { return d_FSMo; }
fsm FSMi() const { return d_FSMi; }
@@ -77,4 +77,4 @@ namespace gr {
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* SCCC_DECODER_BLK_IMPL_H */
diff --git a/gr-trellis/lib/sccc_decoder_combined_XX_impl.cc.t b/gr-trellis/lib/sccc_decoder_combined_blk_impl.cc
index 2909b7b0b7..9ef1321996 100644
--- a/gr-trellis/lib/sccc_decoder_combined_XX_impl.cc.t
+++ b/gr-trellis/lib/sccc_decoder_combined_blk_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,11 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME@.h"
+#include "sccc_decoder_combined_blk_impl.h"
#include <gnuradio/io_signature.h>
#include <iostream>
#include <gnuradio/trellis/core_algorithms.h>
@@ -34,39 +32,39 @@
namespace gr {
namespace trellis {
- static const float INF = 1.0e9;
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const fsm &FSMo, int STo0, int SToK,
+ template <class IN_T, class OUT_T>
+ typename sccc_decoder_combined_blk<IN_T,OUT_T>::sptr
+ sccc_decoder_combined_blk<IN_T,OUT_T>::make(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
const interleaver &INTERLEAVER,
int blocklength,
int repetitions,
siso_type_t SISO_TYPE,
int D,
- const std::vector<@I_TYPE@> &TABLE,
+ const std::vector<IN_T> &TABLE,
digital::trellis_metric_type_t METRIC_TYPE,
float scaling)
{
return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(FSMo, STo0, SToK, FSMi, STi0, STiK,
+ (new sccc_decoder_combined_blk_impl<IN_T,OUT_T>(FSMo, STo0, SToK, FSMi, STi0, STiK,
INTERLEAVER, blocklength, repetitions,
SISO_TYPE, D, TABLE,METRIC_TYPE, scaling));
}
- @IMPL_NAME@::@IMPL_NAME@(const fsm &FSMo, int STo0, int SToK,
+ template <class IN_T, class OUT_T>
+ sccc_decoder_combined_blk_impl<IN_T,OUT_T>::sccc_decoder_combined_blk_impl(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
const interleaver &INTERLEAVER,
int blocklength,
int repetitions,
siso_type_t SISO_TYPE,
int D,
- const std::vector<@I_TYPE@> &TABLE,
+ const std::vector<IN_T> &TABLE,
digital::trellis_metric_type_t METRIC_TYPE,
float scaling)
- : block("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)),
- io_signature::make(1, 1, sizeof(@O_TYPE@))),
+ : block("sccc_decoder_combined_blk<IN_T,OUT_T>",
+ io_signature::make(1, 1, sizeof(IN_T)),
+ io_signature::make(1, 1, sizeof(OUT_T))),
d_FSMo(FSMo), d_STo0(STo0), d_SToK(SToK),
d_FSMi(FSMi), d_STi0(STi0), d_STiK(STiK),
d_INTERLEAVER(INTERLEAVER),
@@ -78,23 +76,26 @@ namespace gr {
d_METRIC_TYPE(METRIC_TYPE),
d_scaling(scaling)
{
- set_relative_rate(1, (uint64_t) d_D);
- set_output_multiple(d_blocklength);
+ this->set_relative_rate(1, (uint64_t) d_D);
+ this->set_output_multiple(d_blocklength);
}
- @IMPL_NAME@::~@IMPL_NAME@()
+ template <class IN_T, class OUT_T>
+ sccc_decoder_combined_blk_impl<IN_T,OUT_T>::~sccc_decoder_combined_blk_impl()
{
}
+ template <class IN_T, class OUT_T>
void
- @IMPL_NAME@::set_scaling(float scaling)
+ sccc_decoder_combined_blk_impl<IN_T,OUT_T>::set_scaling(float scaling)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(this->d_setlock);
d_scaling = scaling;
}
+ template <class IN_T, class OUT_T>
void
- @IMPL_NAME@::forecast(int noutput_items,
+ sccc_decoder_combined_blk_impl<IN_T,OUT_T>::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
int input_required = d_D * noutput_items ;
@@ -103,13 +104,14 @@ namespace gr {
//===========================================================
+ template <class IN_T, class OUT_T>
int
- @IMPL_NAME@::general_work(int noutput_items,
+ sccc_decoder_combined_blk_impl<IN_T,OUT_T>::general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(this->d_setlock);
int nblocks = noutput_items / d_blocklength;
float (*p2min)(float, float) = NULL;
@@ -118,8 +120,8 @@ namespace gr {
else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT)
p2min = &min_star;
- const @I_TYPE@ *in = (const @I_TYPE@*)input_items[0];
- @O_TYPE@ *out = (@O_TYPE@*)output_items[0];
+ const IN_T *in = (const IN_T*)input_items[0];
+ OUT_T *out = (OUT_T*)output_items[0];
for(int n = 0; n < nblocks; n++) {
sccc_decoder_combined(d_FSMo, d_STo0, d_SToK,
@@ -133,9 +135,17 @@ namespace gr {
&(out[n*d_blocklength]));
}
- consume_each(d_D * noutput_items);
+ this->consume_each(d_D * noutput_items);
return noutput_items;
}
+ template class sccc_decoder_combined_blk<float, std::uint8_t>;
+ template class sccc_decoder_combined_blk<float, std::int16_t>;
+ template class sccc_decoder_combined_blk<float, std::int32_t>;
+ template class sccc_decoder_combined_blk<gr_complex, std::uint8_t>;
+ template class sccc_decoder_combined_blk<gr_complex, std::int16_t>;
+ template class sccc_decoder_combined_blk<gr_complex, std::int32_t>;
+
+
} /* namespace trellis */
} /* namespace gr */
diff --git a/gr-trellis/lib/sccc_decoder_combined_XX_impl.h.t b/gr-trellis/lib/sccc_decoder_combined_blk_impl.h
index 6a38f0114f..8236c79a49 100644
--- a/gr-trellis/lib/sccc_decoder_combined_XX_impl.h.t
+++ b/gr-trellis/lib/sccc_decoder_combined_blk_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,17 +20,16 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
+#ifndef SCCC_DECODER_COMBINED_BLK_IMPL_H
+#define SCCC_DECODER_COMBINED_BLK_IMPL_H
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <gnuradio/trellis/@BASE_NAME@.h>
+#include <gnuradio/trellis/sccc_decoder_combined_blk.h>
namespace gr {
namespace trellis {
- class @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T, class OUT_T>
+ class sccc_decoder_combined_blk_impl : public sccc_decoder_combined_blk<IN_T,OUT_T>
{
private:
fsm d_FSMo;
@@ -44,23 +43,23 @@ namespace gr {
int d_repetitions;
siso_type_t d_SISO_TYPE;
int d_D;
- std::vector<@I_TYPE@> d_TABLE;
+ std::vector<IN_T> d_TABLE;
digital::trellis_metric_type_t d_METRIC_TYPE;
float d_scaling;
std::vector<float> d_buffer;
public:
- @IMPL_NAME@(const fsm &FSMo, int STo0, int SToK,
+ sccc_decoder_combined_blk_impl(const fsm &FSMo, int STo0, int SToK,
const fsm &FSMi, int STi0, int STiK,
const interleaver &INTERLEAVER,
int blocklength,
int repetitions,
siso_type_t SISO_TYPE,
int D,
- const std::vector<@I_TYPE@> &TABLE,
+ const std::vector<IN_T> &TABLE,
digital::trellis_metric_type_t METRIC_TYPE,
float scaling);
- ~@IMPL_NAME@();
+ ~sccc_decoder_combined_blk_impl();
fsm FSMo() const { return d_FSMo; }
fsm FSMi() const { return d_FSMi; }
@@ -72,7 +71,7 @@ namespace gr {
int blocklength() const { return d_blocklength; }
int repetitions() const { return d_repetitions; }
int D() const { return d_D; }
- std::vector<@I_TYPE@> TABLE() const { return d_TABLE; }
+ std::vector<IN_T> TABLE() const { return d_TABLE; }
digital::trellis_metric_type_t METRIC_TYPE() const { return d_METRIC_TYPE; }
siso_type_t SISO_TYPE() const { return d_SISO_TYPE; }
float scaling() const { return d_scaling; }
@@ -90,4 +89,4 @@ namespace gr {
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* SCCC_DECODER_COMBINED_BLK_IMPL_H */
diff --git a/gr-trellis/lib/sccc_encoder_XX_impl.cc.t b/gr-trellis/lib/sccc_encoder_impl.cc
index 9924b3c7d2..9c3e1da2d5 100644
--- a/gr-trellis/lib/sccc_encoder_XX_impl.cc.t
+++ b/gr-trellis/lib/sccc_encoder_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,57 +20,59 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME@.h"
+#include "sccc_encoder_impl.h"
#include <gnuradio/io_signature.h>
#include <iostream>
namespace gr {
namespace trellis {
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const fsm &FSMo, int STo,
+ template <class IN_T, class OUT_T>
+ typename sccc_encoder<IN_T,OUT_T>::sptr
+ sccc_encoder<IN_T,OUT_T>::make(const fsm &FSMo, int STo,
const fsm &FSMi, int STi,
const interleaver &INTERLEAVER,
int blocklength)
{
return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(FSMo, STo, FSMi, STi, INTERLEAVER, blocklength));
+ (new sccc_encoder_impl<IN_T,OUT_T>(FSMo, STo, FSMi, STi, INTERLEAVER, blocklength));
}
- @IMPL_NAME@::@IMPL_NAME@(const fsm &FSMo, int STo,
+ template <class IN_T, class OUT_T>
+ sccc_encoder_impl<IN_T,OUT_T>::sccc_encoder_impl(const fsm &FSMo, int STo,
const fsm &FSMi, int STi,
const interleaver &INTERLEAVER,
int blocklength)
- : sync_block("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)),
- io_signature::make(1, 1, sizeof(@O_TYPE@))),
+ : sync_block("sccc_encoder<IN_T,OUT_T>",
+ io_signature::make(1, 1, sizeof(IN_T)),
+ io_signature::make(1, 1, sizeof(OUT_T))),
d_FSMo(FSMo), d_STo(STo),
d_FSMi(FSMi), d_STi(STi),
d_INTERLEAVER(INTERLEAVER),
d_blocklength(blocklength)
{
- set_output_multiple(d_blocklength);
+ this->set_output_multiple(d_blocklength);
d_buffer.resize(d_blocklength);
}
- @IMPL_NAME@::~@IMPL_NAME@()
+ template <class IN_T, class OUT_T>
+ sccc_encoder_impl<IN_T,OUT_T>::~sccc_encoder_impl()
{
}
+ template <class IN_T, class OUT_T>
int
- @IMPL_NAME@::work(int noutput_items,
+ sccc_encoder_impl<IN_T,OUT_T>::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
for(int b = 0; b < noutput_items/d_blocklength; b++) {
- const @I_TYPE@ *in = (const @I_TYPE@*)input_items[0]+b*d_blocklength;
- @O_TYPE@ *out = (@O_TYPE@*)output_items[0]+b*d_blocklength;
+ const IN_T *in = (const IN_T*)input_items[0]+b*d_blocklength;
+ OUT_T *out = (OUT_T*)output_items[0]+b*d_blocklength;
int STo_tmp = d_STo;
for(int i = 0; i < d_blocklength; i++) {
@@ -81,13 +83,19 @@ namespace gr {
int STi_tmp = d_STi;
for(int i = 0; i < d_blocklength; i++) {
int k = d_INTERLEAVER.INTER()[i];
- out[i] = (@O_TYPE@) d_FSMi.OS()[STi_tmp*d_FSMi.I()+d_buffer[k]];
+ out[i] = (OUT_T) d_FSMi.OS()[STi_tmp*d_FSMi.I()+d_buffer[k]];
STi_tmp = (int) d_FSMi.NS()[STi_tmp*d_FSMi.I()+d_buffer[k]];
}
}
return noutput_items;
}
+ template class sccc_encoder<std::uint8_t, std::uint8_t>;
+ template class sccc_encoder<std::uint8_t, std::int16_t>;
+ template class sccc_encoder<std::uint8_t, std::int32_t>;
+ template class sccc_encoder<std::int16_t, std::int16_t>;
+ template class sccc_encoder<std::int16_t, std::int32_t>;
+ template class sccc_encoder<std::int32_t, std::int32_t>;
+
} /* namespace trellis */
} /* namespace gr */
-
diff --git a/gr-trellis/lib/sccc_encoder_XX_impl.h.t b/gr-trellis/lib/sccc_encoder_impl.h
index fc64f2ade8..40968906dc 100644
--- a/gr-trellis/lib/sccc_encoder_XX_impl.h.t
+++ b/gr-trellis/lib/sccc_encoder_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,17 +20,16 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
+#ifndef SCCC_ENCODER_IMPL_H
+#define SCCC_ENCODER_IMPL_H
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <gnuradio/trellis/@BASE_NAME@.h>
+#include <gnuradio/trellis/sccc_encoder.h>
namespace gr {
namespace trellis {
- class @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T, class OUT_T>
+ class sccc_encoder_impl : public sccc_encoder<IN_T,OUT_T>
{
private:
fsm d_FSMo;
@@ -42,11 +41,11 @@ namespace gr {
std::vector<int> d_buffer;
public:
- @IMPL_NAME@(const fsm &FSMo, int STo,
+ sccc_encoder_impl(const fsm &FSMo, int STo,
const fsm &FSMi, int STi,
const interleaver &INTERLEAVER,
int blocklength);
- ~@IMPL_NAME@();
+ ~sccc_encoder_impl();
fsm FSMo() const { return d_FSMo; }
int STo() const { return d_STo; }
@@ -63,4 +62,4 @@ namespace gr {
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* SCCC_ENCODER_IMPL_H */
diff --git a/gr-trellis/lib/siso_combined_f_impl.cc b/gr-trellis/lib/siso_combined_f_impl.cc
index 6c7a6c1d23..ff413b8699 100644
--- a/gr-trellis/lib/siso_combined_f_impl.cc
+++ b/gr-trellis/lib/siso_combined_f_impl.cc
@@ -33,8 +33,6 @@
namespace gr {
namespace trellis {
- static const float INF = 1.0e9;
-
siso_combined_f::sptr
siso_combined_f::make(const fsm &FSM, int K,
int S0, int SK,
@@ -50,7 +48,7 @@ namespace gr {
void siso_combined_f_impl::recalculate()
{
- int multiple;
+ int multiple;
if(d_POSTI && d_POSTO)
multiple = d_FSM.I()+d_FSM.O();
else if(d_POSTI)
@@ -96,67 +94,67 @@ namespace gr {
void siso_combined_f_impl::set_FSM(const fsm &FSM)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(d_setlock);
d_FSM=FSM;
recalculate();
}
void siso_combined_f_impl::set_K(int K)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(d_setlock);
d_K=K;
recalculate();
}
void siso_combined_f_impl::set_POSTI(bool POSTI)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(d_setlock);
d_POSTI = POSTI;
recalculate();
}
void siso_combined_f_impl::set_POSTO(bool POSTO)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(d_setlock);
d_POSTO = POSTO;
recalculate();
}
void siso_combined_f_impl::set_D(int D)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(d_setlock);
d_D=D;
recalculate();
}
void siso_combined_f_impl::set_S0(int S0)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_S0 = S0;
+ {
+ gr::thread::scoped_lock guard(d_setlock);
+ d_S0 = S0;
}
void siso_combined_f_impl::set_SK(int SK)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_SK = SK;
+ {
+ gr::thread::scoped_lock guard(d_setlock);
+ d_SK = SK;
}
- void siso_combined_f_impl::set_SISO_TYPE(trellis::siso_type_t type)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_SISO_TYPE = type;
+ void siso_combined_f_impl::set_SISO_TYPE(trellis::siso_type_t type)
+ {
+ gr::thread::scoped_lock guard(d_setlock);
+ d_SISO_TYPE = type;
}
void siso_combined_f_impl::set_TABLE(const std::vector<float> &table)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_TABLE = table;
+ {
+ gr::thread::scoped_lock guard(d_setlock);
+ d_TABLE = table;
}
void siso_combined_f_impl::set_TYPE(digital::trellis_metric_type_t type)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_TYPE = type;
+ {
+ gr::thread::scoped_lock guard(d_setlock);
+ d_TYPE = type;
}
siso_combined_f_impl::~siso_combined_f_impl()
@@ -196,7 +194,7 @@ namespace gr {
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(d_setlock);
int nstreams = output_items.size();
//printf("general_work:Streams: %d\n",nstreams);
diff --git a/gr-trellis/lib/siso_f_impl.cc b/gr-trellis/lib/siso_f_impl.cc
index 6ec6773ac5..14968a45a4 100644
--- a/gr-trellis/lib/siso_f_impl.cc
+++ b/gr-trellis/lib/siso_f_impl.cc
@@ -33,8 +33,6 @@
namespace gr {
namespace trellis {
- static const float INF = 1.0e9;
-
siso_f::sptr
siso_f::make(const fsm &FSM, int K,
int S0, int SK,
@@ -104,35 +102,35 @@ namespace gr {
}
void siso_f_impl::set_POSTI(bool POSTI)
- {
+ {
gr::thread::scoped_lock guard(d_setlock);
- d_POSTI = POSTI;
+ d_POSTI = POSTI;
recalculate();
}
void siso_f_impl::set_POSTO(bool POSTO)
- {
+ {
gr::thread::scoped_lock guard(d_setlock);
- d_POSTO = POSTO;
+ d_POSTO = POSTO;
recalculate();
}
void siso_f_impl::set_S0(int S0)
- {
+ {
gr::thread::scoped_lock guard(d_setlock);
- d_S0 = S0;
+ d_S0 = S0;
}
void siso_f_impl::set_SK(int SK)
- {
+ {
gr::thread::scoped_lock guard(d_setlock);
- d_SK = SK;
+ d_SK = SK;
}
- void siso_f_impl::set_SISO_TYPE(trellis::siso_type_t type)
- {
+ void siso_f_impl::set_SISO_TYPE(trellis::siso_type_t type)
+ {
gr::thread::scoped_lock guard(d_setlock);
- d_SISO_TYPE = type;
+ d_SISO_TYPE = type;
}
siso_f_impl::~siso_f_impl()
diff --git a/gr-trellis/lib/viterbi_combined_XX_impl.cc.t b/gr-trellis/lib/viterbi_combined_XX_impl.cc.t
deleted file mode 100644
index 60ad731227..0000000000
--- a/gr-trellis/lib/viterbi_combined_XX_impl.cc.t
+++ /dev/null
@@ -1,155 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "@NAME@.h"
-#include <gnuradio/io_signature.h>
-#include <iostream>
-
-namespace gr {
- namespace trellis {
-
- static const float INF = 1.0e9;
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const fsm &FSM, int K,
- int S0, int SK, int D,
- const std::vector<@I_TYPE@> &TABLE,
- digital::trellis_metric_type_t TYPE)
- {
- return gnuradio::get_initial_sptr
- (new @NAME@(FSM, K, S0, SK, D, TABLE,TYPE));
- }
-
- @IMPL_NAME@::@IMPL_NAME@(const fsm &FSM, int K,
- int S0, int SK, int D,
- const std::vector<@I_TYPE@> &TABLE,
- digital::trellis_metric_type_t TYPE)
- : block("@BASE_NAME@",
- io_signature::make(1, -1, sizeof(@I_TYPE@)),
- io_signature::make(1, -1, sizeof(@O_TYPE@))),
- d_FSM(FSM), d_K(K), d_S0(S0), d_SK(SK), d_D(D),
- d_TABLE(TABLE), d_TYPE(TYPE)//,
- //d_trace(FSM.S()*K)
- {
- set_relative_rate(1, (uint64_t)d_D);
- set_output_multiple(d_K);
- }
-
- void
- @IMPL_NAME@::set_K(int K)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_K = K;
- set_output_multiple(d_K);
- }
-
- void
- @IMPL_NAME@::set_D(int D)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_D = D;
- set_relative_rate(1, (uint64_t)d_D);
- }
-
- void @IMPL_NAME@::set_FSM(const fsm &FSM)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_FSM = FSM;
- }
-
- void @IMPL_NAME@::set_S0(int S0)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_S0 = S0;
- }
-
- void @IMPL_NAME@::set_SK(int SK)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_SK = SK;
- }
-
- void
- @IMPL_NAME@::set_TYPE(digital::trellis_metric_type_t type)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_TYPE = type;
- }
-
- void
- @IMPL_NAME@::set_TABLE(const std::vector<@I_TYPE@> &table)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_TABLE = table;
- }
-
- @IMPL_NAME@::~@IMPL_NAME@()
- {
- }
-
- void
- @IMPL_NAME@::forecast(int noutput_items,
- gr_vector_int &ninput_items_required)
- {
- int input_required = d_D * noutput_items;
- unsigned ninputs = ninput_items_required.size();
- for(unsigned int i = 0; i < ninputs; i++) {
- ninput_items_required[i] = input_required;
- }
- }
-
- int
- @IMPL_NAME@::general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- gr::thread::scoped_lock guard(d_setlock);
- int nstreams = input_items.size();
- int nblocks = noutput_items / d_K;
-
- for(int m=0;m<nstreams;m++) {
- const @I_TYPE@ *in = (const @I_TYPE@*)input_items[m];
- @O_TYPE@ *out = (@O_TYPE@*)output_items[m];
-
- for(int n=0;n<nblocks;n++) {
- viterbi_algorithm_combined(d_FSM.I(), d_FSM.S(), d_FSM.O(),
- d_FSM.NS(), d_FSM.OS(), d_FSM.PS(),
- d_FSM.PI(), d_K,d_S0, d_SK, d_D,
- d_TABLE, d_TYPE,
- &(in[n*d_K*d_D]), &(out[n*d_K]));
- }
- }
-
- consume_each(d_D * noutput_items);
- return noutput_items;
- }
-
- } /* namespace trellis */
-} /* namespace gr */
-
diff --git a/gr-trellis/lib/viterbi_combined_impl.cc b/gr-trellis/lib/viterbi_combined_impl.cc
new file mode 100644
index 0000000000..675af6aea5
--- /dev/null
+++ b/gr-trellis/lib/viterbi_combined_impl.cc
@@ -0,0 +1,176 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "viterbi_combined_impl.h"
+#include <gnuradio/io_signature.h>
+#include <iostream>
+
+namespace gr {
+ namespace trellis {
+
+ template <class IN_T,class OUT_T>
+ typename viterbi_combined<IN_T,OUT_T>::sptr
+ viterbi_combined<IN_T,OUT_T>::make(const fsm &FSM, int K,
+ int S0, int SK, int D,
+ const std::vector<IN_T> &TABLE,
+ digital::trellis_metric_type_t TYPE)
+ {
+ return gnuradio::get_initial_sptr
+ (new viterbi_combined_impl<IN_T,OUT_T>(FSM, K, S0, SK, D, TABLE,TYPE));
+ }
+
+ template <class IN_T,class OUT_T>
+ viterbi_combined_impl<IN_T,OUT_T>::viterbi_combined_impl(const fsm &FSM, int K,
+ int S0, int SK, int D,
+ const std::vector<IN_T> &TABLE,
+ digital::trellis_metric_type_t TYPE)
+ : block("viterbi_combined<IN_T,OUT_T>",
+ io_signature::make(1, -1, sizeof(IN_T)),
+ io_signature::make(1, -1, sizeof(OUT_T))),
+ d_FSM(FSM), d_K(K), d_S0(S0), d_SK(SK), d_D(D),
+ d_TABLE(TABLE), d_TYPE(TYPE)//,
+ //d_trace(FSM.S()*K)
+ {
+ this->set_relative_rate(1, (uint64_t)d_D);
+ this->set_output_multiple(d_K);
+ }
+
+ template <class IN_T,class OUT_T>
+ void
+ viterbi_combined_impl<IN_T,OUT_T>::set_K(int K)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_K = K;
+ this->set_output_multiple(d_K);
+ }
+
+ template <class IN_T,class OUT_T>
+ void
+ viterbi_combined_impl<IN_T,OUT_T>::set_D(int D)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_D = D;
+ this->set_relative_rate(1, (uint64_t)d_D);
+ }
+
+ template <class IN_T,class OUT_T>
+ void viterbi_combined_impl<IN_T,OUT_T>::set_FSM(const fsm &FSM)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_FSM = FSM;
+ }
+
+ template <class IN_T,class OUT_T>
+ void viterbi_combined_impl<IN_T,OUT_T>::set_S0(int S0)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_S0 = S0;
+ }
+
+ template <class IN_T,class OUT_T>
+ void viterbi_combined_impl<IN_T,OUT_T>::set_SK(int SK)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_SK = SK;
+ }
+
+ template <class IN_T,class OUT_T>
+ void
+ viterbi_combined_impl<IN_T,OUT_T>::set_TYPE(digital::trellis_metric_type_t type)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_TYPE = type;
+ }
+
+ template <class IN_T,class OUT_T>
+ void
+ viterbi_combined_impl<IN_T,OUT_T>::set_TABLE(const std::vector<IN_T> &table)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_TABLE = table;
+ }
+
+ template <class IN_T,class OUT_T>
+ viterbi_combined_impl<IN_T,OUT_T>::~viterbi_combined_impl()
+ {
+ }
+
+ template <class IN_T,class OUT_T>
+ void
+ viterbi_combined_impl<IN_T,OUT_T>::forecast(int noutput_items,
+ gr_vector_int &ninput_items_required)
+ {
+ int input_required = d_D * noutput_items;
+ unsigned ninputs = ninput_items_required.size();
+ for(unsigned int i = 0; i < ninputs; i++) {
+ ninput_items_required[i] = input_required;
+ }
+ }
+
+ template <class IN_T,class OUT_T>
+ int
+ viterbi_combined_impl<IN_T,OUT_T>::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ int nstreams = input_items.size();
+ int nblocks = noutput_items / d_K;
+
+ for(int m=0;m<nstreams;m++) {
+ const IN_T *in = (const IN_T*)input_items[m];
+ OUT_T *out = (OUT_T*)output_items[m];
+
+ for(int n=0;n<nblocks;n++) {
+ viterbi_algorithm_combined(d_FSM.I(), d_FSM.S(), d_FSM.O(),
+ d_FSM.NS(), d_FSM.OS(), d_FSM.PS(),
+ d_FSM.PI(), d_K,d_S0, d_SK, d_D,
+ d_TABLE, d_TYPE,
+ &(in[n*d_K*d_D]), &(out[n*d_K]));
+ }
+ }
+
+ this->consume_each(d_D * noutput_items);
+ return noutput_items;
+ }
+
+ template class viterbi_combined<std::int16_t, std::uint8_t>;
+ template class viterbi_combined<std::int16_t, std::int16_t>;
+ template class viterbi_combined<std::int16_t, std::int32_t>;
+ template class viterbi_combined<std::int32_t, std::uint8_t>;
+ template class viterbi_combined<std::int32_t, std::int16_t>;
+ template class viterbi_combined<std::int32_t, std::int32_t>;
+ template class viterbi_combined<float, std::uint8_t>;
+ template class viterbi_combined<float, std::int16_t>;
+ template class viterbi_combined<float, std::int32_t>;
+ template class viterbi_combined<gr_complex, std::uint8_t>;
+ template class viterbi_combined<gr_complex, std::int16_t>;
+ template class viterbi_combined<gr_complex, std::int32_t>;
+
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/lib/viterbi_combined_XX_impl.h.t b/gr-trellis/lib/viterbi_combined_impl.h
index 788e609895..e83114673f 100644
--- a/gr-trellis/lib/viterbi_combined_XX_impl.h.t
+++ b/gr-trellis/lib/viterbi_combined_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,17 +20,16 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
+#ifndef VITERBI_COMBINED_IMPL_H
+#define VITERBI_COMBINED_IMPL_H
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <gnuradio/trellis/@BASE_NAME@.h>
+#include <gnuradio/trellis/viterbi_combined.h>
namespace gr {
namespace trellis {
- class @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T,class OUT_T>
+ class viterbi_combined_impl : public viterbi_combined<IN_T,OUT_T>
{
private:
fsm d_FSM;
@@ -38,23 +37,23 @@ namespace gr {
int d_S0;
int d_SK;
int d_D;
- std::vector<@I_TYPE@> d_TABLE;
+ std::vector<IN_T> d_TABLE;
digital::trellis_metric_type_t d_TYPE;
//std::vector<int> d_trace;
public:
- @IMPL_NAME@(const fsm &FSM, int K,
+ viterbi_combined_impl(const fsm &FSM, int K,
int S0, int SK, int D,
- const std::vector<@I_TYPE@> &TABLE,
+ const std::vector<IN_T> &TABLE,
digital::trellis_metric_type_t TYPE);
- ~@IMPL_NAME@();
+ ~viterbi_combined_impl();
fsm FSM() const { return d_FSM; }
int K() const { return d_K; }
int S0() const { return d_S0; }
int SK() const { return d_SK; }
int D() const { return d_D; }
- std::vector<@I_TYPE@> TABLE() const { return d_TABLE; }
+ std::vector<IN_T> TABLE() const { return d_TABLE; }
digital::trellis_metric_type_t TYPE() const { return d_TYPE; }
//std::vector<int> trace() const { return d_trace; }
@@ -63,7 +62,7 @@ namespace gr {
void set_S0(int S0);
void set_SK(int SK);
void set_D(int D);
- void set_TABLE(const std::vector<@I_TYPE@> &table);
+ void set_TABLE(const std::vector<IN_T> &table);
void set_TYPE(digital::trellis_metric_type_t type);
void forecast(int noutput_items,
@@ -78,4 +77,4 @@ namespace gr {
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* VITERBI_COMBINED_IMPL_H */
diff --git a/gr-trellis/lib/viterbi_X_impl.cc.t b/gr-trellis/lib/viterbi_impl.cc
index c9592a299c..745109997f 100644
--- a/gr-trellis/lib/viterbi_X_impl.cc.t
+++ b/gr-trellis/lib/viterbi_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,73 +20,78 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@NAME@.h"
+#include "viterbi_impl.h"
#include <gnuradio/io_signature.h>
#include <iostream>
namespace gr {
namespace trellis {
- static const float INF = 1.0e9;
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(const fsm &FSM, int K,
+ template <class T>
+ typename viterbi<T>::sptr
+ viterbi<T>::make(const fsm &FSM, int K,
int S0, int SK)
{
return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(FSM, K, S0, SK));
+ (new viterbi_impl<T>(FSM, K, S0, SK));
}
- @IMPL_NAME@::@IMPL_NAME@(const fsm &FSM, int K,
+ template <class T>
+ viterbi_impl<T>::viterbi_impl(const fsm &FSM, int K,
int S0, int SK)
- : block("@BASE_NAME@",
+ : block("viterbi",
io_signature::make(1, -1, sizeof(float)),
- io_signature::make(1, -1, sizeof(@TYPE@))),
+ io_signature::make(1, -1, sizeof(T))),
d_FSM(FSM), d_K(K), d_S0(S0), d_SK(SK)//,
//d_trace(FSM.S()*K)
{
- set_relative_rate(1, (uint64_t)d_FSM.O());
- set_output_multiple(d_K);
+ this->set_relative_rate(1, (uint64_t)d_FSM.O());
+ this->set_output_multiple(d_K);
}
- void @IMPL_NAME@::set_FSM(const fsm &FSM)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_FSM = FSM;
- set_relative_rate(1, (uint64_t)d_FSM.O());
+ template <class T>
+ void viterbi_impl<T>::set_FSM(const fsm &FSM)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_FSM = FSM;
+ this->set_relative_rate(1, (uint64_t)d_FSM.O());
}
- void @IMPL_NAME@::set_K(int K)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_K = K;
- set_output_multiple(d_K);
+ template <class T>
+ void viterbi_impl<T>::set_K(int K)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_K = K;
+ this->set_output_multiple(d_K);
}
- void @IMPL_NAME@::set_S0(int S0)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_S0 = S0;
+ template <class T>
+ void viterbi_impl<T>::set_S0(int S0)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_S0 = S0;
}
- void @IMPL_NAME@::set_SK(int SK)
- {
- gr::thread::scoped_lock guard(d_setlock);
- d_SK = SK;
+ template <class T>
+ void viterbi_impl<T>::set_SK(int SK)
+ {
+ gr::thread::scoped_lock guard(this->d_setlock);
+ d_SK = SK;
}
- @IMPL_NAME@::~@IMPL_NAME@()
+ template <class T>
+ viterbi_impl<T>::~viterbi_impl()
{
}
+ template <class T>
void
- @IMPL_NAME@::forecast(int noutput_items,
+ viterbi_impl<T>::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
int input_required = d_FSM.O() * noutput_items;
@@ -96,19 +101,20 @@ namespace gr {
}
}
+ template <class T>
int
- @IMPL_NAME@::general_work(int noutput_items,
+ viterbi_impl<T>::general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- gr::thread::scoped_lock guard(d_setlock);
+ gr::thread::scoped_lock guard(this->d_setlock);
int nstreams = input_items.size();
int nblocks = noutput_items / d_K;
for(int m = 0; m < nstreams; m++) {
const float *in = (const float*)input_items[m];
- @TYPE@ *out = (@TYPE@*)output_items[m];
+ T *out = (T*)output_items[m];
for(int n = 0; n < nblocks; n++) {
viterbi_algorithm(d_FSM.I(), d_FSM.S(), d_FSM.O(),
@@ -118,9 +124,12 @@ namespace gr {
}
}
- consume_each(d_FSM.O() * noutput_items);
+ this->consume_each(d_FSM.O() * noutput_items);
return noutput_items;
}
+template class viterbi<std::uint8_t>;
+template class viterbi<std::int16_t>;
+template class viterbi<std::int32_t>;
} /* namespace trellis */
} /* namespace gr */
diff --git a/gr-trellis/lib/viterbi_X_impl.h.t b/gr-trellis/lib/viterbi_impl.h
index 1479ad5a3f..c9f40a0b79 100644
--- a/gr-trellis/lib/viterbi_X_impl.h.t
+++ b/gr-trellis/lib/viterbi_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,17 +20,17 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef VITERBI_IMPL_H
+#define VITERBI_IMPL_H
-#include <gnuradio/trellis/@BASE_NAME@.h>
+#include <gnuradio/trellis/viterbi.h>
namespace gr {
namespace trellis {
- class @IMPL_NAME@ : public @BASE_NAME@
+template<class T>
+ class viterbi_impl : public viterbi<T>
{
private:
fsm d_FSM;
@@ -40,9 +40,9 @@ namespace gr {
//std::vector<int> d_trace;
public:
- @IMPL_NAME@(const fsm &FSM, int K,
+ viterbi_impl(const fsm &FSM, int K,
int S0, int SK);
- ~@IMPL_NAME@();
+ ~viterbi_impl();
fsm FSM() const { return d_FSM; }
int K() const { return d_K; }
@@ -66,4 +66,4 @@ namespace gr {
} /* namespace trellis */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* VITERBI_IMPL_H */