working on big refactor

This commit is contained in:
Jonas Zeunert
2018-12-14 01:09:54 +01:00
parent f3100004b9
commit 2aee0f4f9d
67 changed files with 914 additions and 619 deletions

View File

@@ -13,30 +13,30 @@
#include <chrono>
namespace flippR_driver {
namespace input {
namespace input {
class Event {
public:
Event(char address, int priority, std::string name);
class Event {
public:
Event(uint8_t address, int priority, std::string name);
friend bool operator==(const Event &left, const Event &right);
friend bool operator<(const Event &left, const Event &right) {
return left.priority < right.priority;
}
public:
std::string name;
uint8_t address;
int priority;
std::chrono::time_point<std::chrono::high_resolution_clock> last_activation;
};
bool operator==(const Event &left, const Event &right);
friend bool operator==(const Event &left, const Event &right);
friend bool operator<(const Event &left, const Event &right) {
return left.priority < right.priority;
}
public:
std::string name;
uint8_t address;
int priority;
std::chrono::time_point<std::chrono::high_resolution_clock> last_activation;
};
bool operator==(const Event &left, const Event &right);
}
}
#endif /* INPUTEVENT_H_ */

View File

@@ -1,5 +1,5 @@
/*
* IEventHandler.h
* EventHandler.h
*
* Created on: Jun 13, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
@@ -10,12 +10,19 @@
#include "input/Event.h"
class IEventHandler
namespace flippR_driver
{
namespace input
{
class EventHandler
{
public:
virtual ~IEventHandler(){};
virtual ~EventHandler() = default;
virtual void handle(flippR_driver::input::Event& event) = 0;
virtual void handle(flippR_driver::input::Event &event) = 0;
};
}
}
#endif /* SRC_IEVENTHANDLER_H_ */

View File

@@ -1,32 +0,0 @@
/*
* IInputDriver.h
*
* Created on: Jun 14, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/
#ifndef SRC_INPUT_IINPUTDRIVER_H_
#define SRC_INPUT_IINPUTDRIVER_H_
#include <memory>
#include <boost/optional.hpp>
#include "input/IEventHandler.h"
namespace flippR_driver
{
namespace input
{
class IInputDriver {
public:
virtual ~IInputDriver() {};
virtual void register_event_handler(IEventHandler *handler) = 0;
virtual void unregister_event_handler(IEventHandler *handler) = 0;
virtual boost::optional<std::shared_ptr<Event>> get_event(std::string name) = 0;
};
}
}
#endif /* SRC_INPUT_IINPUTDRIVER_H_ */

View File

@@ -0,0 +1,34 @@
/*
* InputDriver.h
*
* Created on: Jun 14, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/
#ifndef SRC_INPUT_IINPUTDRIVER_H_
#define SRC_INPUT_IINPUTDRIVER_H_
#include <memory>
#include <boost/optional.hpp>
#include "input/EventHandler.h"
namespace flippR_driver
{
namespace input
{
class InputDriver {
public:
virtual ~InputDriver() = default;
virtual void register_event_handler(EventHandler *handler) = 0;
virtual void unregister_event_handler(EventHandler *handler) = 0;
virtual boost::optional<std::shared_ptr<Event>> get_event(std::string name) = 0;
};
}
}
#endif /* SRC_INPUT_IINPUTDRIVER_H_ */