Refactores Factory

This commit is contained in:
Johannes Wendel
2020-01-06 09:05:13 +01:00
parent 83aefaaebf
commit 14a68d921e
17 changed files with 86 additions and 307 deletions

View File

@@ -23,32 +23,21 @@ namespace output
{
namespace OutputDriverFactory
{
std::shared_ptr<OutputDriver> get_OutputDriver(std::istream& solenoid_config,
std::istream& lamp_config,
std::istream& sound_config,
std::istream& display_config);
std::shared_ptr<OutputDriver> get_OutputDriver(const std::string & solenoid_config_path,
const std::string & lamp_config_path,
const std::string & sound_config_path,
const std::string & display_config_path);
std::map<std::string, std::shared_ptr<items::Solenoid>> create_solenoids(std::shared_ptr<DriverBoardPinController> &driverBoardPinController);
std::shared_ptr<items::detail::Solenoid> create_solenoid(nlohmann::json &solenoid_json, nlohmann::json &port_extenders, std::shared_ptr<DriverBoardPinController> &pin_controller, std::chrono::milliseconds deactivation_time);
std::map<std::string, std::shared_ptr<items::Flipper>> create_flippers(std::shared_ptr<DriverBoardPinController> &pin_controller);
std::shared_ptr<items::detail::Flipper> create_flipper(nlohmann::json &flipper_json, nlohmann::json &port_extenders, std::shared_ptr<DriverBoardPinController> &pin_controller);
template<typename FactoryType, typename ControllerType>
std::map<std::string, std::shared_ptr<items::Item>> get_items(const std::string & config_path, std::shared_ptr<PinController> pin_controller);
std::shared_ptr<SoundBoardPinController> create_SoundBoardPinController();
std::map<std::string, std::shared_ptr<items::Sound>> create_sounds(std::shared_ptr<SoundBoardPinController> &pin_controller);
std::shared_ptr<items::detail::Sound> create_sound(nlohmann::json &sound_json, nlohmann::json &port_extenders, std::shared_ptr<SoundBoardPinController> &pin_controller, std::chrono::milliseconds &deactivation_time);
uint8_t get_sound_fire_address(std::istream &sound_config);
std::map<std::string, uint8_t> parse_pins_display_board(std::istream & display_config);
std::vector<std::shared_ptr<items::OutputDisplay>> create_displays();
std::shared_ptr<items::OutputDisplay> create_display(nlohmann::json &display_json);
std::map<uint8_t, std::shared_ptr<items::Display>> map_displays(const std::vector<std::shared_ptr<items::OutputDisplay>> &displays);
void initialize_port_extenders(nlohmann::json &port_extenders, PinController * pin_controller, const std::string & file_name);
uint8_t get_pin_base(nlohmann::json & object, nlohmann::json & port_extenders, const std::string & config_file_name);
nlohmann::json get_element(const std::string & name, nlohmann::json & object, const std::string & file_name);
template<typename type>
type get_value(const std::string & name, nlohmann::json & object, const std::string & file_name);
}