changed virtual to override

This commit is contained in:
Jonas Zeunert
2018-12-07 11:53:38 +01:00
parent 8fd5588d02
commit dc95c45d9b
15 changed files with 24 additions and 25 deletions

View File

@@ -22,7 +22,7 @@ class GPIOInterface
{
public:
GPIOInterface();
virtual ~GPIOInterface() {};
virtual ~GPIOInterface() = default;
protected:
static void initialize_input_pin(char address);

View File

@@ -23,7 +23,7 @@ EventHandler::EventHandler(std::shared_ptr<IInputDriver> input_driver) :
EventHandler::~EventHandler()
{
this->input_driver->unregister_event_handler(this);
this->input_driver = NULL;
this->input_driver = nullptr;
}
// This function is intended to be non pure, if it is called when the derived class doesn't exist anymore

View File

@@ -26,9 +26,9 @@ class EventHandler;
class EventHandler : public IEventHandler
{
public:
EventHandler(std::shared_ptr<IInputDriver> input_driver);
virtual ~EventHandler();
virtual void handle(Event& event);
explicit EventHandler(std::shared_ptr<IInputDriver> input_driver);
~EventHandler() override;
void handle(Event& event) override;
private:
std::shared_ptr<IInputDriver> input_driver;

View File

@@ -30,13 +30,13 @@ class EventNotifier : public IEventNotifier
{
public:
EventNotifier(utility::IBlockingQueue<Event>* queue);
~EventNotifier();
explicit EventNotifier(utility::IBlockingQueue<Event>* queue);
~EventNotifier() override;
void register_event_handler(IEventHandler* handler);
void unregister_event_handler(IEventHandler* handler);
void register_event_handler(IEventHandler* handler) override;
void unregister_event_handler(IEventHandler* handler) override;
void distribute_event(Event &event);
void distribute_event(Event &event) override;
private:
void notify();

View File

@@ -18,7 +18,7 @@ class IDetector
{
public:
virtual ~IDetector(){};
virtual ~IDetector() = default;
};
}

View File

@@ -20,7 +20,7 @@ namespace input
class IEventNotifier
{
public:
virtual ~IEventNotifier(){};
virtual ~IEventNotifier() = default;
virtual void register_event_handler(IEventHandler* handler) = 0;
virtual void unregister_event_handler(IEventHandler* handler) = 0;

View File

@@ -17,7 +17,7 @@ class IInputGPIOInterface
{
public:
virtual ~IInputGPIOInterface()
{};
= default;;
virtual bool read_data(char pin) = 0;
};

View File

@@ -24,10 +24,10 @@ class InputDriver : public IInputDriver
public:
InputDriver(std::shared_ptr<IEventNotifier> event_notifier, std::unique_ptr<IDetector> detector, std::map<std::string, std::shared_ptr<Event>> events);
virtual void register_event_handler(IEventHandler* handler) override;
virtual void unregister_event_handler(IEventHandler* handler) override;
void register_event_handler(IEventHandler* handler) override;
void unregister_event_handler(IEventHandler* handler) override;
virtual std::shared_ptr<Event> get_event(std::string name);
std::shared_ptr<Event> get_event(std::string name) override;
private:
std::shared_ptr<IEventNotifier> event_notifier;

View File

@@ -20,8 +20,8 @@ namespace input
class InputGPIOInterface : public IInputGPIOInterface, GPIOInterface
{
public:
InputGPIOInterface(std::istream &input_config);
bool read_data(char pin);
explicit InputGPIOInterface(std::istream &input_config);
bool read_data(char pin) override;
private:
void init_members(std::istream &input_config_stream);

View File

@@ -20,7 +20,7 @@ namespace output
class IOutputGPIOInterface
{
public:
virtual ~IOutputGPIOInterface(){};
virtual ~IOutputGPIOInterface() = default;
virtual void activate(items::IDriverBoardItem *driver_board_item) = 0;
virtual void activate(items::ISoundItem *sound) = 0;

View File

@@ -19,7 +19,7 @@ namespace items
class IDriverBoardItem : public IItem
{
public:
virtual ~IDriverBoardItem(){};
virtual ~IDriverBoardItem() = default;
};
}

View File

@@ -26,7 +26,7 @@ class Item : public IItem
{
public:
Item(std::shared_ptr<IOutputGPIOInterface> output_gpio_interface, uint8_t address, std::string name);
virtual ~Item();
~Item() override;
uint8_t get_address() override;

View File

@@ -34,7 +34,7 @@ public:
Sound(std::shared_ptr<IOutputGPIOInterface> output_gpio_interface, uint8_t address, std::string name, std::chrono::milliseconds deactivation_time, u_int id);
virtual ~Sound() = default;
virtual void play();
void play() override;
private:
std::chrono::milliseconds deactivation_time;

View File

@@ -16,8 +16,7 @@ template<typename T>
class IBlockingQueue
{
public:
virtual ~IBlockingQueue()
{};
virtual ~IBlockingQueue() = default;
virtual void push(T const &value) = 0;
virtual T pop() = 0;

View File

@@ -17,7 +17,7 @@ namespace utility
class InputSocketHandler : public SocketHandler, IEventHandler
{
public:
InputSocketHandler(boost::asio::io_service &service, std::string socket_file = "/var/run/user/" + std::to_string(getuid())
explicit InputSocketHandler(boost::asio::io_service &service, std::string socket_file = "/var/run/user/" + std::to_string(getuid())
+ "flippR/S.flippR_input");
void handle(input::Event &event) override;