Add virtual destructor to classes

Add a virtual destructor to classes which have a virtual lock and
unlock.  Remove the virtual qualifier from functions in
InterruptManager since this class cannot be extended.
pull/1910/head
Russ Butler 2016-06-12 18:04:51 +01:00
parent 95c83935ac
commit 58d15f3007
4 changed files with 15 additions and 4 deletions

View File

@ -103,6 +103,10 @@ public:
}
#endif
virtual ~AnalogIn() {
// Do nothing
}
protected:
virtual void lock() {

View File

@ -122,6 +122,10 @@ public:
}
#endif
virtual ~AnalogOut() {
// Do nothing
}
protected:
virtual void lock() {

View File

@ -145,6 +145,10 @@ public:
*/
virtual void unlock(void);
virtual ~I2C() {
// Do nothing
}
#if DEVICE_I2C_ASYNCH
/** Start non-blocking I2C transfer.

View File

@ -113,14 +113,13 @@ public:
*/
bool remove_handler(pFunctionPointer_t handler, IRQn_Type irq);
protected:
virtual void lock();
virtual void unlock();
private:
InterruptManager();
~InterruptManager();
void lock();
void unlock();
// We declare the copy contructor and the assignment operator, but we don't
// implement them. This way, if someone tries to copy/assign our instance,
// he will get an error at compile time.