queso-0.57.1
|
#include <BoostInputOptionsParser.h>
Public Member Functions | |
BoostInputOptionsParser (const std::string &filename) | |
Constructor that parses file filename . More... | |
BoostInputOptionsParser () | |
Default constructor that sets m_filename to "". More... | |
virtual | ~BoostInputOptionsParser () |
Destructor. More... | |
void | scanInputFile () |
This is the method that parses the input file. More... | |
template<class T > | |
void | registerOption (const std::string &name, const T &defaultValue, const std::string &description) |
Call this to register an option with the parser. More... | |
void | registerOption (const std::string &name, const std::string &description) |
For flags without values. Like a help message, for example. More... | |
template<class T > | |
void | getOption (const std::string &name, T &value) const |
Get option name from the parser and set value to the parsed value. More... | |
template<> | |
void | getOption (const std::string &name, std::set< unsigned int, std::less< unsigned int >, std::allocator< unsigned int > > &value) const |
Public Member Functions inherited from QUESO::BaseInputOptionsParser | |
BaseInputOptionsParser () | |
Default constructor. More... | |
virtual | ~BaseInputOptionsParser () |
Destructor. More... | |
Protected Attributes | |
const std::string | m_filename |
ScopedPtr < boost::program_options::options_description > ::Type | m_optionsDescription |
ScopedPtr < boost::program_options::variables_map > ::Type | m_optionsMap |
Private Attributes | |
bool | m_scannedInputFile |
Friends | |
std::ostream & | operator<< (std::ostream &os, const BoostInputOptionsParser &parser) |
Helpful stream operator for printing the parser state. More... | |
Definition at line 45 of file BoostInputOptionsParser.h.
QUESO::BoostInputOptionsParser::BoostInputOptionsParser | ( | const std::string & | filename | ) |
Constructor that parses file filename
.
Definition at line 35 of file BoostInputOptionsParser.C.
QUESO::BoostInputOptionsParser::BoostInputOptionsParser | ( | ) |
Default constructor that sets m_filename to "".
The use-case that options are not read in from a file but are instead wholly provided by the user.
Definition at line 45 of file BoostInputOptionsParser.C.
|
virtual |
void QUESO::BoostInputOptionsParser::getOption | ( | const std::string & | name, |
T & | value | ||
) | const |
Get option name
from the parser and set value
to the parsed value.
Definition at line 109 of file BoostInputOptionsParser.C.
References m_scannedInputFile.
Referenced by QUESO::MLSamplingLevelOptions::getAllOptions(), QUESO::InfiniteDimensionalMCMCSamplerOptions::InfiniteDimensionalMCMCSamplerOptions(), QUESO::MLSamplingOptions::MLSamplingOptions(), and QUESO::OptimizerOptions::OptimizerOptions().
template void QUESO::BoostInputOptionsParser::getOption< std::set< unsigned int, std::less< unsigned int >, std::allocator< unsigned int > > > | ( | const std::string & | name, |
std::set< unsigned int, std::less< unsigned int >, std::allocator< unsigned int > > & | value | ||
) | const |
Definition at line 119 of file BoostInputOptionsParser.C.
References m_scannedInputFile, and QUESO::MiscReadDoublesFromString().
void QUESO::BoostInputOptionsParser::registerOption | ( | const std::string & | name, |
const T & | defaultValue, | ||
const std::string & | description | ||
) |
Call this to register an option with the parser.
The name of the option to look for in the input file is given by name
is given by. If no option is present in the input file, then use defaultValue
is used for the default value for the option. Describe the option with a helpful message using description
.
Definition at line 86 of file BoostInputOptionsParser.C.
References m_optionsDescription.
Referenced by QUESO::MLSamplingLevelOptions::defineAllOptions(), QUESO::InfiniteDimensionalMCMCSamplerOptions::InfiniteDimensionalMCMCSamplerOptions(), QUESO::MLSamplingOptions::MLSamplingOptions(), and QUESO::OptimizerOptions::OptimizerOptions().
void QUESO::BoostInputOptionsParser::registerOption | ( | const std::string & | name, |
const std::string & | description | ||
) |
For flags without values. Like a help message, for example.
Definition at line 98 of file BoostInputOptionsParser.C.
References m_optionsDescription.
void QUESO::BoostInputOptionsParser::scanInputFile | ( | ) |
This is the method that parses the input file.
It parses the input file and sets the m_optionsMap member.
Definition at line 62 of file BoostInputOptionsParser.C.
References m_filename, m_optionsDescription, m_optionsMap, and m_scannedInputFile.
Referenced by QUESO::InfiniteDimensionalMCMCSamplerOptions::InfiniteDimensionalMCMCSamplerOptions(), QUESO::MLSamplingLevelOptions::MLSamplingLevelOptions(), QUESO::MLSamplingOptions::MLSamplingOptions(), QUESO::OptimizerOptions::OptimizerOptions(), and QUESO::MLSamplingLevelOptions::scanOptionsValues().
|
friend |
Helpful stream operator for printing the parser state.
Definition at line 157 of file BoostInputOptionsParser.C.
|
protected |
Definition at line 97 of file BoostInputOptionsParser.h.
Referenced by scanInputFile().
|
protected |
Definition at line 99 of file BoostInputOptionsParser.h.
Referenced by QUESO::operator<<(), registerOption(), and scanInputFile().
|
protected |
Definition at line 100 of file BoostInputOptionsParser.h.
Referenced by scanInputFile().
|
private |
Definition at line 103 of file BoostInputOptionsParser.h.
Referenced by getOption(), and scanInputFile().