refactored namespaaaces suckz

This commit is contained in:
Jonas Zeunert
2018-09-14 00:57:39 +02:00
parent 530893c404
commit 25da106bea
80 changed files with 149 additions and 255 deletions

View File

@@ -67,3 +67,4 @@ bool Detector::check_inputs(char& address)
}
}
}

View File

@@ -52,7 +52,5 @@ private:
};
}
#endif /* DETECTOR_H_ */
}
#endif

View File

@@ -10,18 +10,15 @@
#include "Event.h"
namespace FlippR_Driver
{
namespace Input
{
namespace FlippR_Driver {
namespace Input {
class ErrorEvent : public Event
{
public:
ErrorEvent() :
Event(0, 0, "ERROR")
{}
};
class ErrorEvent : public Event {
public:
ErrorEvent() :
Event(0, 0, "ERROR") {}
};
}
}
#endif /* SRC_INPUT_ERROREVENT_HPP_ */
#endif

View File

@@ -25,3 +25,4 @@ bool operator==(const Event& left, const Event& right)
}
}
}

View File

@@ -33,3 +33,4 @@ namespace Input
}
}
}

View File

@@ -36,4 +36,5 @@ private:
}
#endif /* INPUTEVENTHANDLER_H_ */
}
#endif

View File

@@ -82,3 +82,4 @@ void EventNotifier::notify()
}
}
}

View File

@@ -53,4 +53,5 @@ private:
#endif /* SRC_INPUT_EVENTNOTIFIER_H_ */
}
#endif

View File

@@ -23,4 +23,5 @@ public:
}
#endif /* SRC_INPUT_IDETECTOR_H_ */
}
#endif

View File

@@ -29,4 +29,5 @@ public:
};
}
#endif /* SRC_INPUT_IEVENTNOTIFIER_H_ */
}
#endif

View File

@@ -10,42 +10,36 @@
#include <input/ErrorEvent.hpp>
namespace FlippR_Driver
{
namespace Input
{
namespace FlippR_Driver {
namespace Input {
InputDriver::InputDriver(std::shared_ptr<IEventNotifier> event_notifier, std::unique_ptr<IDetector> detector, std::map<std::string, std::shared_ptr<Event>> events) :
event_notifier(event_notifier),
detector(std::move(detector)),
events(events)
{
CLOG(INFO, INPUT_LOGGER) << "Created InputDriver";
}
InputDriver::InputDriver(std::shared_ptr<IEventNotifier> event_notifier, std::unique_ptr<IDetector> detector,
std::map<std::string, std::shared_ptr<Event>> events) :
event_notifier(event_notifier),
detector(std::move(detector)),
events(events) {
CLOG(INFO, INPUT_LOGGER) << "Created InputDriver";
}
void InputDriver::register_event_handler(IEventHandler* handler)
{
this->event_notifier->register_event_handler(handler);
}
void InputDriver::register_event_handler(IEventHandler *handler) {
this->event_notifier->register_event_handler(handler);
}
void InputDriver::unregister_event_handler(IEventHandler* handler)
{
this->event_notifier->unregister_event_handler(handler);
}
void InputDriver::unregister_event_handler(IEventHandler *handler) {
this->event_notifier->unregister_event_handler(handler);
}
std::shared_ptr<Event> InputDriver::get_event(std::string name)
{
std::shared_ptr<Event> event(new ErrorEvent());
try
{
event = this->events.at(name);
std::shared_ptr<Event> InputDriver::get_event(std::string name) {
std::shared_ptr<Event> event(new ErrorEvent());
try {
event = this->events.at(name);
}
catch (std::out_of_range &e) {
CLOG_N_TIMES(1, WARNING, OUTPUT_LOGGER) << "Did not found event " << name << " please check config file!";
}
return event;
}
}
catch(std::out_of_range& e)
{
CLOG_N_TIMES(1, WARNING, OUTPUT_LOGGER) << "Did not found event " << name << " please check config file!";
}
return event;
}
}

View File

@@ -38,4 +38,5 @@ private:
}
#endif /* SRC_INPUT_INPUTDRIVER_H_ */
}
#endif

View File

@@ -66,3 +66,4 @@ namespace Input {
}
}
}
}

View File

@@ -32,4 +32,5 @@ 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);
};
}
#endif /* INPUTFACTORY_H_ */
}
#endif