diff --git a/FlippR-Driver/CMakeLists.txt b/FlippR-Driver/CMakeLists.txt index a21bcc7..1f76237 100644 --- a/FlippR-Driver/CMakeLists.txt +++ b/FlippR-Driver/CMakeLists.txt @@ -56,7 +56,7 @@ file(GLOB_RECURSE SOURCES src/*.cpp) if(BUILD_SHARED_LIB) add_library(${PROJECT_NAME} SHARED ${SOURCES}) else() - add_library(${PROJECT_NAME} STATIC ${SOURCES} cli/OutputInterpreter.cpp cli/OutputInterpreter.h src/output/items/detail/DriverBoardItem.cpp src/output/items/detail/DriverBoardItem.h include/DriverFactory.h src/utility/Colors.h) + add_library(${PROJECT_NAME} STATIC ${SOURCES} cli/OutputInterpreter.cpp cli/OutputInterpreter.h src/output/items/detail/DriverBoardItem.cpp src/output/items/detail/DriverBoardItem.h include/DriverFactory.h src/utility/Colors.h src/output/factories/SoundFactory.cpp src/output/factories/SoundFactory.h src/output/factories/Factory.cpp src/output/factories/Factory.h src/output/factories/FlipperFactory.cpp src/output/factories/FlipperFactory.h src/output/factories/LampFactory.cpp src/output/factories/LampFactory.h src/output/factories/DisplayFactory.cpp src/output/factories/DisplayFactory.h) endif(BUILD_SHARED_LIB) target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/src) diff --git a/FlippR-Driver/include/output/items/Display.h b/FlippR-Driver/include/output/items/Display.h index dc0ffe8..db082b7 100644 --- a/FlippR-Driver/include/output/items/Display.h +++ b/FlippR-Driver/include/output/items/Display.h @@ -8,6 +8,8 @@ #ifndef FLIPPR_DRIVER_OUTPUT_ITEMS_DISPLAY_H_ #define FLIPPR_DRIVER_OUTPUT_ITEMS_DISPLAY_H_ +#include "Item.h" + namespace flippR_driver { namespace output @@ -15,7 +17,7 @@ namespace output namespace items { -class Display +class Display : public virtual items::Item { public: diff --git a/FlippR-Driver/src/output/OutputDriverFactory.cpp b/FlippR-Driver/src/output/OutputDriverFactory.cpp index a59afec..210d5d7 100644 --- a/FlippR-Driver/src/output/OutputDriverFactory.cpp +++ b/FlippR-Driver/src/output/OutputDriverFactory.cpp @@ -37,7 +37,7 @@ std::shared_ptr get_OutputDriver(std::istream& solenoid_config, std::istream& sound_config, std::istream& display_config) { - utility::LoggerFactory::CreateOutputLogger(); +/* utility::LoggerFactory::CreateOutputLogger(); solenoid_config >> config::solenoids; lamp_config >> config::lamps; @@ -59,7 +59,7 @@ std::shared_ptr get_OutputDriver(std::istream& solenoid_config, std::unique_ptr display_controller(new detail::DisplayController(displays, std::move(display_board_pin_controller))); auto display_map = map_displays(displays); - return std::make_shared(std::move(display_controller), solenoids, lamps, sounds, flippers, display_map); + return std::make_shared(std::move(display_controller), solenoids, lamps, sounds, flippers, display_map);*/ } std::map> create_solenoids(std::shared_ptr &pin_controller) @@ -235,7 +235,7 @@ std::vector> create_displays(std::istream std::shared_ptr create_display(json & display_json) { - std::string config_file = "display_config.json"; +/* std::string config_file = "display_config.json"; auto id = get_value("id", display_json, config_file); auto address = get_value("address", display_json, config_file); auto digits = get_value("digits", display_json, config_file); @@ -246,7 +246,7 @@ std::shared_ptr create_display(json & display_json) return std::make_shared(address, id); else - throw new std::logic_error("Display digits can either be 7 or 8"); + throw new std::logic_error("Display digits can either be 7 or 8");*/ } std::map> map_displays(const std::vector> &displays) diff --git a/FlippR-Driver/src/output/factories/DisplayFactory.cpp b/FlippR-Driver/src/output/factories/DisplayFactory.cpp new file mode 100644 index 0000000..2efc087 --- /dev/null +++ b/FlippR-Driver/src/output/factories/DisplayFactory.cpp @@ -0,0 +1,27 @@ +/* + * DisplayFactory.cpp + * + * Created on: December 28, 2019 + * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert + */ + +#include "DisplayFactory.h" + + +namespace flippR_driver +{ +namespace output +{ + +DisplayFactory::DisplayFactory(nlohmann::json &object) : Factory(object) +{ + +} + +std::map> DisplayFactory::getItemMap() +{ + return std::map>(); +} + +} +} diff --git a/FlippR-Driver/src/output/factories/DisplayFactory.h b/FlippR-Driver/src/output/factories/DisplayFactory.h new file mode 100644 index 0000000..fc84e1f --- /dev/null +++ b/FlippR-Driver/src/output/factories/DisplayFactory.h @@ -0,0 +1,30 @@ +/* + * DisplayFactory.h + * + * Created on: December 28, 2019 + * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert + */ + +#ifndef FLIPPR_DRIVER_DISPLAYFACTORY_H +#define FLIPPR_DRIVER_DISPLAYFACTORY_H + +#include "Factory.h" + +namespace flippR_driver +{ +namespace output +{ + +class DisplayFactory : Factory +{ +public: + explicit DisplayFactory(nlohmann::json & object); + std::map> getItemMap() override; + +}; + +} +} + + +#endif //FLIPPR_DRIVER_DISPLAYFACTORY_H diff --git a/FlippR-Driver/src/output/factories/Factory.cpp b/FlippR-Driver/src/output/factories/Factory.cpp new file mode 100644 index 0000000..c9ac0d2 --- /dev/null +++ b/FlippR-Driver/src/output/factories/Factory.cpp @@ -0,0 +1,22 @@ +/* + * Factory.cpp + * + * Created on: December 28, 2019 + * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert + */ + +#include "Factory.h" + +namespace flippR_driver +{ +namespace output +{ + +Factory::Factory(nlohmann::json &object) : + object{object} +{ + +} + +} +} diff --git a/FlippR-Driver/src/output/factories/Factory.h b/FlippR-Driver/src/output/factories/Factory.h new file mode 100644 index 0000000..5d8ee19 --- /dev/null +++ b/FlippR-Driver/src/output/factories/Factory.h @@ -0,0 +1,35 @@ +/* + * Factory.h + * + * Created on: December 28, 2019 + * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert + */ + +#ifndef FLIPPR_DRIVER_FACTORY_H +#define FLIPPR_DRIVER_FACTORY_H + +#include "utility/config.h" +#include "json/json.hpp" +#include "output/items/Item.h" + +namespace flippR_driver +{ +namespace output +{ + +class Factory +{ +public: + Factory(nlohmann::json &object); + + virtual std::map> getItemMap() = 0; + +protected: + nlohmann::json object; +}; + +} +} + + +#endif //FLIPPR_DRIVER_FACTORY_H diff --git a/FlippR-Driver/src/output/factories/FlipperFactory.cpp b/FlippR-Driver/src/output/factories/FlipperFactory.cpp new file mode 100644 index 0000000..3545c8a --- /dev/null +++ b/FlippR-Driver/src/output/factories/FlipperFactory.cpp @@ -0,0 +1,26 @@ +/* + * FlipperFactory.cpp + * + * Created on: December 28, 2019 + * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert + */ + +#include "FlipperFactory.h" + +namespace flippR_driver +{ +namespace output +{ + +FlipperFactory::FlipperFactory(nlohmann::json &object) : Factory(object) +{ + +} + +std::map> FlipperFactory::getItemMap() +{ + return std::map>(); +} + +} +} diff --git a/FlippR-Driver/src/output/factories/FlipperFactory.h b/FlippR-Driver/src/output/factories/FlipperFactory.h new file mode 100644 index 0000000..373a695 --- /dev/null +++ b/FlippR-Driver/src/output/factories/FlipperFactory.h @@ -0,0 +1,31 @@ +/* + * FlipperFactory.h + * + * Created on: December 28, 2019 + * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert + */ + +#ifndef FLIPPR_DRIVER_FLIPPERFACTORY_H +#define FLIPPR_DRIVER_FLIPPERFACTORY_H + +#include "Factory.h" +#include + +namespace flippR_driver +{ +namespace output +{ + +class FlipperFactory : Factory +{ +public: + explicit FlipperFactory(nlohmann::json & object); + std::map > getItemMap() override; + +}; + +} +} + + +#endif //FLIPPR_DRIVER_FLIPPERFACTORY_H diff --git a/FlippR-Driver/src/output/factories/LampFactory.cpp b/FlippR-Driver/src/output/factories/LampFactory.cpp new file mode 100644 index 0000000..b176893 --- /dev/null +++ b/FlippR-Driver/src/output/factories/LampFactory.cpp @@ -0,0 +1,27 @@ +/* + * LampFactory.cpp + * + * Created on: December 28, 2019 + * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert + */ + +#include "LampFactory.h" + + +namespace flippR_driver +{ +namespace output +{ + +LampFactory::LampFactory(nlohmann::json &object) : Factory(object) +{ + +} + +std::map> LampFactory::getItemMap() +{ + return std::map>(); +} + +} +} diff --git a/FlippR-Driver/src/output/factories/LampFactory.h b/FlippR-Driver/src/output/factories/LampFactory.h new file mode 100644 index 0000000..b7f676e --- /dev/null +++ b/FlippR-Driver/src/output/factories/LampFactory.h @@ -0,0 +1,29 @@ +/* + * LampFactory.h + * + * Created on: December 28, 2019 + * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert + */ + +#ifndef FLIPPR_DRIVER_LAMPFACTORY_H +#define FLIPPR_DRIVER_LAMPFACTORY_H + +#include "Factory.h" + +namespace flippR_driver +{ +namespace output +{ + +class LampFactory : Factory +{ +public: + explicit LampFactory(nlohmann::json & object); + std::map> getItemMap() override; + +}; + +} +} + +#endif //FLIPPR_DRIVER_LAMPFACTORY_H diff --git a/FlippR-Driver/src/output/factories/SoundFactory.cpp b/FlippR-Driver/src/output/factories/SoundFactory.cpp new file mode 100644 index 0000000..8dbb6c9 --- /dev/null +++ b/FlippR-Driver/src/output/factories/SoundFactory.cpp @@ -0,0 +1,24 @@ +/* + * SoundFactory.cpp + * + * Created on: December 28, 2019 + * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert + */ +#include "SoundFactory.h" +namespace flippR_driver +{ +namespace output +{ + +SoundFactory::SoundFactory(nlohmann::json &object) : Factory(object) +{ + +} + +std::map> SoundFactory::getItemMap() +{ + return std::map>(); +} + +} +} diff --git a/FlippR-Driver/src/output/factories/SoundFactory.h b/FlippR-Driver/src/output/factories/SoundFactory.h new file mode 100644 index 0000000..2db516e --- /dev/null +++ b/FlippR-Driver/src/output/factories/SoundFactory.h @@ -0,0 +1,29 @@ +/* + * SoundFactory.h + * + * Created on: December 28, 2019 + * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert + */ + +#ifndef FLIPPR_DRIVER_SOUNDFACTORY_H +#define FLIPPR_DRIVER_SOUNDFACTORY_H + +#include "Factory.h" + +namespace flippR_driver +{ +namespace output +{ + +class SoundFactory : Factory +{ +public: + explicit SoundFactory(nlohmann::json & object); + std::map> getItemMap() override; +}; + +} +} + + +#endif //FLIPPR_DRIVER_SOUNDFACTORY_H diff --git a/FlippR-Driver/src/utility/config.h b/FlippR-Driver/src/utility/config.h index 82089ac..7e5245d 100644 --- a/FlippR-Driver/src/utility/config.h +++ b/FlippR-Driver/src/utility/config.h @@ -1,5 +1,5 @@ /* - * BlockingQueue.hpp + * config.h * * Created on: May 17, 2018 * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert