summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Habets <thomas@habets.se>2020-08-12 11:11:11 +0100
committerMartin Braun <martin@gnuradio.org>2020-08-14 04:08:48 -0700
commitc85820204393722564a7d697cbd77b4f5aa09bea (patch)
tree55c5044aecd973ae5726dfd63d8fa35035cbdc86
parentb5fb4c2eb54164ab57750878fd185b8170823711 (diff)
digital/symbol_sync: Remove manual memory management
The `cc` version already used more smart pointers, but `d_clock` didn't need to be a pointer at all. I consted function args to make it clear in the initializer that they will not be changed in the constructor body. Return value for `make` for the TED and interpolator was changed to a `unique_ptr` to make it clear that ownership is transferred. And it makes it all but impossible to accidentally memory leak. (core guidelines F.26. Also relevant I.11,R.20).
-rw-r--r--gr-digital/lib/interpolating_resampler.cc40
-rw-r--r--gr-digital/lib/interpolating_resampler.h4
-rw-r--r--gr-digital/lib/symbol_sync_cc_impl.cc64
-rw-r--r--gr-digital/lib/symbol_sync_cc_impl.h22
-rw-r--r--gr-digital/lib/symbol_sync_ff_impl.cc72
-rw-r--r--gr-digital/lib/symbol_sync_ff_impl.h26
-rw-r--r--gr-digital/lib/timing_error_detector.cc39
-rw-r--r--gr-digital/lib/timing_error_detector.h2
8 files changed, 118 insertions, 151 deletions
diff --git a/gr-digital/lib/interpolating_resampler.cc b/gr-digital/lib/interpolating_resampler.cc
index 85cae852f8..1fa78dae63 100644
--- a/gr-digital/lib/interpolating_resampler.cc
+++ b/gr-digital/lib/interpolating_resampler.cc
@@ -93,52 +93,40 @@ void interpolating_resampler::sync_reset(float phase)
/*************************************************************************/
-interpolating_resampler_ccf* interpolating_resampler_ccf::make(
+std::unique_ptr<interpolating_resampler_ccf> interpolating_resampler_ccf::make(
enum ir_type type, bool derivative, int nfilts, const std::vector<float>& taps)
{
- interpolating_resampler_ccf* ret = NULL;
switch (type) {
case IR_MMSE_8TAP:
- ret = new interp_resampler_mmse_8tap_cc(derivative);
- break;
+ return boost::make_unique<interp_resampler_mmse_8tap_cc>(derivative);
case IR_PFB_NO_MF:
- ret = new interp_resampler_pfb_no_mf_cc(derivative, nfilts);
- break;
+ return boost::make_unique<interp_resampler_pfb_no_mf_cc>(derivative, nfilts);
case IR_PFB_MF:
- ret = new interp_resampler_pfb_mf_ccf(taps, nfilts, derivative);
- break;
+ return boost::make_unique<interp_resampler_pfb_mf_ccf>(taps, nfilts, derivative);
case IR_NONE:
- default:
- throw std::invalid_argument("interpolating_resampler_ccf: invalid "
- "interpolating resampler type.");
- break;
+ return nullptr;
}
- return ret;
+ throw std::invalid_argument("interpolating_resampler_ccf: invalid "
+ "interpolating resampler type.");
}
/*************************************************************************/
-interpolating_resampler_fff* interpolating_resampler_fff::make(
+std::unique_ptr<interpolating_resampler_fff> interpolating_resampler_fff::make(
enum ir_type type, bool derivative, int nfilts, const std::vector<float>& taps)
{
- interpolating_resampler_fff* ret = NULL;
switch (type) {
case IR_MMSE_8TAP:
- ret = new interp_resampler_mmse_8tap_ff(derivative);
- break;
+ return boost::make_unique<interp_resampler_mmse_8tap_ff>(derivative);
case IR_PFB_NO_MF:
- ret = new interp_resampler_pfb_no_mf_ff(derivative, nfilts);
- break;
+ return boost::make_unique<interp_resampler_pfb_no_mf_ff>(derivative, nfilts);
case IR_PFB_MF:
- ret = new interp_resampler_pfb_mf_fff(taps, nfilts, derivative);
- break;
+ return boost::make_unique<interp_resampler_pfb_mf_fff>(taps, nfilts, derivative);
case IR_NONE:
- default:
- throw std::invalid_argument("interpolating_resampler_fff: invalid "
- "interpolating resampler type.");
- break;
+ return nullptr;
}
- return ret;
+ throw std::invalid_argument("interpolating_resampler_fff: invalid "
+ "interpolating resampler type.");
}
/*************************************************************************/
diff --git a/gr-digital/lib/interpolating_resampler.h b/gr-digital/lib/interpolating_resampler.h
index 2c64667ebc..439b46ac3b 100644
--- a/gr-digital/lib/interpolating_resampler.h
+++ b/gr-digital/lib/interpolating_resampler.h
@@ -160,7 +160,7 @@ public:
* \param taps Prototype filter for the polyphase filter bank. Only
* needed for some types.
*/
- static interpolating_resampler_ccf*
+ static std::unique_ptr<interpolating_resampler_ccf>
make(enum ir_type type,
bool derivative = false,
int nfilts = 32,
@@ -222,7 +222,7 @@ public:
* \param taps Prototype filter for the polyphase filter bank. Only
* needed for some types.
*/
- static interpolating_resampler_fff*
+ static std::unique_ptr<interpolating_resampler_fff>
make(enum ir_type type,
bool derivative = false,
int nfilts = 32,
diff --git a/gr-digital/lib/symbol_sync_cc_impl.cc b/gr-digital/lib/symbol_sync_cc_impl.cc
index 6446b25701..9a24cfbbf6 100644
--- a/gr-digital/lib/symbol_sync_cc_impl.cc
+++ b/gr-digital/lib/symbol_sync_cc_impl.cc
@@ -47,26 +47,33 @@ symbol_sync_cc::sptr symbol_sync_cc::make(enum ted_type detector_type,
}
symbol_sync_cc_impl::symbol_sync_cc_impl(enum ted_type detector_type,
- float sps,
- float loop_bw,
- float damping_factor,
- float ted_gain,
- float max_deviation,
- int osps,
+ const float sps,
+ const float loop_bw,
+ const float damping_factor,
+ const float ted_gain,
+ const float max_deviation,
+ const int osps,
constellation_sptr slicer,
- ir_type interp_type,
- int n_filters,
+ const ir_type interp_type,
+ const int n_filters,
const std::vector<float>& taps)
: block("symbol_sync_cc",
io_signature::make(1, 1, sizeof(gr_complex)),
io_signature::makev(1, 4, std::vector<int>(4, sizeof(float)))),
+ d_ted(timing_error_detector::make(detector_type, slicer)),
+ d_clock(loop_bw,
+ sps + max_deviation,
+ sps - max_deviation,
+ sps,
+ damping_factor,
+ ted_gain),
+ d_interp(interpolating_resampler_ccf::make(
+ interp_type, d_ted->needs_derivative(), n_filters, taps)),
d_inst_output_period(sps / static_cast<float>(osps)),
d_inst_clock_period(sps),
d_avg_clock_period(sps),
d_osps(static_cast<float>(osps)),
d_osps_n(osps),
- d_tags(),
- d_new_tags(),
d_time_est_key(pmt::intern("time_est")),
d_clock_est_key(pmt::intern("clock_est")),
d_noutputs(1),
@@ -84,13 +91,10 @@ symbol_sync_cc_impl::symbol_sync_cc_impl(enum ted_type detector_type,
throw std::out_of_range("output samples per symbol must be > 0");
// Timing Error Detector
- d_ted.reset(timing_error_detector::make(detector_type, slicer));
if (d_ted == nullptr)
throw std::runtime_error("unable to create timing_error_detector");
// Interpolating Resampler
- d_interp.reset(interpolating_resampler_ccf::make(
- interp_type, d_ted->needs_derivative(), n_filters, taps));
if (d_interp == nullptr)
throw std::runtime_error("unable to create interpolating_resampler_ccf");
@@ -114,14 +118,6 @@ symbol_sync_cc_impl::symbol_sync_cc_impl(enum ted_type detector_type,
"increasing sps") %
d_interps_per_symbol % sps);
- // Symbol Clock Tracking and Estimation
- d_clock.reset(new clock_tracking_loop(loop_bw,
- sps + max_deviation,
- sps - max_deviation,
- sps,
- damping_factor,
- ted_gain));
-
// Timing Error Detector
d_ted->sync_reset();
@@ -220,7 +216,7 @@ bool symbol_sync_cc_impl::find_sync_tag(uint64_t nitems_rd,
// got a time_est tag
timing_offset = static_cast<float>(pmt::to_double(t->value));
// next instantaneous clock period estimate will be nominal
- clock_period = d_clock->get_nom_avg_period();
+ clock_period = d_clock.get_nom_avg_period();
// Look for a clock_est tag at the same offset,
// as we prefer clock_est tags
@@ -375,11 +371,11 @@ void symbol_sync_cc_impl::forecast(int noutput_items,
// least one output sample, even if the main loop decides it has to
// revert one computed sample and wait for the next call to
// general_work().
- // The d_clock->get_max_avg_period() is also an effort to do the same,
+ // The d_clock.get_max_avg_period() is also an effort to do the same,
// in case we have the worst case allowable clock timing deviation on
// input.
const int answer = static_cast<int>(ceilf(static_cast<float>(noutput_items + 2) *
- d_clock->get_max_avg_period() / d_osps)) +
+ d_clock.get_max_avg_period() / d_osps)) +
static_cast<int>(d_interp->ntaps());
for (unsigned i = 0; i < ninputs; i++)
@@ -442,7 +438,7 @@ int symbol_sync_cc_impl::general_work(int noutput_items,
// We must interpolate ahead to the *next* ted_input_clock, so the
// ted will compute the error for *this* symbol.
d_interp->next_phase(d_interps_per_ted_input *
- (d_clock->get_inst_period() / d_interps_per_symbol),
+ (d_clock.get_inst_period() / d_interps_per_symbol),
look_ahead_phase,
look_ahead_phase_n,
look_ahead_phase_wrapped);
@@ -478,10 +474,10 @@ int symbol_sync_cc_impl::general_work(int noutput_items,
if (symbol_clock()) {
// Symbol Clock Tracking and Estimation
- d_clock->advance_loop(error);
- d_inst_clock_period = d_clock->get_inst_period();
- d_avg_clock_period = d_clock->get_avg_period();
- d_clock->phase_wrap();
+ d_clock.advance_loop(error);
+ d_inst_clock_period = d_clock.get_inst_period();
+ d_avg_clock_period = d_clock.get_avg_period();
+ d_clock.phase_wrap();
// Symbol Clock and Interpolator Positioning & Alignment
d_inst_interp_period = d_inst_clock_period / d_interps_per_symbol;
@@ -512,7 +508,7 @@ int symbol_sync_cc_impl::general_work(int noutput_items,
// Revert the actions we took in the loop so far, and bail out.
// Symbol Clock Tracking and Estimation
- d_clock->revert_loop();
+ d_clock.revert_loop();
// Timing Error Detector
d_ted->revert();
@@ -556,10 +552,10 @@ int symbol_sync_cc_impl::general_work(int noutput_items,
1) +
sync_timing_offset - d_interp->phase_wrapped();
- d_clock->set_inst_period(d_inst_clock_period);
- d_clock->set_avg_period(sync_clock_period);
- d_avg_clock_period = d_clock->get_avg_period();
- d_clock->set_phase(0.0f);
+ d_clock.set_inst_period(d_inst_clock_period);
+ d_clock.set_avg_period(sync_clock_period);
+ d_avg_clock_period = d_clock.get_avg_period();
+ d_clock.set_phase(0.0f);
// Symbol Clock and Interpolator Positioning & Alignment
d_inst_interp_period = d_inst_clock_period;
diff --git a/gr-digital/lib/symbol_sync_cc_impl.h b/gr-digital/lib/symbol_sync_cc_impl.h
index bbe6a13281..a1cb1e39e7 100644
--- a/gr-digital/lib/symbol_sync_cc_impl.h
+++ b/gr-digital/lib/symbol_sync_cc_impl.h
@@ -41,27 +41,27 @@ public:
gr_vector_void_star& output_items);
// Symbol Clock Tracking and Estimation
- float loop_bandwidth() const { return d_clock->get_loop_bandwidth(); }
- float damping_factor() const { return d_clock->get_damping_factor(); }
- float ted_gain() const { return d_clock->get_ted_gain(); }
- float alpha() const { return d_clock->get_alpha(); }
- float beta() const { return d_clock->get_beta(); }
+ float loop_bandwidth() const { return d_clock.get_loop_bandwidth(); }
+ float damping_factor() const { return d_clock.get_damping_factor(); }
+ float ted_gain() const { return d_clock.get_ted_gain(); }
+ float alpha() const { return d_clock.get_alpha(); }
+ float beta() const { return d_clock.get_beta(); }
void set_loop_bandwidth(float omega_n_norm)
{
- d_clock->set_loop_bandwidth(omega_n_norm);
+ d_clock.set_loop_bandwidth(omega_n_norm);
}
- void set_damping_factor(float zeta) { d_clock->set_damping_factor(zeta); }
- void set_ted_gain(float ted_gain) { d_clock->set_ted_gain(ted_gain); }
- void set_alpha(float alpha) { d_clock->set_alpha(alpha); }
- void set_beta(float beta) { d_clock->set_beta(beta); }
+ void set_damping_factor(float zeta) { d_clock.set_damping_factor(zeta); }
+ void set_ted_gain(float ted_gain) { d_clock.set_ted_gain(ted_gain); }
+ void set_alpha(float alpha) { d_clock.set_alpha(alpha); }
+ void set_beta(float beta) { d_clock.set_beta(beta); }
private:
// Timing Error Detector
std::unique_ptr<timing_error_detector> d_ted;
// Symbol Clock Tracking and Estimation
- std::unique_ptr<clock_tracking_loop> d_clock;
+ clock_tracking_loop d_clock;
// Interpolator and Interpolator Positioning and Alignment
std::unique_ptr<interpolating_resampler_ccf> d_interp;
diff --git a/gr-digital/lib/symbol_sync_ff_impl.cc b/gr-digital/lib/symbol_sync_ff_impl.cc
index 82493f565c..1df9a437c4 100644
--- a/gr-digital/lib/symbol_sync_ff_impl.cc
+++ b/gr-digital/lib/symbol_sync_ff_impl.cc
@@ -47,21 +47,28 @@ symbol_sync_ff::sptr symbol_sync_ff::make(enum ted_type detector_type,
}
symbol_sync_ff_impl::symbol_sync_ff_impl(enum ted_type detector_type,
- float sps,
- float loop_bw,
- float damping_factor,
- float ted_gain,
- float max_deviation,
- int osps,
+ const float sps,
+ const float loop_bw,
+ const float damping_factor,
+ const float ted_gain,
+ const float max_deviation,
+ const int osps,
constellation_sptr slicer,
- ir_type interp_type,
- int n_filters,
+ const ir_type interp_type,
+ const int n_filters,
const std::vector<float>& taps)
: block("symbol_sync_ff",
io_signature::make(1, 1, sizeof(float)),
io_signature::makev(1, 4, std::vector<int>(4, sizeof(float)))),
- d_ted(NULL),
- d_interp(NULL),
+ d_ted(timing_error_detector::make(detector_type, slicer)),
+ d_clock(loop_bw,
+ sps + max_deviation,
+ sps - max_deviation,
+ sps,
+ damping_factor,
+ ted_gain),
+ d_interp(interpolating_resampler_fff::make(
+ interp_type, d_ted->needs_derivative(), n_filters, taps)),
d_inst_output_period(sps / static_cast<float>(osps)),
d_inst_clock_period(sps),
d_avg_clock_period(sps),
@@ -85,15 +92,11 @@ symbol_sync_ff_impl::symbol_sync_ff_impl(enum ted_type detector_type,
if (osps < 1)
throw std::out_of_range("output samples per symbol must be > 0");
- // Timing Error Detector
- d_ted = timing_error_detector::make(detector_type, slicer);
- if (d_ted == NULL)
+ if (d_ted == nullptr)
throw std::runtime_error("unable to create timing_error_detector");
// Interpolating Resampler
- d_interp = interpolating_resampler_fff::make(
- interp_type, d_ted->needs_derivative(), n_filters, taps);
- if (d_interp == NULL)
+ if (d_interp == nullptr)
throw std::runtime_error("unable to create interpolating_resampler_fff");
// Block Internal Clocks
@@ -116,10 +119,6 @@ symbol_sync_ff_impl::symbol_sync_ff_impl(enum ted_type detector_type,
"increasing sps") %
d_interps_per_symbol % sps);
- // Symbol Clock Tracking and Estimation
- d_clock = new clock_tracking_loop(
- loop_bw, sps + max_deviation, sps - max_deviation, sps, damping_factor, ted_gain);
-
// Timing Error Detector
d_ted->sync_reset();
@@ -134,12 +133,7 @@ symbol_sync_ff_impl::symbol_sync_ff_impl(enum ted_type detector_type,
set_output_multiple(d_osps_n);
}
-symbol_sync_ff_impl::~symbol_sync_ff_impl()
-{
- delete d_ted;
- delete d_interp;
- delete d_clock;
-}
+symbol_sync_ff_impl::~symbol_sync_ff_impl() {}
//
// Block Internal Clocks
@@ -225,7 +219,7 @@ bool symbol_sync_ff_impl::find_sync_tag(uint64_t nitems_rd,
// got a time_est tag
timing_offset = static_cast<float>(pmt::to_double(t->value));
// next instantaneous clock period estimate will be nominal
- clock_period = d_clock->get_nom_avg_period();
+ clock_period = d_clock.get_nom_avg_period();
// Look for a clock_est tag at the same offset,
// as we prefer clock_est tags
@@ -380,11 +374,11 @@ void symbol_sync_ff_impl::forecast(int noutput_items,
// least one output sample, even if the main loop decides it has to
// revert one computed sample and wait for the next call to
// general_work().
- // The d_clock->get_max_avg_period() is also an effort to do the same,
+ // The d_clock.get_max_avg_period() is also an effort to do the same,
// in case we have the worst case allowable clock timing deviation on
// input.
const int answer = static_cast<int>(ceilf(static_cast<float>(noutput_items + 2) *
- d_clock->get_max_avg_period() / d_osps)) +
+ d_clock.get_max_avg_period() / d_osps)) +
static_cast<int>(d_interp->ntaps());
for (unsigned i = 0; i < ninputs; i++)
@@ -447,7 +441,7 @@ int symbol_sync_ff_impl::general_work(int noutput_items,
// We must interpolate ahead to the *next* ted_input_clock, so the
// ted will compute the error for *this* symbol.
d_interp->next_phase(d_interps_per_ted_input *
- (d_clock->get_inst_period() / d_interps_per_symbol),
+ (d_clock.get_inst_period() / d_interps_per_symbol),
look_ahead_phase,
look_ahead_phase_n,
look_ahead_phase_wrapped);
@@ -483,10 +477,10 @@ int symbol_sync_ff_impl::general_work(int noutput_items,
if (symbol_clock()) {
// Symbol Clock Tracking and Estimation
- d_clock->advance_loop(error);
- d_inst_clock_period = d_clock->get_inst_period();
- d_avg_clock_period = d_clock->get_avg_period();
- d_clock->phase_wrap();
+ d_clock.advance_loop(error);
+ d_inst_clock_period = d_clock.get_inst_period();
+ d_avg_clock_period = d_clock.get_avg_period();
+ d_clock.phase_wrap();
// Symbol Clock and Interpolator Positioning & Alignment
d_inst_interp_period = d_inst_clock_period / d_interps_per_symbol;
@@ -517,7 +511,7 @@ int symbol_sync_ff_impl::general_work(int noutput_items,
// Revert the actions we took in the loop so far, and bail out.
// Symbol Clock Tracking and Estimation
- d_clock->revert_loop();
+ d_clock.revert_loop();
// Timing Error Detector
d_ted->revert();
@@ -561,10 +555,10 @@ int symbol_sync_ff_impl::general_work(int noutput_items,
1) +
sync_timing_offset - d_interp->phase_wrapped();
- d_clock->set_inst_period(d_inst_clock_period);
- d_clock->set_avg_period(sync_clock_period);
- d_avg_clock_period = d_clock->get_avg_period();
- d_clock->set_phase(0.0f);
+ d_clock.set_inst_period(d_inst_clock_period);
+ d_clock.set_avg_period(sync_clock_period);
+ d_avg_clock_period = d_clock.get_avg_period();
+ d_clock.set_phase(0.0f);
// Symbol Clock and Interpolator Positioning & Alignment
d_inst_interp_period = d_inst_clock_period;
diff --git a/gr-digital/lib/symbol_sync_ff_impl.h b/gr-digital/lib/symbol_sync_ff_impl.h
index f0abf56a42..d8e3164ce6 100644
--- a/gr-digital/lib/symbol_sync_ff_impl.h
+++ b/gr-digital/lib/symbol_sync_ff_impl.h
@@ -42,30 +42,30 @@ public:
gr_vector_void_star& output_items);
// Symbol Clock Tracking and Estimation
- float loop_bandwidth() const { return d_clock->get_loop_bandwidth(); }
- float damping_factor() const { return d_clock->get_damping_factor(); }
- float ted_gain() const { return d_clock->get_ted_gain(); }
- float alpha() const { return d_clock->get_alpha(); }
- float beta() const { return d_clock->get_beta(); }
+ float loop_bandwidth() const { return d_clock.get_loop_bandwidth(); }
+ float damping_factor() const { return d_clock.get_damping_factor(); }
+ float ted_gain() const { return d_clock.get_ted_gain(); }
+ float alpha() const { return d_clock.get_alpha(); }
+ float beta() const { return d_clock.get_beta(); }
void set_loop_bandwidth(float omega_n_norm)
{
- d_clock->set_loop_bandwidth(omega_n_norm);
+ d_clock.set_loop_bandwidth(omega_n_norm);
}
- void set_damping_factor(float zeta) { d_clock->set_damping_factor(zeta); }
- void set_ted_gain(float ted_gain) { d_clock->set_ted_gain(ted_gain); }
- void set_alpha(float alpha) { d_clock->set_alpha(alpha); }
- void set_beta(float beta) { d_clock->set_beta(beta); }
+ void set_damping_factor(float zeta) { d_clock.set_damping_factor(zeta); }
+ void set_ted_gain(float ted_gain) { d_clock.set_ted_gain(ted_gain); }
+ void set_alpha(float alpha) { d_clock.set_alpha(alpha); }
+ void set_beta(float beta) { d_clock.set_beta(beta); }
private:
// Timing Error Detector
- timing_error_detector* d_ted;
+ std::unique_ptr<timing_error_detector> d_ted;
// Symbol Clock Tracking and Estimation
- clock_tracking_loop* d_clock;
+ clock_tracking_loop d_clock;
// Interpolator and Interpolator Positioning and Alignment
- interpolating_resampler_fff* d_interp;
+ std::unique_ptr<interpolating_resampler_fff> d_interp;
// Block Internal Clocks
// 4 clocks that run synchronously, aligned to the Symbol Clock:
diff --git a/gr-digital/lib/timing_error_detector.cc b/gr-digital/lib/timing_error_detector.cc
index e1ceed151e..52bb063948 100644
--- a/gr-digital/lib/timing_error_detector.cc
+++ b/gr-digital/lib/timing_error_detector.cc
@@ -14,49 +14,38 @@
#include "timing_error_detector.h"
#include <gnuradio/math.h>
+#include <boost/make_unique.hpp>
#include <stdexcept>
namespace gr {
namespace digital {
-timing_error_detector* timing_error_detector::make(enum ted_type type,
- constellation_sptr constellation)
+std::unique_ptr<timing_error_detector>
+timing_error_detector::make(enum ted_type type, constellation_sptr constellation)
{
- timing_error_detector* ret = NULL;
switch (type) {
case TED_NONE:
- break;
+ return nullptr;
case TED_MUELLER_AND_MULLER:
- ret = new ted_mueller_and_muller(constellation);
- break;
+ return boost::make_unique<ted_mueller_and_muller>(constellation);
case TED_MOD_MUELLER_AND_MULLER:
- ret = new ted_mod_mueller_and_muller(constellation);
- break;
+ return boost::make_unique<ted_mod_mueller_and_muller>(constellation);
case TED_ZERO_CROSSING:
- ret = new ted_zero_crossing(constellation);
- break;
+ return boost::make_unique<ted_zero_crossing>(constellation);
case TED_GARDNER:
- ret = new ted_gardner();
- break;
+ return boost::make_unique<ted_gardner>();
case TED_EARLY_LATE:
- ret = new ted_early_late();
- break;
+ return boost::make_unique<ted_early_late>();
case TED_DANDREA_AND_MENGALI_GEN_MSK:
- ret = new ted_generalized_msk();
- break;
+ return boost::make_unique<ted_generalized_msk>();
case TED_SIGNAL_TIMES_SLOPE_ML:
- ret = new ted_signal_times_slope_ml();
- break;
+ return boost::make_unique<ted_signal_times_slope_ml>();
case TED_SIGNUM_TIMES_SLOPE_ML:
- ret = new ted_signum_times_slope_ml();
- break;
+ return boost::make_unique<ted_signum_times_slope_ml>();
case TED_MENGALI_AND_DANDREA_GMSK:
- ret = new ted_gaussian_msk();
- break;
- default:
- break;
+ return boost::make_unique<ted_gaussian_msk>();
}
- return ret;
+ return nullptr;
}
timing_error_detector::timing_error_detector(enum ted_type type,
diff --git a/gr-digital/lib/timing_error_detector.h b/gr-digital/lib/timing_error_detector.h
index e6de47697b..439be37b78 100644
--- a/gr-digital/lib/timing_error_detector.h
+++ b/gr-digital/lib/timing_error_detector.h
@@ -50,7 +50,7 @@ public:
* for decision directed timing error detector
* algorithms
*/
- static timing_error_detector*
+ static std::unique_ptr<timing_error_detector>
make(enum ted_type type, constellation_sptr constellation = constellation_sptr());
virtual ~timing_error_detector(){};