From 528f88fc6e0db48e6f55634a88fd81eb1781c06e Mon Sep 17 00:00:00 2001 From: Adrian Stanea Date: Thu, 29 Aug 2024 15:35:44 +0300 Subject: [PATCH] src: add virtual and override to destructors - Use the 'override' keyword to explicitly denote that the base class destructor is virtual. - Implement virtual destructors to guarantee their invocation when utilizing pointers to the base class, ensuring proper resource cleanup across the inheritance hierarchy. Signed-off-by: Adrian Stanea --- src/analog/m2kanalogin_impl.hpp | 4 ++-- src/analog/m2kanalogout_impl.hpp | 2 +- src/digital/m2kdigital_impl.hpp | 2 +- src/m2khardwaretrigger_impl.hpp | 3 +-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/analog/m2kanalogin_impl.hpp b/src/analog/m2kanalogin_impl.hpp index 2e409c7d..5c314da1 100644 --- a/src/analog/m2kanalogin_impl.hpp +++ b/src/analog/m2kanalogin_impl.hpp @@ -35,8 +35,8 @@ namespace analog { class M2kAnalogInImpl : public M2kAnalogIn { public: - M2kAnalogInImpl(struct iio_context*, std::string adc_dev, bool sync, M2kHardwareTrigger *trigger); - ~M2kAnalogInImpl() override; + M2kAnalogInImpl(struct iio_context*, std::string adc_dev, bool sync, M2kHardwareTrigger *trigger); + virtual ~M2kAnalogInImpl() override; void reset() override; void startAcquisition(unsigned int nb_samples) override; diff --git a/src/analog/m2kanalogout_impl.hpp b/src/analog/m2kanalogout_impl.hpp index 2817a209..2c84b64d 100644 --- a/src/analog/m2kanalogout_impl.hpp +++ b/src/analog/m2kanalogout_impl.hpp @@ -22,7 +22,7 @@ class M2kAnalogOutImpl : public M2kAnalogOut { public: M2kAnalogOutImpl(struct iio_context*, std::vector dac_devs, bool sync, M2kHardwareTrigger *trigger); - virtual ~M2kAnalogOutImpl(); + virtual ~M2kAnalogOutImpl() override; void reset() override; std::vector getOversamplingRatio() override; diff --git a/src/digital/m2kdigital_impl.hpp b/src/digital/m2kdigital_impl.hpp index 4b8a72a8..d85a5b6d 100644 --- a/src/digital/m2kdigital_impl.hpp +++ b/src/digital/m2kdigital_impl.hpp @@ -39,7 +39,7 @@ class M2kDigitalImpl : public M2kDigital { public: M2kDigitalImpl(struct iio_context* ctx, std::string logic_dev, bool sync, M2kHardwareTrigger *trigger); - virtual ~M2kDigitalImpl(); + virtual ~M2kDigitalImpl() override; void reset() override; diff --git a/src/m2khardwaretrigger_impl.hpp b/src/m2khardwaretrigger_impl.hpp index 37b7367a..d11fbf30 100644 --- a/src/m2khardwaretrigger_impl.hpp +++ b/src/m2khardwaretrigger_impl.hpp @@ -41,8 +41,7 @@ class M2kHardwareTriggerImpl : public M2kHardwareTrigger { public: M2kHardwareTriggerImpl(struct iio_context *ctx, bool init = true); - - virtual ~M2kHardwareTriggerImpl(); + virtual ~M2kHardwareTriggerImpl() override; void reset() override;