Skip to content

Commit

Permalink
src: add virtual and override to destructors
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
  • Loading branch information
Adrian-Stanea committed Aug 30, 2024
1 parent 370381e commit 209056a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/analog/m2kanalogin_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/analog/m2kanalogout_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class M2kAnalogOutImpl : public M2kAnalogOut
{
public:
M2kAnalogOutImpl(struct iio_context*, std::vector<std::string> dac_devs, bool sync, M2kHardwareTrigger *trigger);
virtual ~M2kAnalogOutImpl();
virtual ~M2kAnalogOutImpl() override;

void reset() override;
std::vector<int> getOversamplingRatio() override;
Expand Down
2 changes: 1 addition & 1 deletion src/digital/m2kdigital_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 1 addition & 2 deletions src/m2khardwaretrigger_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 209056a

Please sign in to comment.