renamed impl to detail
This commit is contained in:
51
FlippR-Driver/src/input/detail/InputDriver.cpp
Normal file
51
FlippR-Driver/src/input/detail/InputDriver.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* InputDriver.cpp
|
||||
*
|
||||
* Created on: Jun 15, 2018
|
||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
|
||||
*/
|
||||
#include "InputDriver.h"
|
||||
|
||||
#include "utility/config.h"
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace input
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
InputDriver::InputDriver(std::shared_ptr<EventNotifier> event_notifier, std::unique_ptr<Detector> detector,
|
||||
std::map<std::string, std::shared_ptr<Event>> events) :
|
||||
event_notifier(std::move(event_notifier)), detector(std::move(detector)), events(std::move(events))
|
||||
{
|
||||
CLOG(INFO, INPUT_LOGGER) << "Created InputDriver";
|
||||
}
|
||||
|
||||
void InputDriver::register_event_handler(EventHandler *handler)
|
||||
{
|
||||
this->event_notifier->register_event_handler(handler);
|
||||
}
|
||||
|
||||
void InputDriver::unregister_event_handler(EventHandler *handler)
|
||||
{
|
||||
this->event_notifier->unregister_event_handler(handler);
|
||||
}
|
||||
|
||||
boost::optional<std::shared_ptr<Event>> InputDriver::get_event(std::string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
return 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 boost::optional<std::shared_ptr<Event>> {};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user