Documentation for microsoft::quantum::ConfigBind
microsoft::quantum::ConfigBind
#include <Commandline/ConfigBind.hpp>
Inherits from microsoft::quantum::IConfigBind
Public Types
Name | |
---|---|
using typename std::decay< T >::type | Type |
using std::unordered_set< std::string > | StringSet |
using std::vector< std::string > | StringList |
template <typename A ,typename B ,typename R > using typename std::enable_if< std::is_same< A, B >::value, R >::type |
EnableIf Helper template to conditionally disable implementation unless a specific type is used. |
Public Functions
Name | |
---|---|
ConfigBind() | |
ConfigBind(ConfigBind const & ) | |
ConfigBind(ConfigBind && ) | |
ConfigBind & | operator=(ConfigBind const & ) |
ConfigBind & | operator=(ConfigBind && ) |
~ConfigBind() override =default | |
ConfigBind(Type & bind, T default_value, String const & name, String const & description, ParameterVisibility visibility =ParameterVisibility::CliAndConfig) | |
void | markAsExperimental(Type const & off_value) |
virtual bool | setupArguments(ParameterParser & parser) override Adds the argument to the parser. |
virtual bool | configure(ParameterParser & parser, bool experimental_mode) override |
virtual void | reset() override Resets the current value to the default value. |
virtual String | value() override String representation of the bound value. |
virtual void * | pointer() const override Pointer to underlying data. |
virtual void * | pointerDefaultValue() override Pointer to underlying default value. |
virtual std::type_index | valueType() const override Type index of contained data. |
virtual void | setValueFromYamlNode(YAML::Node const & node) override Method to load value from YAML configuration. |
virtual void | updateValueInYamlNode(YAML::Node & node) override Dumps the current value to the node. |
template <typename R > ConfigBind< T >::template EnableIfNotSerializable< R, void > |
alterNameBasedOnType(R const & default_value) |
template <typename R > ConfigBind< T >::template EnableIfSerializable< R, void > |
alterNameBasedOnType(R const & ) |
template <typename A > ConfigBind< T >::template EnableIfNotSerializable< A, String > |
valueAsString(A const & val) |
template <typename A > ConfigBind< T >::template EnableIfSerializable< A, String > |
valueAsString(A const & ) |
template <typename A > ConfigBind< T >::template EnableIfNotSerializable< A, void > |
loadValue(ParameterParser & parser, A const & ) |
template <typename A > ConfigBind< T >::template EnableIfSerializable< A, void > |
loadValue(ParameterParser & parser, A const & ) |
template <typename R > ConfigBind< T >::template EnableIfNotSerializable< R, void > |
loadYaml(YAML::Node const & node, R & value) |
template <typename R > ConfigBind< T >::template EnableIfNotSerializable< R, void > |
saveYaml(YAML::Node & node, R const & value) |
template <typename R > ConfigBind< T >::template EnableIfSerializable< R, void > |
loadYaml(YAML::Node const & node, R & value) |
template <typename R > ConfigBind< T >::template EnableIfSerializable< R, void > |
saveYaml(YAML::Node & node, R const & value) |
Additional inherited members
Public Types inherited from microsoft::quantum::IConfigBind
Name | |
---|---|
enum | ParameterVisibility { None, CliOnly, ConfigOnly, CliAndConfig} |
Public Functions inherited from microsoft::quantum::IConfigBind
Name | |
---|---|
IConfigBind(IConfigBind const & ) | |
IConfigBind(IConfigBind && ) | |
virtual | ~IConfigBind() |
String | name() const Returns the name of the bound configuration variable. |
String | description() const Returns the description of the configuration variable. |
bool | isFlag() const Indicates whether or not this. |
String | defaultValue() const Returns the default value for the flag. |
bool | isExperimental() const Indicates whether or not this is an experimental config. |
bool | isLoadAndSavable() const |
bool | isAvailableToCli() const Indicates whether or not this paramter is available to the CLI. |
void | setShorthandNotation(String const & name) Set shorthand notation. |
String | shorthandNotation() const Gets shorthand notation. |
Protected Functions inherited from microsoft::quantum::IConfigBind
Name | |
---|---|
IConfigBind(String const & name, String const & description, ParameterVisibility visibility =ParameterVisibility::CliAndConfig) | |
void | setName(String const & name) Sets the name of the configuration variable. |
void | markAsFlag() Marks the variable as a flag. |
void | setDefault(String const & v) Sets the default value as a string. |
void | makeSettingExperimental() Marks the config as experimental. |
Detailed Description
template <typename T >
class microsoft::quantum::ConfigBind;
Generic implementation of the bind interface for different types. This class holds the name of the command line parameter and a reference variable corresponding to it. It implements serializers and deserializers to allow transforming strings to native values and vice versa.
Public Types Documentation
using Type
using microsoft::quantum::ConfigBind< T >::Type = typename std::decay<T>::type;
using StringSet
using microsoft::quantum::ConfigBind< T >::StringSet = std::unordered_set<std::string>;
using StringList
using microsoft::quantum::ConfigBind< T >::StringList = std::vector<std::string>;
using EnableIf
template <typename A ,
typename B ,
typename R >
using microsoft::quantum::ConfigBind< T >::EnableIf = typename std::enable_if<std::is_same<A, B>::value, R>::type;
Helper template to conditionally disable implementation unless a specific type is used.
Public Functions Documentation
function ConfigBind
ConfigBind()
function ConfigBind
ConfigBind(
ConfigBind const &
)
function ConfigBind
ConfigBind(
ConfigBind &&
)
function operator=
ConfigBind & operator=(
ConfigBind const &
)
function operator=
ConfigBind & operator=(
ConfigBind &&
)
function ~ConfigBind
~ConfigBind() override =default
function ConfigBind
ConfigBind(
Type & bind,
T default_value,
String const & name,
String const & description,
ParameterVisibility visibility =ParameterVisibility::CliAndConfig
)
Constructor to bind value to parameter. This class holds a reference to a variable together with the name it is expected to have when passed through the parameter parser.
function markAsExperimental
void markAsExperimental(
Type const & off_value
)
function setupArguments
virtual bool setupArguments(
ParameterParser & parser
) override
Adds the argument to the parser.
Reimplements: microsoft::quantum::IConfigBind::setupArguments
function configure
virtual bool configure(
ParameterParser & parser,
bool experimental_mode
) override
Reimplements: microsoft::quantum::IConfigBind::configure
Configures the bound value. This method examines the parsed input and use updates the bound value accordingly.
function reset
virtual void reset() override
Resets the current value to the default value.
Reimplements: microsoft::quantum::IConfigBind::reset
function value
virtual String value() override
String representation of the bound value.
Reimplements: microsoft::quantum::IConfigBind::value
function pointer
virtual void * pointer() const override
Pointer to underlying data.
Reimplements: microsoft::quantum::IConfigBind::pointer
function pointerDefaultValue
virtual void * pointerDefaultValue() override
Pointer to underlying default value.
Reimplements: microsoft::quantum::IConfigBind::pointerDefaultValue
function valueType
virtual std::type_index valueType() const override
Type index of contained data.
Reimplements: microsoft::quantum::IConfigBind::valueType
function setValueFromYamlNode
virtual void setValueFromYamlNode(
YAML::Node const & node
) override
Method to load value from YAML configuration.
Reimplements: microsoft::quantum::IConfigBind::setValueFromYamlNode
function updateValueInYamlNode
virtual void updateValueInYamlNode(
YAML::Node & node
) override
Dumps the current value to the node.
Reimplements: microsoft::quantum::IConfigBind::updateValueInYamlNode
function alterNameBasedOnType
template <typename R >
ConfigBind< T >::template EnableIfNotSerializable< R, void > alterNameBasedOnType(
R const & default_value
)
function alterNameBasedOnType
template <typename R >
ConfigBind< T >::template EnableIfSerializable< R, void > alterNameBasedOnType(
R const &
)
function valueAsString
template <typename A >
ConfigBind< T >::template EnableIfNotSerializable< A, String > valueAsString(
A const & val
)
function valueAsString
template <typename A >
ConfigBind< T >::template EnableIfSerializable< A, String > valueAsString(
A const &
)
function loadValue
template <typename A >
ConfigBind< T >::template EnableIfNotSerializable< A, void > loadValue(
ParameterParser & parser,
A const &
)
function loadValue
template <typename A >
ConfigBind< T >::template EnableIfSerializable< A, void > loadValue(
ParameterParser & parser,
A const &
)
function loadYaml
template <typename R >
ConfigBind< T >::template EnableIfNotSerializable< R, void > loadYaml(
YAML::Node const & node,
R & value
)
function saveYaml
template <typename R >
ConfigBind< T >::template EnableIfNotSerializable< R, void > saveYaml(
YAML::Node & node,
R const & value
)
function loadYaml
template <typename R >
ConfigBind< T >::template EnableIfSerializable< R, void > loadYaml(
YAML::Node const & node,
R & value
)
function saveYaml
template <typename R >
ConfigBind< T >::template EnableIfSerializable< R, void > saveYaml(
YAML::Node & node,
R const & value
)
Updated on 1 August 2023 at 16:25:10 UTC