refactored namespaces and added driverfactory

This commit is contained in:
Jonas Zeunert
2018-09-13 23:05:49 +02:00
parent 7b3327f5ef
commit 9f0bad92a1
29 changed files with 68 additions and 55 deletions

View File

@@ -12,7 +12,7 @@
#include "utilities/config.h"
namespace Input
namespace FlippR_Driver::Input
{
Detector::Detector(std::unique_ptr<IInputGPIOInterface> input_gpio_interface, std::map<char, std::shared_ptr<Event>> events, std::shared_ptr<IEventNotifier> event_notifier) :

View File

@@ -24,7 +24,7 @@
#include "Event.h"
#include "IEventNotifier.h"
namespace Input
namespace FlippR_Driver::Input
{
class Detector : public IDetector

View File

@@ -10,7 +10,7 @@
#include "Event.h"
namespace Input
namespace FlippR_Driver::Input
{
class ErrorEvent : public Event

View File

@@ -8,7 +8,7 @@
#include "utilities/config.h"
namespace Input
namespace FlippR_Driver::Input
{
Event::Event(char address, int priority, std::string name) :

View File

@@ -6,7 +6,7 @@
*/
#include "EventHandler.h"
namespace Input
namespace FlippR_Driver::Input
{
EventHandler::EventHandler(std::shared_ptr<IInputDriver> input_driver) :

View File

@@ -18,7 +18,7 @@
#include "utilities/config.h"
#include "Event.h"
namespace Input
namespace FlippR_Driver::Input
{
class EventHandler;

View File

@@ -11,7 +11,7 @@
#include "EventNotifier.h"
namespace Input
namespace FlippR_Driver::Input
{
EventNotifier::EventNotifier(IBlockingQueue<Event>* queue) :

View File

@@ -21,7 +21,7 @@
#define HANDLER_TIMEOUT 2000
namespace Input
namespace FlippR_Driver::Input
{
class EventNotifier : public IEventNotifier

View File

@@ -9,7 +9,7 @@
#define SRC_INPUT_IDETECTOR_H_
namespace Input
namespace FlippR_Driver::Input
{
class IDetector

View File

@@ -12,7 +12,7 @@
#include "IEventHandler.h"
#include <memory>
namespace Input
namespace FlippR_Driver::Input
{
class IEventNotifier

View File

@@ -7,7 +7,7 @@
#include <input/ErrorEvent.hpp>
#include "InputDriver.h"
namespace Input
namespace FlippR_Driver::Input
{
InputDriver::InputDriver(std::shared_ptr<IEventNotifier> event_notifier, std::unique_ptr<IDetector> detector, std::map<std::string, std::shared_ptr<Event>> events) :

View File

@@ -13,7 +13,7 @@
#include "IInputDriver.h"
#include "IDetector.h"
namespace Input
namespace FlippR_Driver::Input
{
class InputDriver : public IInputDriver

View File

@@ -7,16 +7,17 @@
#include "InputDriverFactory.h"
#include "InputDriver.h"
#include "utilities/LoggerFactory.hpp"
#include "EventNotifier.h"
using namespace nlohmann;
namespace Input
namespace FlippR_Driver::Input
{
std::shared_ptr<InputDriver> InputDriverFactory::get_InputDriver(std::istream& input_config_stream, std::istream& matrix_config_stream)
std::shared_ptr<IInputDriver> InputDriverFactory::get_InputDriver(std::istream& input_config_stream, std::istream& matrix_config_stream)
{
LoggerFactory::CreateInputLogger();

View File

@@ -12,7 +12,7 @@
#include <atomic>
#include "Detector.h"
#include "InputDriver.h"
#include "IInputDriver.h"
#include "utilities/InputGPIOInterface.h"
#include "utilities/config.h"
@@ -24,13 +24,13 @@
INITIALIZE_EASYLOGGINGPP
namespace Input
namespace FlippR_Driver::Input
{
class InputDriverFactory
{
public:
static std::shared_ptr<InputDriver> get_InputDriver(std::istream& input_config_stream, std::istream& matrix_config_stream);
static std::shared_ptr<IInputDriver> get_InputDriver(std::istream& input_config_stream, std::istream& matrix_config_stream);
private:
static void create_input_events(nlohmann::json matrix_config, std::map<char, std::shared_ptr<Event>> address_event_map, std::map<std::string, std::shared_ptr<Event>> name_event_map);