reworked eventhandler
This commit is contained in:
@@ -29,7 +29,7 @@ std::string Event::getJsonString()
|
||||
json["address"] = this->address;
|
||||
json["priority"] = this->priority;
|
||||
|
||||
json.dump();
|
||||
return json.dump();
|
||||
}
|
||||
|
||||
bool operator==(const Event& left, const Event& right)
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* EventHandler.cpp
|
||||
*
|
||||
* Created on: Jun 14, 2018
|
||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
|
||||
*/
|
||||
#include "EventHandler.h"
|
||||
#include "utility/config.h"
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace input
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
EventHandler::EventHandler(std::shared_ptr<InputDriver> input_driver) :
|
||||
input_driver(std::move(input_driver))
|
||||
{
|
||||
this->input_driver->register_event_handler(this);
|
||||
|
||||
CLOG(INFO, INPUT_LOGGER) << "Created EventHandler";
|
||||
}
|
||||
|
||||
EventHandler::~EventHandler()
|
||||
{
|
||||
this->input_driver->unregister_event_handler(this);
|
||||
}
|
||||
|
||||
// This function is intended to be non pure, if it is called when the derived class doesn't exist anymore
|
||||
void EventHandler::handle(Event &event)
|
||||
{
|
||||
CLOG(WARNING, INPUT_LOGGER) << "Called EventHandler parent class";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef INPUT_IMPL_EVENTHANDLER_H_
|
||||
#define INPUT_IMPL_EVENTHANDLER_H_
|
||||
|
||||
#include "input/InputDriver.h"
|
||||
|
||||
#include "input/EventHandler.h"
|
||||
#include "input/Event.h"
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace input
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class EventHandler;
|
||||
|
||||
class EventHandler : public input::EventHandler
|
||||
{
|
||||
public:
|
||||
explicit EventHandler(std::shared_ptr<InputDriver> input_driver);
|
||||
~EventHandler() override;
|
||||
void handle(Event &event) override;
|
||||
|
||||
private:
|
||||
const std::shared_ptr<InputDriver> input_driver;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user