todo make tests working

This commit is contained in:
Jonas Zeunert
2018-09-26 20:59:50 +02:00
parent 0f8d28667c
commit a914b2b0c8
5 changed files with 6 additions and 7 deletions

View File

@@ -15,7 +15,7 @@ void FlippR_Driver::Input::DistributingEvent::distribute()
std::chrono::milliseconds elapsed_time = std::chrono::duration_cast<std::chrono::milliseconds>(now - last_activation);
if(elapsed_time > deactivation_time)
{
event_notifier->distribute_event(std::shared_ptr<Event>(this)); // todo why new shared ptr?
event_notifier->distribute_event(*this); // todo why new shared ptr?
this->last_activation = now;
}
}

View File

@@ -49,9 +49,9 @@ void EventNotifier::unregister_event_handler(IEventHandler* handler)
this->event_handlers.erase(handler);
}
void EventNotifier::distribute_event(std::shared_ptr<Event> event)
void EventNotifier::distribute_event(Event &event)
{
this->event_queue->push(*event);
this->event_queue->push(event);
}
void EventNotifier::notify()

View File

@@ -36,7 +36,7 @@ public:
void register_event_handler(IEventHandler* handler);
void unregister_event_handler(IEventHandler* handler);
void distribute_event(std::shared_ptr<Event> event);
void distribute_event(Event &event);
private:
void notify();

View File

@@ -25,7 +25,7 @@ public:
virtual void register_event_handler(IEventHandler* handler) = 0;
virtual void unregister_event_handler(IEventHandler* handler) = 0;
virtual void distribute_event(std::shared_ptr<Event> event) = 0;
virtual void distribute_event(Event &event) = 0;
};
}