refactored input names and created facade

This commit is contained in:
Jonas Zeunert
2018-05-31 17:01:07 +02:00
parent 2bef8b6f2d
commit 2321f2997f
10 changed files with 36 additions and 17 deletions

View File

@@ -0,0 +1,47 @@
/*
* InputEventNotifier.h
*
* Created on: May 17, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht
*/
#ifndef SRC_INPUT_EVENTNOTIFIER_H_
#define SRC_INPUT_EVENTNOTIFIER_H_
#include <set>
#include <thread>
#include <mutex>
#include "../utilities/BlockingQueue.hpp"
#include "Event.hpp"
#include "EventHandler.hpp"
namespace Input
{
class InputEventNotifier
{
public:
InputEventNotifier();
~InputEventNotifier();
void register_input_event_handler(InputEventHandler* handler);
void unregister_input_event_handler(InputEventHandler* handler);
void distribute_event(InputEvent& event);
private:
void notify();
private:
BlockingQueue<InputEvent> event_queue;
std::set<InputEventHandler*> event_handler;
bool is_running;
std::thread notify_thread;
std::mutex event_handler_mutex;
};
}
#endif /* SRC_INPUT_EVENTNOTIFIER_H_ */