DynExp
Highly flexible laboratory automation for dynamically changing experiments.
DynExp::ParamsBase::ParamBase Class Referenceabstract

Abstract base class for a single object parameter. Parameters derived from this class are automatically stored in the DynExp project file. Additionally, derived parameters might be configured in settings dialogs dynamically generated for objects according to the parameters belonging to it. More...

+ Inheritance diagram for DynExp::ParamsBase::ParamBase:

Classes

class  ParamsBaseOnlyType
 Provides the class ParamsBase access to some private members of class ParamBase. More...
 

Public Member Functions

 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...
 
Thread-safe getter functions

Thread-safe since const member variables are returned.

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...
 

Public Attributes

ParamsBaseOnlyType ParamsBaseOnly
 Provides the class ParamsBase access to some private members of class ParamBase. More...
 

Protected Member Functions

 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

void DisableUserEditable () noexcept
 Sets the UserEditable property to false. More...
 
void AddToDialog (ParamsConfigDialog &Dialog)
 Appends this parameter to a settings dialog making it configurable by the user. More...
 
Override

Override by derived class to make public versions of these functions behave as described above.

virtual void ToXMLNodeChild (QDomDocument &Document, QDomElement &XMLElement) const =0
 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)=0
 Restores this parameter's value from the given Qt dom element (describing an XML node) More...
 
virtual void AddToDialogChild (ParamsConfigDialog &Dialog)=0
 Appends this parameter to a settings dialog making it configurable by the user. More...
 
virtual bool ValidateChild () const
 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 void ResetChild ()=0
 Resets this parameter to its default value. More...
 

Private Attributes

ParamsBaseOwner
 Owner of this parameter. Owner always lives longer than this object. More...
 
bool UserEditable
 Is this parameter displayed in a settings dialog und thus editable by the user directly? Not const since derived objects might want to hide a parameter declared by a base class. More...
 
const std::string ParamName
 Identifier which is stored in project file. More...
 
const std::string_view ParamTitle
 String which is displayed as a label when editing the parameter using ParamsConfigDialog. More...
 
const std::string_view ParamDescription
 String which describes the parameter as a tooltip when using ParamsConfigDialog. More...
 
const bool NeedsResetToApplyChange
 Indicates whether the object owning this parameter needs to be reset to apply changes to this parameter. More...
 

Detailed Description

Abstract base class for a single object parameter. Parameters derived from this class are automatically stored in the DynExp project file. Additionally, derived parameters might be configured in settings dialogs dynamically generated for objects according to the parameters belonging to it.

Definition at line 377 of file Object.h.

Constructor & Destructor Documentation

◆ ParamBase() [1/3]

DynExp::ParamsBase::ParamBase::ParamBase ( ParamsBase Owner,
std::string  ParamName,
std::string_view  ParamTitle,
std::string_view  ParamDescription,
bool  NeedsResetToApplyChange 
)
protected

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.

Definition at line 113 of file Object.cpp.

◆ ParamBase() [2/3]

DynExp::ParamsBase::ParamBase::ParamBase ( ParamsBase Owner,
std::string  ParamName 
)
protected

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.

Definition at line 125 of file Object.cpp.

◆ ~ParamBase()

DynExp::ParamsBase::ParamBase::~ParamBase ( )
protectedpure virtual

Definition at line 133 of file Object.cpp.

◆ ParamBase() [3/3]

DynExp::ParamsBase::ParamBase::ParamBase ( const ParamBase )
delete

Member Function Documentation

◆ AddToDialog()

void DynExp::ParamsBase::ParamBase::AddToDialog ( ParamsConfigDialog Dialog)
inlineprivate

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

Parameters
DialogReference to the settings dialog to append the parameter to

Definition at line 476 of file Object.h.

◆ AddToDialogChild()

virtual void DynExp::ParamsBase::ParamBase::AddToDialogChild ( ParamsConfigDialog Dialog)
privatepure virtual

◆ DisableUserEditable()

void DynExp::ParamsBase::ParamBase::DisableUserEditable ( )
inlineprivatenoexcept

Sets the UserEditable property to false.

Definition at line 470 of file Object.h.

◆ FromXMLNode()

void DynExp::ParamsBase::ParamBase::FromXMLNode ( const QDomElement &  XMLElement)

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

Parameters
XMLElementQt dom element containing information about this parameter.

Definition at line 145 of file Object.cpp.

◆ FromXMLNodeChild()

virtual void DynExp::ParamsBase::ParamBase::FromXMLNodeChild ( const QDomElement &  XMLElement)
privatepure virtual

◆ GetNeedsResetToApplyChange()

bool DynExp::ParamsBase::ParamBase::GetNeedsResetToApplyChange ( ) const
inlinenoexcept

Returns ParamBase::NeedsResetToApplyChange.

Definition at line 431 of file Object.h.

◆ GetOwner() [1/2]

const auto& DynExp::ParamsBase::ParamBase::GetOwner ( ) const
inlineprotectednoexcept

Returns the ParamsBase instance owning this ParamBase instance.

Definition at line 463 of file Object.h.

◆ GetOwner() [2/2]

auto& DynExp::ParamsBase::ParamBase::GetOwner ( )
inlineprotectednoexcept

Returns the ParamsBase instance owning this ParamBase instance.

Definition at line 464 of file Object.h.

◆ GetParamDescription()

std::string_view DynExp::ParamsBase::ParamBase::GetParamDescription ( ) const
inlinenoexcept

Returns ParamBase::ParamDescription.

Definition at line 430 of file Object.h.

◆ GetParamName()

std::string_view DynExp::ParamsBase::ParamBase::GetParamName ( ) const
inlinenoexcept

Returns ParamBase::ParamName.

Definition at line 428 of file Object.h.

◆ GetParamTitle()

std::string_view DynExp::ParamsBase::ParamBase::GetParamTitle ( ) const
inlinenoexcept

Returns ParamBase::ParamTitle.

Definition at line 429 of file Object.h.

◆ IsUserEditable()

bool DynExp::ParamsBase::ParamBase::IsUserEditable ( ) const
inlinenoexcept

Returns ParamBase::UserEditable.

Definition at line 427 of file Object.h.

◆ operator=()

ParamBase& DynExp::ParamsBase::ParamBase::operator= ( const ParamBase )
delete

◆ Reset()

void DynExp::ParamsBase::ParamBase::Reset ( )
inline

Resets this parameter to its default value.

Definition at line 458 of file Object.h.

◆ ResetChild()

virtual void DynExp::ParamsBase::ParamBase::ResetChild ( )
privatepure virtual

◆ ToXMLNode()

QDomElement DynExp::ParamsBase::ParamBase::ToXMLNode ( QDomDocument &  Document) const

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.
Returns
Qt dom element containing information about this parameter's name and value.

Definition at line 137 of file Object.cpp.

◆ ToXMLNodeChild()

virtual void DynExp::ParamsBase::ParamBase::ToXMLNodeChild ( QDomDocument &  Document,
QDomElement &  XMLElement 
) const
privatepure virtual

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.

Implemented in DynExp::ParamsBase::TypedListParamBase< ParamType >, DynExp::ParamsBase::TypedParamBase< ParamType >, and DynExp::ParamsBase::DummyParam.

◆ Validate()

bool DynExp::ParamsBase::ParamBase::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.

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

Definition at line 164 of file Object.cpp.

◆ ValidateChild()

virtual bool DynExp::ParamsBase::ParamBase::ValidateChild ( ) const
inlineprivatevirtual

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 in DynExp::ParamsBase::TypedListParamBase< ParamType >, and DynExp::ParamsBase::TypedParamBase< ParamType >.

Definition at line 491 of file Object.h.

Member Data Documentation

◆ NeedsResetToApplyChange

const bool DynExp::ParamsBase::ParamBase::NeedsResetToApplyChange
private

Indicates whether the object owning this parameter needs to be reset to apply changes to this parameter.

Definition at line 513 of file Object.h.

◆ Owner

ParamsBase& DynExp::ParamsBase::ParamBase::Owner
private

Owner of this parameter. Owner always lives longer than this object.

Definition at line 498 of file Object.h.

◆ ParamDescription

const std::string_view DynExp::ParamsBase::ParamBase::ParamDescription
private

String which describes the parameter as a tooltip when using ParamsConfigDialog.

Definition at line 508 of file Object.h.

◆ ParamName

const std::string DynExp::ParamsBase::ParamBase::ParamName
private

Identifier which is stored in project file.

Definition at line 506 of file Object.h.

◆ ParamsBaseOnly

ParamsBaseOnlyType DynExp::ParamsBase::ParamBase::ParamsBaseOnly

Provides the class ParamsBase access to some private members of class ParamBase.

Definition at line 460 of file Object.h.

◆ ParamTitle

const std::string_view DynExp::ParamsBase::ParamBase::ParamTitle
private

String which is displayed as a label when editing the parameter using ParamsConfigDialog.

Definition at line 507 of file Object.h.

◆ UserEditable

bool DynExp::ParamsBase::ParamBase::UserEditable
private

Is this parameter displayed in a settings dialog und thus editable by the user directly? Not const since derived objects might want to hide a parameter declared by a base class.

Definition at line 504 of file Object.h.


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