changed to smart ptrs and trying to fix event_handler_tests

This commit is contained in:
Jonas Zeunert
2018-07-11 19:00:24 +02:00
parent 26c63d946d
commit 8b9ec68662
12 changed files with 47 additions and 61 deletions

View File

@@ -15,8 +15,8 @@
namespace Input
{
Detector::Detector(IInputGPIOInterface* input_gpio_interface, std::map<char, Event> events, IEventNotifier* event_notifier) :
input_gpio_interface(input_gpio_interface), events(events), is_running(true), event_notifier(event_notifier)
Detector::Detector(std::unique_ptr<IInputGPIOInterface> input_gpio_interface, std::map<char, Event> events, std::shared_ptr<IEventNotifier> event_notifier) :
input_gpio_interface(std::move(input_gpio_interface)), events(events), is_running(true), event_notifier(event_notifier)
{
this->detect_thread = std::thread(&Detector::detect, this);
@@ -28,12 +28,6 @@ Detector::~Detector()
this->is_running = false;
this->detect_thread.join();
delete this->input_gpio_interface;
this->input_gpio_interface = NULL;
delete this->event_notifier;
this->event_notifier = NULL;
}
// Cycles over all s and enqueues an event if detected.