refactored public includes

This commit is contained in:
Jonas Zeunert
2018-09-13 22:38:24 +02:00
parent e8c801a3c0
commit b77ace536c
13 changed files with 54 additions and 71 deletions

View File

@@ -2,6 +2,7 @@
option(BUILD_SHARED_LIB "Build a shared lib instead of a static." OFF)
option(ENABLE_TESTING "Enables testing." ON)
option(CROSS_COMPILE "Enables crosscompiling for raspberry pi" OFF)
option(BUILD_CLI "Makes a basic testing cli" OFF)
#################### CONFIGURATION ######################
set(OUTPUT_PATH bin)
@@ -143,4 +144,8 @@ target_link_libraries(${PROJECT_NAME} PRIVATE ${Threads_LIBRARIES})
if(ENABLE_TESTING)
add_subdirectory(tests)
endif(ENABLE_TESTING)
if(BUILD_CLI)
add_subdirectory(cli)
endif(BUILD_CLI)
####################### END_CMAKE ########################

View File

@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.6.2)
project(FlippR_Driver_CLI)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/${OUTPUT_PATH}/cli)
add_executable(${PROJECT_NAME} main.cpp)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/include)
target_link_libraries(${PROJECT_NAME} PRIVATE FlippR-Driver)

View File

@@ -0,0 +1,30 @@
//
// Created by rhetenor on 13.09.18.
//
#include <iostream>
#include "IInputDriverFactory.h"
#include "IInputDriver.h"
int main (int argc, char *argv[])
{
if(argc != 2)
{
std::cout << "Usage: " << argv[0] << " <config_file>";
}
std::string config_file = argv[1];
std::ifstream config;
try
{
config.open(config_file);
}
catch(const std::exception& e)
{
std::cout << e.what();
exit(1);
}
}

View File

@@ -8,8 +8,8 @@
#ifndef SRC_INPUT_IINPUTDRIVER_H_
#define SRC_INPUT_IINPUTDRIVER_H_
#include "utilities/IEventHandler.h"
#include "input/IEventNotifier.h"
#include "IEventHandler.h"
#include <memory>
namespace Input {

View File

@@ -17,7 +17,7 @@ class ErrorEvent : public Event
{
public:
ErrorEvent() :
Event(0, HIGHEST_INPUT_EVENT_PRIORITY, "ERROR")
Event(0, 0, "ERROR")
{}
};
}

View File

@@ -6,6 +6,8 @@
*/
#include "Event.h"
#include "utilities/config.h"
namespace Input
{

View File

@@ -1,43 +0,0 @@
/*
* InputEvent.h
*
* Created on: Apr 5, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht
*/
#ifndef INPUTEVENT_H_
#define INPUTEVENT_H_
#include <set>
#include <string>
#include "utilities/config.h"
namespace Input
{
class Event
{
public:
Event(char 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;
}
private:
char address;
public:
int priority;
std::string name;
};
bool operator==(const Event& left, const Event& right);
}
#endif /* INPUTEVENT_H_ */

View File

@@ -14,7 +14,7 @@
#include "IInputDriver.h"
#include "utilities/IEventHandler.h"
#include "IEventHandler.h"
#include "utilities/config.h"
#include "Event.h"

View File

@@ -9,7 +9,8 @@
#define SRC_INPUT_IEVENTNOTIFIER_H_
#include "Event.h"
#include "utilities/IEventHandler.h"
#include "IEventHandler.h"
#include <memory>
namespace Input
{

View File

@@ -9,6 +9,7 @@
#include "utilities/config.h"
#include "IEventNotifier.h"
#include "IInputDriver.h"
#include "IDetector.h"

View File

@@ -1,21 +0,0 @@
/*
* IEventHandler.h
*
* Created on: Jun 13, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht
*/
#ifndef SRC_IEVENTHANDLER_H_
#define SRC_IEVENTHANDLER_H_
#include "input/Event.h"
class IEventHandler
{
public:
virtual ~IEventHandler(){};
virtual void handle(Input::Event& event) = 0;
};
#endif /* SRC_IEVENTHANDLER_H_ */

View File

@@ -16,7 +16,7 @@
#define private public
#include "input/IEventNotifier.h"
#include "input/Event.h"
#include "Event.h"
#include "input/Detector.h"
#include "utilities/LoggerFactory.hpp"
#include "utilities/InputGPIOInterface.h"

View File

@@ -11,7 +11,7 @@
#include "utilities/LoggerFactory.hpp"
#include "utilities/IEventHandler.h"
#include "IEventHandler.h"
#include "utilities/IBlockingQueue.h"