Gromacs
2022.2
|
#include <gromacs/options/ioptionscontainer.h>
Interface for adding input options.
This interface provides methods to add new options. Standard usage is for code to receive this interface and populate it with supported options:
The caller can collect options from multiple sources into a single container (a gmx::Options), and use a parser implementation such as CommandLineParser to provide values for the options.
Header basicoptions.h provides declarations of several standard option types for use with addOption(). Documentation of those classes also give more examples of how to define options.
Public Member Functions | |
virtual IOptionsContainer & | addGroup ()=0 |
Creates a subgroup of options within the current options. More... | |
template<class OptionType > | |
OptionType::InfoType * | addOption (const OptionType &settings) |
Adds a recognized option. More... | |
Protected Member Functions | |
virtual OptionInfo * | addOptionImpl (const AbstractOption &settings)=0 |
Adds a recognized option. More... | |
|
pure virtual |
Creates a subgroup of options within the current options.
To add options to the group, use the returned interface.
Currently, this is only used to influence the order of options: all options in a group appear before options in a group added after it, no matter in which order the options are added to the groups. In the future, the groups could also be used to influence the help output.
Implemented in gmx::Options, and gmx::AbstractOptionSectionHandle.
|
inline |
Adds a recognized option.
OptionType | Type of the options description object. |
[in] | settings | Option description. |
APIError | if invalid option settings are provided. |
The return value is a pointer for more convenient use in callers: often callers need to declare the variable that will hold the return value in wider scope than would be achieved by declaring it at the site where addOption() is called. The returned pointer must not be freed.
See class documentation for example usage.
OptionType::InfoType
must specify a type that derives from OptionInfo and matches the type that is returned by AbstractOptionStorage::optionInfo() for the storage object that corresponds to OptionType
.
|
protectedpure virtual |
Adds a recognized option.
[in] | settings | Option description. |
APIError | if invalid option settings are provided. |
This method provides the internal implementation, but the templated method is called from user code. See the templated method for more details.