changed virtual to override
This commit is contained in:
@@ -22,7 +22,7 @@ class GPIOInterface
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GPIOInterface();
|
GPIOInterface();
|
||||||
virtual ~GPIOInterface() {};
|
virtual ~GPIOInterface() = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void initialize_input_pin(char address);
|
static void initialize_input_pin(char address);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ EventHandler::EventHandler(std::shared_ptr<IInputDriver> input_driver) :
|
|||||||
EventHandler::~EventHandler()
|
EventHandler::~EventHandler()
|
||||||
{
|
{
|
||||||
this->input_driver->unregister_event_handler(this);
|
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
|
// This function is intended to be non pure, if it is called when the derived class doesn't exist anymore
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ class EventHandler;
|
|||||||
class EventHandler : public IEventHandler
|
class EventHandler : public IEventHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EventHandler(std::shared_ptr<IInputDriver> input_driver);
|
explicit EventHandler(std::shared_ptr<IInputDriver> input_driver);
|
||||||
virtual ~EventHandler();
|
~EventHandler() override;
|
||||||
virtual void handle(Event& event);
|
void handle(Event& event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<IInputDriver> input_driver;
|
std::shared_ptr<IInputDriver> input_driver;
|
||||||
|
|||||||
@@ -30,13 +30,13 @@ class EventNotifier : public IEventNotifier
|
|||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EventNotifier(utility::IBlockingQueue<Event>* queue);
|
explicit EventNotifier(utility::IBlockingQueue<Event>* queue);
|
||||||
~EventNotifier();
|
~EventNotifier() override;
|
||||||
|
|
||||||
void register_event_handler(IEventHandler* handler);
|
void register_event_handler(IEventHandler* handler) override;
|
||||||
void unregister_event_handler(IEventHandler* handler);
|
void unregister_event_handler(IEventHandler* handler) override;
|
||||||
|
|
||||||
void distribute_event(Event &event);
|
void distribute_event(Event &event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void notify();
|
void notify();
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class IDetector
|
|||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~IDetector(){};
|
virtual ~IDetector() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace input
|
|||||||
class IEventNotifier
|
class IEventNotifier
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~IEventNotifier(){};
|
virtual ~IEventNotifier() = default;
|
||||||
|
|
||||||
virtual void register_event_handler(IEventHandler* handler) = 0;
|
virtual void register_event_handler(IEventHandler* handler) = 0;
|
||||||
virtual void unregister_event_handler(IEventHandler* handler) = 0;
|
virtual void unregister_event_handler(IEventHandler* handler) = 0;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class IInputGPIOInterface
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~IInputGPIOInterface()
|
virtual ~IInputGPIOInterface()
|
||||||
{};
|
= default;;
|
||||||
|
|
||||||
virtual bool read_data(char pin) = 0;
|
virtual bool read_data(char pin) = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ class InputDriver : public IInputDriver
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
InputDriver(std::shared_ptr<IEventNotifier> event_notifier, std::unique_ptr<IDetector> detector, std::map<std::string, std::shared_ptr<Event>> events);
|
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;
|
void register_event_handler(IEventHandler* handler) override;
|
||||||
virtual void unregister_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:
|
private:
|
||||||
std::shared_ptr<IEventNotifier> event_notifier;
|
std::shared_ptr<IEventNotifier> event_notifier;
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace input
|
|||||||
class InputGPIOInterface : public IInputGPIOInterface, GPIOInterface
|
class InputGPIOInterface : public IInputGPIOInterface, GPIOInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InputGPIOInterface(std::istream &input_config);
|
explicit InputGPIOInterface(std::istream &input_config);
|
||||||
bool read_data(char pin);
|
bool read_data(char pin) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init_members(std::istream &input_config_stream);
|
void init_members(std::istream &input_config_stream);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace output
|
|||||||
class IOutputGPIOInterface
|
class IOutputGPIOInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~IOutputGPIOInterface(){};
|
virtual ~IOutputGPIOInterface() = default;
|
||||||
|
|
||||||
virtual void activate(items::IDriverBoardItem *driver_board_item) = 0;
|
virtual void activate(items::IDriverBoardItem *driver_board_item) = 0;
|
||||||
virtual void activate(items::ISoundItem *sound) = 0;
|
virtual void activate(items::ISoundItem *sound) = 0;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace items
|
|||||||
class IDriverBoardItem : public IItem
|
class IDriverBoardItem : public IItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~IDriverBoardItem(){};
|
virtual ~IDriverBoardItem() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class Item : public IItem
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Item(std::shared_ptr<IOutputGPIOInterface> output_gpio_interface, uint8_t address, std::string name);
|
Item(std::shared_ptr<IOutputGPIOInterface> output_gpio_interface, uint8_t address, std::string name);
|
||||||
virtual ~Item();
|
~Item() override;
|
||||||
|
|
||||||
uint8_t get_address() override;
|
uint8_t get_address() override;
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
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 ~Sound() = default;
|
||||||
|
|
||||||
virtual void play();
|
void play() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::chrono::milliseconds deactivation_time;
|
std::chrono::milliseconds deactivation_time;
|
||||||
|
|||||||
@@ -16,8 +16,7 @@ template<typename T>
|
|||||||
class IBlockingQueue
|
class IBlockingQueue
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~IBlockingQueue()
|
virtual ~IBlockingQueue() = default;
|
||||||
{};
|
|
||||||
|
|
||||||
virtual void push(T const &value) = 0;
|
virtual void push(T const &value) = 0;
|
||||||
virtual T pop() = 0;
|
virtual T pop() = 0;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace utility
|
|||||||
class InputSocketHandler : public SocketHandler, IEventHandler
|
class InputSocketHandler : public SocketHandler, IEventHandler
|
||||||
{
|
{
|
||||||
public:
|
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");
|
+ "flippR/S.flippR_input");
|
||||||
|
|
||||||
void handle(input::Event &event) override;
|
void handle(input::Event &event) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user