14std::vector<std::unique_ptr<std::istream>> Configurator::sources;
15int Configurator::m_argc;
16char** Configurator::m_argv;
17static NoAdditionalConfiguration noAddConf;
18Configurator::AdditionalConfiguration* Configurator::p_addConf = &noAddConf;
21 const boost::program_options::options_description& opt)
23 boost::program_options::variables_map vm;
28 if (m_argc && m_argv) {
34 char name[] = {
'n',
'e',
'x',
't',
's',
'i',
'm',
'd',
'g',
'\0' };
35 char* fake_argv[] = { name,
nullptr };
38 auto parsed = boost::program_options::command_line_parser(use_argc, use_argv)
40 .style(boost::program_options::command_line_style::
44 boost::program_options::store(parsed, vm);
47 for (
auto iter = sources.begin(); iter != sources.end(); ++iter) {
49 boost::program_options::store(
50 boost::program_options::parse_config_file(**iter, opt,
true), vm);
51 }
catch (std::exception& e) {
53 std::cerr << e.what() << std::endl;
58 (*iter)->seekg(0, std::ios_base::beg);
66 addStream(std::move(std::unique_ptr<std::istream>(
new std::stringstream(sstream.str()))));
virtual std::stringstream read(const std::string &source)=0
Reads the additional configuration from the provided source, which is interpreted in an implementatio...
static void addStream(std::unique_ptr< std::istream > pis)
Adds a istream source of configuration data.
static void setAdditionalConfiguration(AdditionalConfiguration *pAC)
Sets the source of any additional configuration data, such as a netCDF restart file.
static void addSStream(const std::stringstream &sstream)
Adds a std::stringstream configuration stream, wrapping all the pointer mechanics.
static void getAdditionalConfiguration(const std::string &source)
Gets the additional configuration according to the supplied implementation.
static boost::program_options::variables_map parse(const boost::program_options::options_description &opt)
Parses all configuration sources.