summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Habets <thomas@habets.se>2019-12-21 17:49:46 +0000
committerMarcus Müller <marcus@hostalia.de>2020-01-02 23:43:00 +0100
commit067e336102603ccb0cbf92d3d2a8497f1182618b (patch)
treee6203e1e61b41f5afed2d591f61218033c304217
parent63be774868b8de73ccc20b8151a30ad88ea971cb (diff)
gr-digital/symbol_sync: Remove needless memory management
-rw-r--r--gr-digital/lib/symbol_sync_cc_impl.cc23
-rw-r--r--gr-digital/lib/symbol_sync_cc_impl.h7
2 files changed, 10 insertions, 20 deletions
diff --git a/gr-digital/lib/symbol_sync_cc_impl.cc b/gr-digital/lib/symbol_sync_cc_impl.cc
index 66009ff58b..2e358bb991 100644
--- a/gr-digital/lib/symbol_sync_cc_impl.cc
+++ b/gr-digital/lib/symbol_sync_cc_impl.cc
@@ -72,8 +72,6 @@ symbol_sync_cc_impl::symbol_sync_cc_impl(enum ted_type detector_type,
: 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(NULL),
- d_interp(NULL),
d_inst_output_period(sps / static_cast<float>(osps)),
d_inst_clock_period(sps),
d_avg_clock_period(sps),
@@ -105,14 +103,14 @@ 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 = timing_error_detector::make(detector_type, slicer);
- if (d_ted == NULL)
+ 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 = interpolating_resampler_ccf::make(
- interp_type, d_ted->needs_derivative(), n_filters, taps);
- if (d_interp == NULL)
+ 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");
// Block Internal Clocks
@@ -136,8 +134,8 @@ symbol_sync_cc_impl::symbol_sync_cc_impl(enum ted_type detector_type,
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);
+ 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();
@@ -153,13 +151,6 @@ symbol_sync_cc_impl::symbol_sync_cc_impl(enum ted_type detector_type,
set_output_multiple(d_osps_n);
}
-symbol_sync_cc_impl::~symbol_sync_cc_impl()
-{
- delete d_ted;
- delete d_interp;
- delete d_clock;
-}
-
//
// Block Internal Clocks
//
diff --git a/gr-digital/lib/symbol_sync_cc_impl.h b/gr-digital/lib/symbol_sync_cc_impl.h
index 2251163097..e203db2a39 100644
--- a/gr-digital/lib/symbol_sync_cc_impl.h
+++ b/gr-digital/lib/symbol_sync_cc_impl.h
@@ -45,7 +45,6 @@ public:
ir_type interp_type,
int n_filters,
const std::vector<float>& taps);
- ~symbol_sync_cc_impl();
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
int general_work(int noutput_items,
@@ -71,13 +70,13 @@ public:
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;
+ std::unique_ptr<clock_tracking_loop> d_clock;
// Interpolator and Interpolator Positioning and Alignment
- interpolating_resampler_ccf* d_interp;
+ std::unique_ptr<interpolating_resampler_ccf> d_interp;
// Block Internal Clocks
// 4 clocks that run synchronously, aligned to the Symbol Clock: