Class ConfigParser¶
Defined in File config_parser.h
Class Documentation¶
-
class
ConfigParser
¶ Command-line options parser.
New options and aliases should be defined within
addOptions*
methods. … unless they are specific to certain executables. In that case, use a pattern like this (e.g., for a server): int main(int argc, char* argv[]) { ConfigParser cp(cli::mode::translation); cp.addOption<int>(”–port”, // option name “Server Options”, // option group name “Port for server.”, // help string 5678); // default value auto opts = cp.parseOptions(argc,argv,true); // ‘true’ for validation …Public Functions
-
template<typename
T
>
ConfigParser &addOption
(const std::string &args, const std::string &group, const std::string &help, const T val)¶
-
template<typename
T
>
ConfigParser &addOption
(const std::string &args, const std::string &group, const std::string &help, const T val, const T implicit_val)¶
-
template<typename
T
>
ConfigParser &addOption
(const std::string &args, const std::string &group, const std::string &help)¶
-
Ptr<Options>
parseOptions
(int argc, char **argv, bool validate)¶ Parse command-line options.
Options are parsed in the following order, later config options overwrite earlier:
predefined default values
options from the config files provided with config, from left to right
options from the model config file, e.g. model.npz.yml
aliases expanded into options, e.g. best-deep
options provided as command-line arguments
Parsed options are available from getConfig().
- Return
(YAML::Node const&)config_
- Parameters
argc
:argv
:validate
: Do or do not validate parsed options
-
const YAML::Node &
getConfig
() const¶
-
template<typename