Gromacs
2016.6
|
#include <gromacs/selection/selectionoptionstorage.h>
Converts, validates, and stores selection values.
Public Member Functions | |
SelectionOptionStorage (const SelectionOption &settings, SelectionOptionManager *manager) | |
Initializes the storage from option settings. More... | |
virtual OptionInfo & | optionInfo () |
Returns an option info object corresponding to this option. | |
virtual std::string | typeString () const |
Returns a short string describing the type of the option. | |
virtual std::string | formatSingleValue (const Selection &value) const |
Formats a single value as a string. More... | |
void | addSelections (const SelectionList &selections, bool bFullValue) |
Adds selections to the storage. More... | |
bool | allowsOnlyAtoms () const |
Whether the option allows only atom-valued selections. | |
void | setAllowedValueCount (int count) |
Sets the number of selections allowed for the option. More... | |
void | setSelectionFlag (SelectionFlag flag, bool bSet) |
Alters flags for the selections created by this option. More... | |
Public Member Functions inherited from gmx::OptionStorageTemplate< Selection > | |
virtual int | valueCount () const |
Returns the number of option values added so far. More... | |
virtual std::string | formatValue (int i) const |
Returns the i'th value formatted as a string. More... | |
Public Member Functions inherited from gmx::AbstractOptionStorage | |
bool | isSet () const |
Returns true if the option has been set. | |
bool | isBoolean () const |
Returns true if the option is a boolean option. More... | |
bool | isHidden () const |
Returns true if the option is a hidden option. | |
bool | isRequired () const |
Returns true if the option is required. | |
bool | isVector () const |
Returns true if the option is vector-valued. | |
const std::string & | name () const |
Returns the name of the option. | |
const std::string & | description () const |
Returns the description of the option set by the calling code. | |
bool | defaultValueIfSetExists () const |
Returns true if defaultValueIfSet() value is specified. | |
int | minValueCount () const |
Returns the minimum number of values required in one set. | |
int | maxValueCount () const |
Returns the maximum allowed number of values in one set (-1 = no limit). | |
virtual std::string | formatExtraDescription () const |
Formats additional description for the option. More... | |
std::string | formatDefaultValueIfSet () const |
Returns the default value if set for the option as a string. More... | |
void | startSource () |
Starts adding values from a new source for the option. More... | |
void | startSet () |
Starts adding a new set of values for the option. More... | |
void | appendValue (const std::string &value) |
Adds a new value for the option, converting it from a string. More... | |
void | finishSet () |
Performs validation and/or actions once a set of values has been added. More... | |
void | finish () |
Performs validation and/or actions once all values have been added. More... | |
Additional Inherited Members | |
Public Types inherited from gmx::OptionStorageTemplate< Selection > | |
typedef OptionStorageTemplate < Selection > | MyBase |
Alias for the template class for use in base classes. | |
typedef std::vector< Selection > | ValueList |
Type of the container that contains the current values. | |
Protected Member Functions inherited from gmx::OptionStorageTemplate< Selection > | |
OptionStorageTemplate (const OptionTemplate< Selection, U > &settings, OptionFlags staticFlags=OptionFlags()) | |
Initializes the storage from option settings. More... | |
OptionStorageTemplate (const AbstractOption &settings) | |
Initializes the storage from base option settings. More... | |
virtual void | clearSet () |
Removes all values from temporary storage for a set. More... | |
virtual void | processSet () |
Performs validation and/or actions once a set of values has been added. More... | |
void | clear () |
Removes all values from the storage. More... | |
void | addValue (const Selection &value) |
Adds a value to a temporary storage. More... | |
void | commitValues () |
Commits values added with addValue(). More... | |
virtual void | refreshValues () |
Updates alternative store locations. More... | |
void | setDefaultValue (const Selection &value) |
Sets the default value for the option. More... | |
void | setDefaultValueIfSet (const Selection &value) |
Sets the default value if set for the option. More... | |
ValueList & | values () |
Provides derived classes access to the current list of values. More... | |
const ValueList & | values () const |
Provides derived classes access to the current list of values. | |
Protected Member Functions inherited from gmx::AbstractOptionStorage | |
AbstractOptionStorage (const AbstractOption &settings, OptionFlags staticFlags) | |
Initializes the storage object from the settings object. More... | |
void | markAsSet () |
Marks the option as set. | |
bool | hasFlag (OptionFlag flag) const |
Returns true if the given flag is set. | |
void | setFlag (OptionFlag flag) |
Sets the given flag. | |
void | clearFlag (OptionFlag flag) |
Clears the given flag. | |
void | setMinValueCount (int count) |
Sets a new minimum number of values required in one set. More... | |
void | setMaxValueCount (int count) |
Sets a new maximum number of values required in one set. More... | |
Static Protected Attributes inherited from gmx::AbstractOptionStorage | |
static const int | DefaultValueIfSetIndex = -1 |
Index used with formatValue() for formatting default value if set. | |
gmx::SelectionOptionStorage::SelectionOptionStorage | ( | const SelectionOption & | settings, |
SelectionOptionManager * | manager | ||
) |
Initializes the storage from option settings.
[in] | settings | Storage settings. |
manager | Manager for this object. |
void gmx::SelectionOptionStorage::addSelections | ( | const SelectionList & | selections, |
bool | bFullValue | ||
) |
Adds selections to the storage.
[in] | selections | List of selections to add. |
[in] | bFullValue | If true, the provided selections are the full value of the option, and additional checks are performed. |
std::bad_alloc | if out of memory. |
InvalidInputError | if
|
This function is used to add selections from SelectionOptionManager. It is called with bFullValue
set to false from SelectionOptionManager::convertOptionValue(), and bFullValue
set to true when parsing requested selections.
|
virtual |
Formats a single value as a string.
[in] | value | Value to format. |
value
formatted as a string.The derived class must provide this method to format values a strings. Called by formatValue() to do the actual formatting.
Implements gmx::OptionStorageTemplate< Selection >.
void gmx::SelectionOptionStorage::setAllowedValueCount | ( | int | count | ) |
Sets the number of selections allowed for the option.
[in] | count | Number of allowed selections. |
std::bad_alloc | if out of memory. |
InvalidInputError | if values have already been provided and their count does not match. |
void gmx::SelectionOptionStorage::setSelectionFlag | ( | SelectionFlag | flag, |
bool | bSet | ||
) |
Alters flags for the selections created by this option.
[in] | flag | Flag to change. |
[in] | bSet | Whether to set or clear the flag. |
std::bad_alloc | if out of memory. |
InvalidInputError | if selections have already been provided and conflict with the given flags. |
If selections have already been provided, it is checked that they match the limitations enforced by the flags. Pending requests are also affected.
Strong exception safety guarantee.