Base class for options. More...
|virtual void||addGeneric (po::options_description &opts)|
|Appends generic options (those that the user can see) |
|virtual void||addHidden (po::options_description &opts)|
|Appends hidden options (these generally match positional) |
|virtual void||addPositional (po::positional_options_description &opts)|
|Appends positional options. |
|virtual std::string||print () const|
|Returns a string listing the encapsulated options, suitable for logging. |
|virtual bool||check (po::variables_map &map)|
|Validates passed options, returning true if there is a problem or false if not. More...|
|virtual bool||postConditions (po::variables_map &map)|
|Post-processing of options returning true if there were no problems, otherwise false. More...|
|virtual std::string||help () const|
|Returns a slice of the example command-line in the help output. More...|
Base class for options.
Options may have a short (1-letter) equivalent. The convention is that core options (i.e. those declared in OptionsFramework.cpp) should all be lower-case. Package options should be in upper-case. Tool-specific options should all be long-form, unless they are commonly used, in which case it's recommended that they be upper-case.
Validates passed options, returning true if there is a problem or false if not.
check() is typically used to validate positional options. For example, if you tool needs a command line that looks like:
* tool [options] min-value max-value number-of-bins *
then check() would verify that min-value, max-value, and number-of-bins were passed on the command-line. Another example is where there are mutually-exclusive options. This would be checked by check().
Returns a slice of the example command-line in the help output.
This is used specifically for positional options. If your tool has a command line that looks like:
* tool [options] min-value max-value selection *
The required arguments min-value, max-value, and selection are actually "hidden" options and will not be printed out when boost::program_options generates its help message. The AggregateOptions class will build the full command line for the help message by using the help() methods from each OptionsPackage, printing out something like the above on the command line as part of the help output.
Post-processing of options returning true if there were no problems, otherwise false.
postConditions() is called after options parsing and validation is complete. This is a mechanism for a subclass to do additional processing with the options it has been provided. For example, a model option subclass might read in the specified model and copy coordinates from an optionally specified file.