refactored input names and created facade
This commit is contained in:
47
FlippR-Driver/src/input/EventNotifier.h
Normal file
47
FlippR-Driver/src/input/EventNotifier.h
Normal 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_ */
|
||||
Reference in New Issue
Block a user