File ParametrizedOptionListDescriptor.h¶
- Copyright
This code is licensed under the 3-clause BSD license.
Copyright ETH Zurich, Laboratory for Physical Chemistry, Reiher Group.
See LICENSE.txt for details.
-
namespace
Scine
This header file contains functions that allow for common notation for common things that can be done at a different degree of derivatives.
This header contains alias definitions defining which classes to use for the different degrees of derivatives.
-
namespace
Utils
-
namespace
UniversalSettings
-
class
ParametrizedOptionListDescriptor
: public Scine::Utils::UniversalSettings::SettingDescriptor - #include <ParametrizedOptionListDescriptor.h>
SettingDescriptor for a list of options, of which one must be chosen, with corresponding settings (that depend on the exact option).
This is for example useful if one of several algorithms must be chosen for some task and each algorithm has specific settings.
Public Types
-
using
OptionAndSettings
= std::pair<std::string, DescriptorCollection>¶
Public Functions
-
ParametrizedOptionListDescriptor
(std::string propertyDescription) Constructor.
- Parameters
propertyDescription
: A string describing what the options are for
-
std::unique_ptr<SettingDescriptor>
clone
() const Create a heap-allocated base pointer copy of this instance.
- Return
A heap-allocated copy of this instance
-
GenericValue
getDefaultGenericValue
() const Creates a type-erased representation of the setting’s default value.
- Return
A type-erased representation of the setting’s default value
-
bool
validValue
(const GenericValue &v) const Checks if a particular type-erased representation of a setting is a valid value for this kind of setting.
- Return
Whether the type-erased representation is a valid value for this kind of setting
- Parameters
v
: A type-erased setting representation
-
int
optionCount
() const Returns the number of available options.
-
bool
optionExists
(const std::string &name) const Returns whether a string-identified option exists.
-
int
getDefaultIndex
() const Returns the index of the default option within the list of options.
- Exceptions
EmptyOptionListException
: if the list of options is empty
-
const std::string &
getDefaultValue
() const Returns the default chosen value.
-
const std::string &
getDefaultOption
() const Returns the default chosen value.
-
const std::vector<OptionAndSettings> &
getAllOptions
() const Read-only accessor to list of option strings and their matching settings.
-
void
addOption
(std::string option) Add an option for which there are no specific settings.
-
void
addOption
(std::string option, DescriptorCollection optionSettings) Add an option with the corresponding specific settings.
-
void
setDefaultOption
(const std::string &def) Sets the default option to a particular string.
- Parameters
def
: The option to select as default
- Exceptions
OptionDoesNotExistException
: if the supplied option does not match an existing option
-
const DescriptorCollection &
getSettings
(const std::string &option) const Fetch the settings corresponding to a particular option.
-
const DescriptorCollection &
getDefaultSettings
() const Fetch the settings corresponding to the default option.
Private Functions
-
int
getIndex
(const std::string &option) const¶
-
using
-
class
-
namespace
-
namespace