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

View File

@@ -30,4 +30,4 @@ protected:
} /* namespace output */
#endif /* _SRC_OUTPUT_CABINETITEM_H_ */
#endif

View File

@@ -30,4 +30,4 @@ private:
} /* namespace output */
#endif /* _SRC_OUTPUT_DISPLAY_H_ */
#endif

View File

@@ -20,3 +20,4 @@ DisplayController::~DisplayController() {
}
}

View File

@@ -27,4 +27,4 @@ private:
};
}
#endif /* _SRC_OUTPUT_DISPLAYCONTROLLER_H_ */
#endif

View File

@@ -18,4 +18,4 @@ class ICabinetItem
};
#endif /* _SRC_OUTPUT_ICABINETITEM_H_ */
#endif

View File

@@ -22,4 +22,4 @@ public:
} /* namespace output */
#endif /* _SRC_OUTPUT_IDISPLAY_H_ */
#endif

View File

@@ -18,4 +18,4 @@ public:
} /* namespace output */
#endif /* _SRC_OUTPUT_IDISPLAYCONTROLLER_H_ */
#endif

View File

@@ -14,4 +14,4 @@ class ILamp
};
#endif /* _SRC_OUTPUT_ILAMP_H_ */
#endif

View File

@@ -18,4 +18,4 @@ public:
} /* namespace output */
#endif /* _SRC_OUTPUT_IOUTPUTDRIVER_H_ */
#endif

View File

@@ -15,4 +15,4 @@ class ISolenoid
#endif /* _SRC_OUTPUT_ISOLENOID_H_ */
#endif

View File

@@ -20,4 +20,4 @@ public:
} /* namespace output */
#endif /* _SRC_OUTPUT_ISOUND_H_ */
#endif

View File

@@ -20,4 +20,4 @@ public:
} /* namespace output */
#endif /* _SRC_OUTPUT_LAMP_H_ */
#endif

View File

@@ -20,4 +20,4 @@ public:
} /* namespace output */
#endif /* _SRC_OUTPUT_OUTPUTDRIVER_H_ */
#endif

View File

@@ -20,4 +20,4 @@ public:
} /* namespace output */
#endif /* _SRC_OUTPUT_SOLENOID_H_ */
#endif

View File

@@ -27,4 +27,4 @@ private:
} /* namespace output */
#endif /* _SRC_OUTPUT_SOUND_H_ */
#endif

View File

@@ -46,4 +46,4 @@ public:
#endif /* SRC_UTILITIES_BLOCKINGQUEUE_HPP_ */
#endif

View File

@@ -15,7 +15,6 @@
#include <mutex>
#include <fstream>
//#include "config.h"
class GPIOInterface
{
@@ -39,4 +38,4 @@ public:
#endif /* SRC_UTILITIES_GPIOINTERFACE_H_ */
#endif

View File

@@ -19,4 +19,4 @@ public:
};
#endif /* SRC_UTILITIES_IBLOCKINGQUEUE_H_ */
#endif

View File

@@ -17,6 +17,4 @@ public:
virtual bool read_data(char pin) = 0;
};
#endif /* SRC_UTILITIES_INPUTGPIOINTERFACE_H_ */
#endif

View File

@@ -34,4 +34,4 @@ private:
char data_address;
};
#endif /* SRC_UTILITIES_INPUTGPIOINTERFACE_H_ */
#endif

View File

@@ -15,4 +15,4 @@ namespace LoggerFactory
void CreateInputLogger();
};
#endif /* SRC_UTILITIES_LOGGERFACTORY_HPP_ */
#endif

View File

@@ -16,4 +16,4 @@ class OutputGPIOInterface : GPIOInterface
};
#endif /* SRC_UTILITIES_OUTPUTGPIOINTERFACE_H_ */
#endif