#include <gromacs/selection/selectionoptionmanager.h>
Handles interaction of selection options with other options and user input.
This class implements interaction of SelectionOption with SelectionCollection, and also implements features of SelectionOption that require actions outside options parsing. It also implements the coupling between SelectionOption and SelectionFileOption. It needs to be added using Options::addManager() before SelectionOption or SelectionFileOption options can be added to an Options collection.
The main features of this class are:
Creates a manager for selection options.
- Exceptions
-
std::bad_alloc | if out of memory. |
void gmx::SelectionOptionManager::convertOptionValue |
( |
SelectionOptionStorage * |
storage, |
|
|
const std::string & |
value, |
|
|
bool |
bFullValue |
|
) |
| |
Converts a string value to selections for an option.
- Parameters
-
| storage | Storage object to receive the selections. |
[in] | value | Value to convert. |
[in] | bFullValue | If true, the provided selections are the full value of the option, and additional checks are performed. |
- Exceptions
-
std::bad_alloc | if out of memory. |
InvalidInputError | if the selection string is not valid, or uses a feature not supported by the option. |
This is only for internal use by the selection module. It is not possible to obtain a SelectionOptionStorage pointer through any public or library API.
void gmx::SelectionOptionManager::parseRequestedFromFile |
( |
const std::string & |
filename | ) |
|
Parses selection(s) from a file for options not yet provided.
- Parameters
-
[in] | filename | Name of the file to parse selections from. |
- Exceptions
-
unspecified | Can throw any exception thrown by SelectionCollection::parseFromFile(). |
std::bad_alloc | if out of memory. |
InvalidInputError | if
- the number of selections in
filename doesn't match the number requested.
- any selection uses a feature that is not allowed for the corresponding option.
- if there is a request for any number of selections that is not the last (in which case it is not possible to determine which selections belong to which request).
|
This method behaves as parseRequestedFromStdin(), with two exceptions:
- It reads the selections from a file instead of standard input.
- If no requests are pending, assigns values to all required options that have not yet been set.
This method used to implement SelectionFileOption.
- See Also
- parseRequestedFromStdin()
void gmx::SelectionOptionManager::parseRequestedFromStdin |
( |
bool |
bInteractive | ) |
|
Parses selection(s) from standard input for options not yet provided.
- Parameters
-
[in] | bInteractive | Whether the parser should behave interactively. |
- Exceptions
-
This method cooperates with SelectionOption to allow interactive input of requested selections after all options have been processed. It should be called after the Options::finish() method has been called on all options that add selections to this collection. For each required selection option that has not been given, as well as for optional selection options that have been specified without values, it will prompt the user to input the necessary selections.
void gmx::SelectionOptionManager::parseRequestedFromString |
( |
const std::string & |
str | ) |
|
Parses selection(s) from a string for options not yet provided.
- Parameters
-
- Exceptions
-
This method behaves as parseRequestedFromFile(), but reads the selections from a string instead of a file. This method is mainly used for testing.
- See Also
- parseRequestedFromFile()
Adds a selection option to be managed.
- Parameters
-
storage | Storage object for the option to register. |
- Exceptions
-
std::bad_alloc | if out of memory. |
This is only for internal use by the selection module. It is not possible to obtain a SelectionOptionStorage pointer through any public or library API.
Strong exception safety.
Adds a selection option for delayed user input.
- Parameters
-
storage | Storage object for the option to request. |
- Exceptions
-
std::bad_alloc | if out of memory. |
This is only for internal use by the selection module. It is not possible to obtain a SelectionOptionStorage pointer through any public or library API.
Strong exception safety.
The documentation for this class was generated from the following files: