Class ParameterValueView¶
Defined in File parameter.hpp
Class Documentation¶
-
class ParameterValueView¶
A view over an unowned parameter value.
This lifetime of this view is tied to the
ParameterValue
from which it was derived. It is the caller’s responsibility to ensure the validity of this lifetime when accessing the view.Public Types
-
using Array = std::vector<ParameterValueView>¶
An array of values.
-
using Dict = std::map<std::string, ParameterValueView>¶
A dictionary of values, mapped by string.
Public Functions
-
class ParameterValue clone() const¶
Creates a deep clone of this parameter value.
-
Value value() const¶
Returns a variant representation of the value.
ParameterValueView implementation
-
template<typename T>
inline bool is() const noexcept¶ Checks whether the parameter value matches the specified type.
- Template Parameters:
T – The expected type of the parameter value.
-
template<>
inline bool is() const noexcept¶ Checks whether the parameter value is a string.
-
template<typename T>
inline T get() const¶ Extracts a value from the parameter.
This method will throw an exception if the type does not match. You can use
ParameterValueView::is<T>()
to check that the type matches before calling this method.- Template Parameters:
T – The type of the value to extract.
-
template<>
inline ParameterValueView get() const¶ Extracts the parameter as itself.
-
template<>
inline std::string get() const¶ Extracts the parameter as an owned string.
-
using Array = std::vector<ParameterValueView>¶