now compiling
This commit is contained in:
@@ -5,12 +5,36 @@
|
||||
#include "OutputInterpreter.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
OutputInterpreter::OutputInterpreter(std::string output_pin_config_file, std::string output_lamp_config_file,
|
||||
std::string output_solenoid_config_file, std::string output_sound_config_file,
|
||||
std::string output_display_config_file)
|
||||
: output_driver(flippR_driver::get_OutputDriver(ifstream(output_pin_config_file), ifstream(output_lamp_config_file),
|
||||
ifstream(output_solenoid_config_file), ifstream(output_sound_config_file), ifstream(output_display_config_file)))
|
||||
{}
|
||||
{
|
||||
std::ifstream output_pin_config_stream;
|
||||
std::ifstream lamp_config_stream;
|
||||
std::ifstream solenoid_config_stream;
|
||||
std::ifstream sound_config_stream;
|
||||
std::ifstream display_config_stream;
|
||||
|
||||
try
|
||||
{
|
||||
output_pin_config_stream.open(output_pin_config_file);
|
||||
lamp_config_stream.open(output_lamp_config_file);
|
||||
solenoid_config_stream.open(output_solenoid_config_file);
|
||||
sound_config_stream.open(output_sound_config_file);
|
||||
display_config_stream.open(output_display_config_file);
|
||||
}
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
cerr << e.what();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
output_driver = flippR_driver::get_OutputDriver(output_pin_config_stream, lamp_config_stream,
|
||||
solenoid_config_stream,
|
||||
sound_config_stream,
|
||||
display_config_stream);
|
||||
|
||||
}
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
std::shared_ptr<input::InputDriver> get_InputDriver(const std::istream& input_config_stream, const std::istream& matrix_config_stream);
|
||||
std::shared_ptr<output::OutputDriver> get_OutputDriver(const std::istream &output_pin_config,
|
||||
const std::istream &lamp_config,
|
||||
const std::istream &solenoid_config,
|
||||
const std::istream &sound_config,
|
||||
const std::istream &display_config);
|
||||
std::shared_ptr<input::InputDriver> get_InputDriver(std::istream& input_config_stream, std::istream& matrix_config_stream);
|
||||
std::shared_ptr<output::OutputDriver> get_OutputDriver(std::istream& output_pin_config,
|
||||
std::istream& lamp_config,
|
||||
std::istream& solenoid_config,
|
||||
std::istream& sound_config,
|
||||
std::istream& display_config);
|
||||
}
|
||||
|
||||
#endif //flippR_driver_DRIVERFACTORY_H
|
||||
|
||||
@@ -14,11 +14,11 @@ namespace flippR_driver
|
||||
return input::InputDriverFactory::get_InputDriver(input_config_stream, matrix_config_stream);
|
||||
}
|
||||
|
||||
std::shared_ptr<output::OutputDriver> get_OutputDriver(std::istream &output_pin_config,
|
||||
std::istream &lamp_config,
|
||||
std::istream &solenoid_config,
|
||||
std::istream &sound_config,
|
||||
std::istream &display_config)
|
||||
std::shared_ptr<output::OutputDriver> get_OutputDriver(std::istream& output_pin_config,
|
||||
std::istream& lamp_config,
|
||||
std::istream& solenoid_config,
|
||||
std::istream& sound_config,
|
||||
std::istream& display_config)
|
||||
{
|
||||
return output::OutputDriverFactory::get_OutputDriver(output_pin_config, lamp_config, solenoid_config, sound_config, display_config);
|
||||
}
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
// Created by rhetenor on 04.10.18.
|
||||
//
|
||||
|
||||
#include "OutputDriverFactory.h"
|
||||
|
||||
|
||||
#include <boost/range/algorithm/copy.hpp>
|
||||
#include <boost/range/adaptor/map.hpp>
|
||||
|
||||
#include "OutputDriverFactory.h"
|
||||
|
||||
#include "utility/LoggerFactory.h"
|
||||
|
||||
#include "output/detail/OutputDriver.h"
|
||||
@@ -28,12 +29,14 @@ namespace output
|
||||
namespace OutputDriverFactory
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
std::shared_ptr<OutputDriver> get_OutputDriver(std::istream &output_pin_config, std::istream &solenoid_config, std::istream &lamp_config, std::istream &sound_config, std::istream &display_config)
|
||||
std::shared_ptr<OutputDriver> get_OutputDriver(std::istream& output_pin_config,
|
||||
std::istream& solenoid_config,
|
||||
std::istream& lamp_config,
|
||||
std::istream& sound_config,
|
||||
std::istream& display_config)
|
||||
{
|
||||
utility::LoggerFactory::CreateOutputLogger();
|
||||
|
||||
@@ -419,7 +422,6 @@ std::map<uint8_t, std::shared_ptr<items::Display>> map_displays(const std::vecto
|
||||
return display_map;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,32 +23,34 @@ namespace output
|
||||
{
|
||||
namespace OutputDriverFactory
|
||||
{
|
||||
std::shared_ptr<OutputDriver> get_OutputDriver(std::istream &output_pin_config, std::istream &solenoid_config, std::istream &lamp_config, std::istream &sound_config, std::istream &display_config);
|
||||
std::shared_ptr<OutputDriver> get_OutputDriver(std::istream& output_pin_config,
|
||||
std::istream& solenoid_config,
|
||||
std::istream& lamp_config,
|
||||
std::istream& sound_config,
|
||||
std::istream& display_config);
|
||||
|
||||
namespace
|
||||
{
|
||||
std::map<std::string, std::shared_ptr<items::Solenoid>> create_solenoids(std::istream &solenoid_config, std::shared_ptr<DriverBoardPinController> &pin_controller);
|
||||
std::shared_ptr<items::detail::Solenoid> create_solenoid(nlohmann::json &solenoid_json, std::shared_ptr<DriverBoardPinController> &pin_controller, std::chrono::milliseconds &deactivation_time);
|
||||
|
||||
std::map<std::string, std::shared_ptr<items::Lamp>> create_lamps(std::istream &lamp_config, std::shared_ptr<DriverBoardPinController> &pin_controller);
|
||||
std::shared_ptr<items::detail::Lamp> create_lamp(nlohmann::json &lamp_json, std::shared_ptr<DriverBoardPinController> &pin_controller);
|
||||
std::map<std::string, std::shared_ptr<items::Solenoid>> create_solenoids(std::istream &solenoid_config, std::shared_ptr<DriverBoardPinController> &pin_controller);
|
||||
std::shared_ptr<items::detail::Solenoid> create_solenoid(nlohmann::json &solenoid_json, std::shared_ptr<DriverBoardPinController> &pin_controller, std::chrono::milliseconds &deactivation_time);
|
||||
|
||||
std::map<std::string, std::shared_ptr<items::Flipper>> create_flippers(std::istream &solenoid_config, std::shared_ptr<DriverBoardPinController> &pin_controller);
|
||||
std::shared_ptr<items::detail::Flipper> create_flipper(nlohmann::json &flipper_json, std::shared_ptr<DriverBoardPinController> &pin_controller);
|
||||
std::map<std::string, std::shared_ptr<items::Lamp>> create_lamps(std::istream &lamp_config, std::shared_ptr<DriverBoardPinController> &pin_controller);
|
||||
std::shared_ptr<items::detail::Lamp> create_lamp(nlohmann::json &lamp_json, std::shared_ptr<DriverBoardPinController> &pin_controller);
|
||||
|
||||
std::map<std::string, std::shared_ptr<items::Sound>> create_sounds(std::istream &sound_config, std::shared_ptr<SoundBoardPinController> &pin_controller);
|
||||
std::shared_ptr<items::detail::Sound> create_sound(nlohmann::json &sound_json, std::shared_ptr<SoundBoardPinController> &pin_controller, std::chrono::milliseconds &deactivation_time);
|
||||
std::map<std::string, std::shared_ptr<items::Flipper>> create_flippers(std::istream &solenoid_config, std::shared_ptr<DriverBoardPinController> &pin_controller);
|
||||
std::shared_ptr<items::detail::Flipper> create_flipper(nlohmann::json &flipper_json, std::shared_ptr<DriverBoardPinController> &pin_controller);
|
||||
|
||||
std::chrono::milliseconds get_deactivation_time(nlohmann::json &json);
|
||||
std::map<std::string, std::shared_ptr<items::Sound>> create_sounds(std::istream &sound_config, std::shared_ptr<SoundBoardPinController> &pin_controller);
|
||||
std::shared_ptr<items::detail::Sound> create_sound(nlohmann::json &sound_json, std::shared_ptr<SoundBoardPinController> &pin_controller, std::chrono::milliseconds &deactivation_time);
|
||||
|
||||
std::vector<std::shared_ptr<items::OutputDisplay>> create_displays(std::istream &display_config);
|
||||
std::map<uint8_t, std::shared_ptr<items::Display>> map_displays(const std::vector<std::shared_ptr<items::OutputDisplay>> &displays);
|
||||
std::shared_ptr<items::OutputDisplay> create_display(nlohmann::json &display_json);
|
||||
std::chrono::milliseconds get_deactivation_time(nlohmann::json &json);
|
||||
|
||||
std::map<std::string, uint8_t> parse_pins_driver_board(nlohmann::json &driver_board_config);
|
||||
std::map<std::string, uint8_t> parse_pins_sound_board(nlohmann::json &sound_board_config);
|
||||
std::map<std::string, uint8_t> parse_pins_display_board(nlohmann::json &display_board_config);
|
||||
}
|
||||
std::vector<std::shared_ptr<items::OutputDisplay>> create_displays(std::istream &display_config);
|
||||
std::map<uint8_t, std::shared_ptr<items::Display>> map_displays(const std::vector<std::shared_ptr<items::OutputDisplay>> &displays);
|
||||
std::shared_ptr<items::OutputDisplay> create_display(nlohmann::json &display_json);
|
||||
|
||||
std::map<std::string, uint8_t> parse_pins_driver_board(nlohmann::json &driver_board_config);
|
||||
std::map<std::string, uint8_t> parse_pins_sound_board(nlohmann::json &sound_board_config);
|
||||
std::map<std::string, uint8_t> parse_pins_display_board(nlohmann::json &display_board_config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,11 @@ std::string Display::get_content() const
|
||||
return this->content;
|
||||
}
|
||||
|
||||
uint8_t Display::get_address() const
|
||||
{
|
||||
return this->address;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user