47 void defineSwitch(
const std::string &name,
const std::string &description);
65 void defineOption(
const std::string &name,
const std::string &description,
const std::vector <GVariable> &gvars,
const std::string &help);
105 bool getSwitch(
const std::string &tag)
const;
115 if (!doesOptionExist(tag)) {
116 std::cerr <<
"Option " << tag <<
" does not exist. Exiting." << std::endl;
119 return getOptionIterator(tag)->value.begin()->second;
151 const std::map <std::string, GSwitch> &
getSwitches()
const {
return switches; }
159 for (
auto gopt: goptions_to_add.
getOptions()) {
188 std::map <std::string, GSwitch> switches;
189 std::ofstream *yamlConf;
190 std::string executableName;
191 std::vector <std::string> yaml_files;
201 vector <string> findYamls(
int argc,
char *argv[]);
208 void setOptionsValuesFromYamlFile(
const std::string &yaml);
216 void setOptionValuesFromCommandLineArgument(
const std::string &optionName,
const std::string &possibleYamlNode);
224 bool doesOptionExist(
const std::string &tag)
const;
232 std::vector<GOption>::iterator getOptionIterator(
const std::string &name);
234 std::vector<GOption>::const_iterator getOptionIterator(
const std::string &name)
const;
241 void printOptionOrSwitchHelp(
const std::string &tag)
const;
246 void printHelp()
const;
251 void printWebHelp()
const;
256 void saveOptions()
const;
261 void print_version();
The GOptions class manages command-line options and switches.
const YAML::Node getOptionNode(const std::string &tag) const
Retrieves the YAML::Node of the specified option.
std::string getScalarString(const std::string &tag) const
Retrieves the value of a scalar string option.
bool getSwitch(const std::string &tag) const
Retrieves the status of a switch.
T get_variable_in_option(const YAML::Node &node, const string &variable_name, const T &default_value)
Retrieves a variable from a YAML::Node.
void defineSwitch(const std::string &name, const std::string &description)
Defines and adds a command-line switch to the map of switches.
float getScalarFloat(const std::string &tag) const
Retrieves the value of a scalar float option.
GOptions()
Default constructor.
void defineOption(const GVariable &gvar, const std::string &help)
Defines and adds a scalar option to the map of options.
const std::vector< GOption > & getOptions() const
Returns the list of all defined options.
const std::map< std::string, GSwitch > & getSwitches() const
Returns the map of all defined switches.
double getScalarDouble(const std::string &tag) const
Retrieves the value of a scalar double option.
void addGOptions(const GOptions &goptions_to_add)
Adds a set of GOptions to the current options.
int getScalarInt(const std::string &tag) const
Retrieves the value of a scalar integer option.
std::vector< std::string > getYamlFiles() const
Retrieves the list of YAML files.
int getVerbosityFor(const std::string &tag) const
Retrieves the verbosity level for a given tag.
YAML::Node getOptionMapInNode(string option_name, string map_key)
Retrieves a map option within a YAML::Node.
#define EC__NOOPTIONFOUND
GOptions & operator+=(GOptions &original, const GOptions &optionsToAdd)
Encapsulates a variable with a name, value, and description.