diff options
author | Thomas Habets <thomas@habets.se> | 2020-08-12 11:11:11 +0100 |
---|---|---|
committer | Martin Braun <martin@gnuradio.org> | 2020-08-14 04:08:48 -0700 |
commit | c85820204393722564a7d697cbd77b4f5aa09bea (patch) | |
tree | 55c5044aecd973ae5726dfd63d8fa35035cbdc86 /gr-digital/lib/symbol_sync_cc_impl.h | |
parent | b5fb4c2eb54164ab57750878fd185b8170823711 (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).
Diffstat (limited to 'gr-digital/lib/symbol_sync_cc_impl.h')
-rw-r--r-- | gr-digital/lib/symbol_sync_cc_impl.h | 22 |
1 files changed, 11 insertions, 11 deletions
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; |