//
// Created by rhetenor on 5/5/19.
//

#include "OutputInterpreter.h"

#include <fstream>
#include <iostream>

using namespace std;

OutputInterpreter::OutputInterpreter(std::string output_lamp_config_file, std::string output_solenoid_config_file,
                                      std::string output_sound_config_file, std::string 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
  {
    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(lamp_config_stream, solenoid_config_stream, sound_config_stream, display_config_stream);
}
