DynExp
Highly flexible laboratory automation for dynamically changing experiments.
DynExp::ParamsBase::TypedListParamBase< ParamType > Class Template Reference

Base class of parameters containing lists of values. More...

+ Inheritance diagram for DynExp::ParamsBase::TypedListParamBase< ParamType >:

Public Types

using UnderlyingType = std::vector< ParamType >
 List type to be used for the parameter. More...
 

Public Member Functions

const auto & GetDefaultValue () const noexcept
 Returns this parameter's default value list. Thread-safe since a reference to a const member variable is returned. More...
 
const auto & Get () const noexcept
 Returns the parameter's values. More...
 
auto & operator= (const UnderlyingType &NewValues)
 Assigns new values 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
 
ParamBaseoperator= (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

 TypedListParamBase (ParamsBase &Owner, std::string ParamName, std::string_view ParamTitle, std::string_view ParamDescription, bool NeedsResetToApplyChange=true, UnderlyingType DefaultValues={})
 Base constructor of any parameter to be used if a parameter should be displayed in a settings dialog (UserEditable is set to true). More...
 
 TypedListParamBase (ParamsBase &Owner, std::string ParamName, UnderlyingType DefaultValues={})
 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 ValidateValues (const UnderlyingType &NewValues) const
 Called by ValidateChild(). Validates a list of values. Override to validate the vector which is about to be assigned to the list parameter. Returns true by default. More...
 
virtual void ResetChild () override
 Resets this parameter to its default value. More...
 

Private Attributes

const UnderlyingType DefaultValues
 Values to assign to the parameter upon construction and reset. More...
 
UnderlyingType Values
 Current parameter values. 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...
 

Detailed Description

template<typename ParamType>
class DynExp::ParamsBase::TypedListParamBase< ParamType >

Base class of parameters containing lists of values.

Template Parameters
ParamTypeUnderlying value type of the parameter's list entries

Definition at line 631 of file Object.h.

Member Typedef Documentation

◆ UnderlyingType

template<typename ParamType >
using DynExp::ParamsBase::TypedListParamBase< ParamType >::UnderlyingType = std::vector<ParamType>

List type to be used for the parameter.

Definition at line 637 of file Object.h.

Constructor & Destructor Documentation

◆ TypedListParamBase() [1/2]

template<typename ParamType >
DynExp::ParamsBase::TypedListParamBase< ParamType >::TypedListParamBase ( ParamsBase Owner,
std::string  ParamName,
std::string_view  ParamTitle,
std::string_view  ParamDescription,
bool  NeedsResetToApplyChange = true,
UnderlyingType  DefaultValues = {} 
)
inlineprotected

Base constructor of any parameter to be used if a parameter should be displayed in a settings dialog (UserEditable is set to true).

Parameters
OwnerParamsBase instance owning this parameter.
ParamNameName of the parameter to be used in the XML config file. std::string to allow for auto-generated names.
ParamTitleTitle of the parameter to be displayed in settings dialogs. A static string literal with a constant address is expected.
ParamDescriptionDetailed description of the parameter to be displayed in settings dialogs. A static string literal with a constant address is expected.
NeedsResetToApplyChangeIndicated whether the object this parameter belongs to needs to be reset to apply changes if this parameter's value has changed.
DefaultValuesList of default values to assign to the constructed parameter

Definition at line 644 of file Object.h.

◆ TypedListParamBase() [2/2]

template<typename ParamType >
DynExp::ParamsBase::TypedListParamBase< ParamType >::TypedListParamBase ( ParamsBase Owner,
std::string  ParamName,
UnderlyingType  DefaultValues = {} 
)
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).

Parameters
OwnerParamsBase instance owning this parameter.
ParamNameName of the parameter to be used in the XML config file. std::string to allow for auto-generated names.
DefaultValuesList of default values to assign to the constructed parameter

Definition at line 653 of file Object.h.

Member Function Documentation

◆ FromXMLNodeChild()

template<typename ParamType >
virtual void DynExp::ParamsBase::TypedListParamBase< ParamType >::FromXMLNodeChild ( const QDomElement &  XMLElement)
inlineoverrideprotectedvirtual

Restores this parameter's value from the given Qt dom element (describing an XML node)

Parameters
XMLElementQt dom element containing information about this parameter.

Implements DynExp::ParamsBase::ParamBase.

Reimplemented in DynExp::ParamsBase::ListParam< LinkType, std::enable_if_t< std::is_base_of_v< ObjectLinkBase, LinkType > > >.

Definition at line 705 of file Object.h.

◆ Get()

template<typename ParamType >
const auto& DynExp::ParamsBase::TypedListParamBase< ParamType >::Get ( ) const
inlinenoexcept

Returns the parameter's values.

Returns
Current parameter value list

Definition at line 668 of file Object.h.

◆ GetDefaultValue()

template<typename ParamType >
const auto& DynExp::ParamsBase::TypedListParamBase< ParamType >::GetDefaultValue ( ) const
inlinenoexcept

Returns this parameter's default value list. Thread-safe since a reference to a const member variable is returned.

Returns
Parameter's default values

Definition at line 662 of file Object.h.

◆ operator=()

template<typename ParamType >
auto& DynExp::ParamsBase::TypedListParamBase< ParamType >::operator= ( const UnderlyingType NewValues)
inline

Assigns new values to this parameter. The operator cannot be accessed by Object because this function is not const.

Parameters
NewValuesNew values to assign
Returns
Reference to this parameter
Exceptions
Util::InvalidArgExceptionis thrown if the values to assign to the parameter are not considered valid as determined by a call to ParamBase::Validate().

Definition at line 678 of file Object.h.

◆ ResetChild()

template<typename ParamType >
virtual void DynExp::ParamsBase::TypedListParamBase< ParamType >::ResetChild ( )
inlineoverrideprivatevirtual

Resets this parameter to its default value.

Implements DynExp::ParamsBase::ParamBase.

Definition at line 743 of file Object.h.

◆ ToXMLNodeChild()

template<typename ParamType >
virtual void DynExp::ParamsBase::TypedListParamBase< ParamType >::ToXMLNodeChild ( QDomDocument &  Document,
QDomElement &  XMLElement 
) const
inlineoverrideprotectedvirtual

Converts this parameter to a Qt dom element (describing an XML node containing this parameter's name and value).

Parameters
DocumentQt dom document within to create the dom element.
XMLElementQt dom element to save information about this parameter to.

Implements DynExp::ParamsBase::ParamBase.

Definition at line 689 of file Object.h.

◆ ValidateChild()

template<typename ParamType >
virtual bool DynExp::ParamsBase::TypedListParamBase< ParamType >::ValidateChild ( ) const
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.

Returns
Returns true if the parameter is valid. Returns false if it was invalid and has been reset. Returns true by default.

Reimplemented from DynExp::ParamsBase::ParamBase.

Definition at line 733 of file Object.h.

◆ ValidateValues()

template<typename ParamType >
virtual bool DynExp::ParamsBase::TypedListParamBase< ParamType >::ValidateValues ( const UnderlyingType NewValues) const
inlineprivatevirtual

Called by ValidateChild(). Validates a list of values. Override to validate the vector which is about to be assigned to the list parameter. Returns true by default.

Parameters
NewValuesValues to be validated before the assignment
Returns
Returns true if NewValues is considered valid, false otherwise.

Definition at line 741 of file Object.h.

Member Data Documentation

◆ DefaultValues

template<typename ParamType >
const UnderlyingType DynExp::ParamsBase::TypedListParamBase< ParamType >::DefaultValues
private

Values to assign to the parameter upon construction and reset.

Definition at line 745 of file Object.h.

◆ Values

template<typename ParamType >
UnderlyingType DynExp::ParamsBase::TypedListParamBase< ParamType >::Values
private

Current parameter values.

Definition at line 746 of file Object.h.


The documentation for this class was generated from the following file: