This commit is contained in:
Jonas Zeunert
2018-06-15 00:02:03 +02:00
parent ec41e9e314
commit d027d32e2f
19 changed files with 79 additions and 20 deletions

View File

@@ -0,0 +1,54 @@
/*
* InputEventHandler.h
*
* This interface must be implemented to be informed about input events.
*
* Please be aware that handle must be implemented thread safe!
*
* Created on: Apr 5, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht
*/
#ifndef INPUTEVENTHANDLER_H_
#define INPUTEVENTHANDLER_H_
#include "IInputDriver.h"
#include "../utilities/IEventHandler.h"
#include "../utilities/config.h"
#include "Event.h"
namespace Input
{
class EventHandler;
class EventHandler : public IEventHandler
{
public:
EventHandler(std::shared_ptr<IInputDriver> input_driver) :
input_driver(input_driver)
{
this->input_driver->register_event_handler(this);
CLOG(INFO, INPUT_LOGGER) << "Created EventHandler";
}
virtual ~EventHandler()
{
this->input_driver->unregister_event_handler(this);
this->input_driver = NULL;
}
// This function is intended to be non pure, if it is called when the derived class doesn't exist anymore
virtual void handle(Event& event)
{
CLOG(WARNING, INPUT_LOGGER) << "Called EventHandler parent class";
}
private:
std::shared_ptr<IInputDriver> input_driver;
};
}
#endif /* INPUTEVENTHANDLER_H_ */