DynExp
Highly flexible laboratory automation for dynamically changing experiments.
DynExp::ParamsBase::Param< EnumType, std::enable_if_t< std::is_enum_v< EnumType > > > Class Template Reference

Parameter for enumerations which are convertible to a numeric type. If ParamType is an enum, then extend TypedParamBase's functionality by providing conversion functionality and by overriding AddToDialogChild(). More...

+ Inheritance diagram for DynExp::ParamsBase::Param< EnumType, std::enable_if_t< std::is_enum_v< EnumType > > >:

Public Member Functions

 Param (ParamsBase &Owner, Util::TextValueListType< EnumType > &&TextValueList, std::string ParamName, std::string_view ParamTitle, std::string_view ParamDescription, bool NeedsResetToApplyChange=true, EnumType DefaultValue=EnumType())
 Base constructor of any parameter to be used if a parameter should be displayed in a settings dialog (UserEditable is set to true). More...
 
 Param (ParamsBase &Owner, std::string ParamName, EnumType DefaultValue=EnumType())
 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...
 
 operator EnumType () const noexcept
 Implicitely casts this parameter to the selected EnumType's item. More...
 
const EnumType Get () const noexcept
 Returns the selected EnumType's item of this parameter. More...
 
const EnumType operator= (const EnumType &NewValue)
 Assigns a new value to this parameter. Attention: operator= can change the parameter to a value which is not included in EnumType! More...
 
Thread-safe getter functions

Thread-safe since const member variables are returned.

EnumType GetDefaultValue () const noexcept
 Returns the default value of this parameter. More...
 
const auto & GetTextValueList () const noexcept
 Returns the selection options as a mapping between strings and corresponding EnumType's items. More...
 
- Public Member Functions inherited from DynExp::ParamsBase::TypedParamBase< ParamType >
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
 
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...
 

Private Member Functions

virtual void AddToDialogChild (ParamsConfigDialog &Dialog) override final
 Appends this parameter to a settings dialog making it configurable by the user. More...
 

Private Attributes

const Util::TextValueListType< EnumType > TextValueList
 Predefined selection options. More...
 

Additional Inherited Members

- Public Types inherited from DynExp::ParamsBase::TypedParamBase< ParamType >
using UnderlyingType = ParamType
 
- Public Attributes inherited from DynExp::ParamsBase::ParamBase
ParamsBaseOnlyType ParamsBaseOnly
 Provides the class ParamsBase access to some private members of class ParamBase. More...
 
- Protected Member Functions inherited from DynExp::ParamsBase::TypedParamBase< ParamType >
 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...
 

Detailed Description

template<typename EnumType>
class DynExp::ParamsBase::Param< EnumType, std::enable_if_t< std::is_enum_v< EnumType > > >

Parameter for enumerations which are convertible to a numeric type. If ParamType is an enum, then extend TypedParamBase's functionality by providing conversion functionality and by overriding AddToDialogChild().

Template Parameters
EnumTypeEnumeration type which is convertible to a numeric type (only unscoped enumerations)

Definition at line 1048 of file Object.h.

Constructor & Destructor Documentation

◆ Param() [1/2]

template<typename EnumType >
DynExp::ParamsBase::Param< EnumType, std::enable_if_t< std::is_enum_v< EnumType > > >::Param ( ParamsBase Owner,
Util::TextValueListType< EnumType > &&  TextValueList,
std::string  ParamName,
std::string_view  ParamTitle,
std::string_view  ParamDescription,
bool  NeedsResetToApplyChange = true,
EnumType  DefaultValue = EnumType() 
)
inline

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.
DefaultValueDefault value to assign to the constructed parameter
TextValueListPredefined list mapping strings to EnumType's items

Definition at line 1055 of file Object.h.

◆ Param() [2/2]

template<typename EnumType >
DynExp::ParamsBase::Param< EnumType, std::enable_if_t< std::is_enum_v< EnumType > > >::Param ( ParamsBase Owner,
std::string  ParamName,
EnumType  DefaultValue = EnumType() 
)
inline

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.
DefaultValueDefault value to assign to the constructed parameter

Definition at line 1063 of file Object.h.

Member Function Documentation

◆ AddToDialogChild()

template<typename EnumType >
virtual void DynExp::ParamsBase::Param< EnumType, std::enable_if_t< std::is_enum_v< EnumType > > >::AddToDialogChild ( ParamsConfigDialog Dialog)
inlinefinaloverrideprivatevirtual

Appends this parameter to a settings dialog making it configurable by the user.

Parameters
DialogReference to the settings dialog to append the parameter to

Implements DynExp::ParamsBase::ParamBase.

Definition at line 1105 of file Object.h.

◆ Get()

template<typename EnumType >
const EnumType DynExp::ParamsBase::Param< EnumType, std::enable_if_t< std::is_enum_v< EnumType > > >::Get ( ) const
inlinenoexcept

Returns the selected EnumType's item of this parameter.

Returns
Current parameter value cast to EnumType

Definition at line 1089 of file Object.h.

◆ GetDefaultValue()

template<typename EnumType >
EnumType DynExp::ParamsBase::Param< EnumType, std::enable_if_t< std::is_enum_v< EnumType > > >::GetDefaultValue ( ) const
inlinenoexcept

Returns the default value of this parameter.

Returns
EnumType's item which is selected by default

Definition at line 1075 of file Object.h.

◆ GetTextValueList()

template<typename EnumType >
const auto& DynExp::ParamsBase::Param< EnumType, std::enable_if_t< std::is_enum_v< EnumType > > >::GetTextValueList ( ) const
inlinenoexcept

Returns the selection options as a mapping between strings and corresponding EnumType's items.

Definition at line 1077 of file Object.h.

◆ operator EnumType()

template<typename EnumType >
DynExp::ParamsBase::Param< EnumType, std::enable_if_t< std::is_enum_v< EnumType > > >::operator EnumType ( ) const
inlinenoexcept

Implicitely casts this parameter to the selected EnumType's item.

Definition at line 1083 of file Object.h.

◆ operator=()

template<typename EnumType >
const EnumType DynExp::ParamsBase::Param< EnumType, std::enable_if_t< std::is_enum_v< EnumType > > >::operator= ( const EnumType &  NewValue)
inline

Assigns a new value to this parameter. Attention: operator= can change the parameter to a value which is not included in EnumType!

Parameters
NewValueEnumType item to be assigned to the paramerer
Returns
Current parameter value cast to EnumType

Definition at line 1097 of file Object.h.

Member Data Documentation

◆ TextValueList

template<typename EnumType >
const Util::TextValueListType<EnumType> DynExp::ParamsBase::Param< EnumType, std::enable_if_t< std::is_enum_v< EnumType > > >::TextValueList
private

Predefined selection options.

Definition at line 1111 of file Object.h.


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