DynExp
Highly flexible laboratory automation for dynamically changing experiments.
|
Base class of parameters containing a single value. More...
Public Types | |
using | UnderlyingType = ParamType |
Public Member Functions | |
ParamType | GetDefaultValue () const noexcept |
Returns this parameter's default value. Thread-safe since a const member variable is returned. More... | |
operator ParamType () const noexcept | |
Converts the parameter implicitly to its underlying type returning its current value. More... | |
const ParamType & | Get () const noexcept |
Returns the parameter's value. More... | |
const ParamType & | operator= (const ParamType &NewValue) |
Assigns a new value to this parameter. The operator cannot be accessed by Object because this function is not const. More... | |
Public Member Functions inherited from DynExp::ParamsBase::ParamBase | |
ParamBase (const ParamBase &)=delete | |
ParamBase & | operator= (const ParamBase &)=delete |
QDomElement | ToXMLNode (QDomDocument &Document) const |
Converts this parameter to a Qt dom element (describing an XML node containing this parameter's name and value). More... | |
void | FromXMLNode (const QDomElement &XMLElement) |
Restores this parameter's value from the given Qt dom element (describing an XML node) More... | |
bool | Validate () |
Checks whether a valid value is assigned to this parameter. This function is not const since it is also intended to reset the parameter if it is invalid. More... | |
void | Reset () |
Resets this parameter to its default value. More... | |
bool | IsUserEditable () const noexcept |
Returns ParamBase::UserEditable. More... | |
std::string_view | GetParamName () const noexcept |
Returns ParamBase::ParamName. More... | |
std::string_view | GetParamTitle () const noexcept |
Returns ParamBase::ParamTitle. More... | |
std::string_view | GetParamDescription () const noexcept |
Returns ParamBase::ParamDescription. More... | |
bool | GetNeedsResetToApplyChange () const noexcept |
Returns ParamBase::NeedsResetToApplyChange. More... | |
Protected Member Functions | |
TypedParamBase (ParamsBase &Owner, std::string ParamName, std::string_view ParamTitle, std::string_view ParamDescription, bool NeedsResetToApplyChange=true, ParamType DefaultValue=ParamType()) | |
Base constructor of any parameter to be used if a parameter should be displayed in a settings dialog (UserEditable is set to true). More... | |
TypedParamBase (ParamsBase &Owner, std::string ParamName, ParamType DefaultValue=ParamType()) | |
Base constructor of any parameter to be used if a parameter should not be displayed in a settings dialog (UserEditable is set to false). More... | |
virtual void | ToXMLNodeChild (QDomDocument &Document, QDomElement &XMLElement) const override |
Converts this parameter to a Qt dom element (describing an XML node containing this parameter's name and value). More... | |
virtual void | FromXMLNodeChild (const QDomElement &XMLElement) override |
Restores this parameter's value from the given Qt dom element (describing an XML node) More... | |
Protected Member Functions inherited from DynExp::ParamsBase::ParamBase | |
ParamBase (ParamsBase &Owner, std::string ParamName, std::string_view ParamTitle, std::string_view ParamDescription, bool NeedsResetToApplyChange) | |
Base constructor of any parameter to be used if a parameter should be displayed in a settings dialog (UserEditable is set to true). More... | |
ParamBase (ParamsBase &Owner, std::string ParamName) | |
Base constructor of any parameter to be used if a parameter should not be displayed in a settings dialog (UserEditable is set to false). More... | |
virtual | ~ParamBase ()=0 |
const auto & | GetOwner () const noexcept |
Returns the ParamsBase instance owning this ParamBase instance. More... | |
auto & | GetOwner () noexcept |
Returns the ParamsBase instance owning this ParamBase instance. More... | |
Private Member Functions | |
virtual bool | ValidateChild () const override final |
Checks whether a valid value is assigned to this parameter. This function is not const since it is also intended to reset the parameter if it is invalid. Returns true by default. More... | |
virtual bool | ValidateValue (const ParamType &NewValue) const |
Called by ValidateChild(). Validates a single value. Override to validate the value which is about to be assigned to the parameter. Returns true by default. More... | |
virtual void | ResetChild () override |
Resets this parameter to its default value. More... | |
Private Attributes | |
const ParamType | DefaultValue |
Value to assign to the parameter upon construction and reset. More... | |
ParamType | Value |
Current parameter value. More... | |
Additional Inherited Members | |
Public Attributes inherited from DynExp::ParamsBase::ParamBase | |
ParamsBaseOnlyType | ParamsBaseOnly |
Provides the class ParamsBase access to some private members of class ParamBase . More... | |
Base class of parameters containing a single value.
ParamType | Underlying parameter value type |
using DynExp::ParamsBase::TypedParamBase< ParamType >::UnderlyingType = ParamType |
|
inlineprotected |
Base constructor of any parameter to be used if a parameter should be displayed in a settings dialog (UserEditable is set to true).
Owner | ParamsBase instance owning this parameter. |
ParamName | Name of the parameter to be used in the XML config file. std::string to allow for auto-generated names. |
ParamTitle | Title of the parameter to be displayed in settings dialogs. A static string literal with a constant address is expected. |
ParamDescription | Detailed description of the parameter to be displayed in settings dialogs. A static string literal with a constant address is expected. |
NeedsResetToApplyChange | Indicated whether the object this parameter belongs to needs to be reset to apply changes if this parameter's value has changed. |
DefaultValue | Default value to assign to the constructed parameter |
|
inlineprotected |
Base constructor of any parameter to be used if a parameter should not be displayed in a settings dialog (UserEditable is set to false).
Owner | ParamsBase instance owning this parameter. |
ParamName | Name of the parameter to be used in the XML config file. std::string to allow for auto-generated names. |
DefaultValue | Default value to assign to the constructed parameter |
|
inlineoverrideprotectedvirtual |
Restores this parameter's value from the given Qt dom element (describing an XML node)
XMLElement | Qt dom element containing information about this parameter. |
Implements DynExp::ParamsBase::ParamBase.
Reimplemented in DynExp::ParamsBase::Param< LinkType, std::enable_if_t< std::is_base_of_v< ObjectLinkBase, LinkType > > >.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Assigns a new value to this parameter. The operator cannot be accessed by Object
because this function is not const.
NewValue | New value to assign |
Util::InvalidArgException | is thrown if the value to assign to the parameter is not considered valid as determined by a call to ParamBase::Validate(). |
|
inlineoverrideprivatevirtual |
Resets this parameter to its default value.
Implements DynExp::ParamsBase::ParamBase.
|
inlineoverrideprotectedvirtual |
Converts this parameter to a Qt dom element (describing an XML node containing this parameter's name and value).
Document | Qt dom document within to create the dom element. |
XMLElement | Qt dom element to save information about this parameter to. |
Implements DynExp::ParamsBase::ParamBase.
|
inlinefinaloverrideprivatevirtual |
Checks whether a valid value is assigned to this parameter. This function is not const since it is also intended to reset the parameter if it is invalid. Returns true by default.
Reimplemented from DynExp::ParamsBase::ParamBase.
|
inlineprivatevirtual |
Called by ValidateChild(). Validates a single value. Override to validate the value which is about to be assigned to the parameter. Returns true by default.
NewValue | Value to be validated before the assignment |
NewValue
is considered valid, false otherwise. Reimplemented in DynExp::ParamsBase::Param< ParamType, std::enable_if_t< std::is_base_of_v< IndexedTextList, ParamType > > >.
|
private |
|
private |