DynExp
Highly flexible laboratory automation for dynamically changing experiments.
DynExp::ParamsBase::LinkParamBase Class Reference

Base class for link parameters to a single Object of any type specifying the underlying parameter type. The underlying type is the integral DynExp::ItemIDType type, which stores the ID of the linked object. More...

+ Inheritance diagram for DynExp::ParamsBase::LinkParamBase:

Public Member Functions

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::LinkBase
 LinkBase (std::string_view IconResourcePath={}, bool Optional=false)
 Constructs a LinkBase object. More...
 
void EnsureReadyState ()
 Makes sure that the object where this link parameter points to is in a ready state. Only to be called by main thread. Otherwise, RunnableObject::Run() throws Util::InvalidCallException. More...
 
bool IsReady ()
 Returns whether the object where this link parameter points to is in a ready state. More...
 
std::string_view GetLinkTitle () const noexcept
 Returns a reference to this link parameter's title. More...
 
ItemIDListType GetLinkedIDs () const
 Returns a list of all object IDs assigned to this parameter. More...
 
const CommonResourceManagerBaseGetCommonManager () const noexcept
 This function can be used to determine the object type the parameter is expecting by comparing the resource manager's address to resource managers owned by a DynExpCore instance. More...
 
std::string_view GetIconResourcePath () const noexcept
 
bool IsOptional () const noexcept
 
- 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...
 

Protected Member Functions

 LinkParamBase (ParamsBase &Owner, std::string ParamName, std::string_view ParamTitle, std::string_view ParamDescription, bool NeedsResetToApplyChange=true, std::string_view IconResourcePath={}, bool Optional=false)
 Base constructor of any parameter to be used if a parameter should be displayed in a settings dialog (UserEditable is set to true). More...
 
- Protected Member Functions inherited from DynExp::LinkBase
virtual ~LinkBase ()
 
template<typename ResourceManagerType >
auto ShareResource (const ResourceManagerType &Manager, ItemIDType ID)
 Returns a shared_ptr pointing to the resource with the given ID contained in the given resource manager Manager. The returned pointer points to a non-const instance of class Object. Throws an exception of type Util::NotFoundException if the resource is not found. More...
 
template<typename ObjectType >
auto MakeObjectIDsWithLabels (const ManagerTypeOfObjectType_t< ObjectType > &Manager) const
 Finds all resources managed by the given resource manager matching type ObjectTpye and returns a list of information about these objects. 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...
 

Private Member Functions

virtual std::string_view GetLinkTitleChild () const noexcept override
 Returns a reference to this link parameter's title. More...
 
virtual ItemIDListType GetLinkedIDsChild () const override
 Returns a list of all object IDs assigned to this parameter. 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...
 

Detailed Description

Base class for link parameters to a single Object of any type specifying the underlying parameter type. The underlying type is the integral DynExp::ItemIDType type, which stores the ID of the linked object.

Definition at line 1121 of file Object.h.

Constructor & Destructor Documentation

◆ LinkParamBase()

DynExp::ParamsBase::LinkParamBase::LinkParamBase ( ParamsBase Owner,
std::string  ParamName,
std::string_view  ParamTitle,
std::string_view  ParamDescription,
bool  NeedsResetToApplyChange = true,
std::string_view  IconResourcePath = {},
bool  Optional = false 
)
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.
DefaultValueDefault value to assign to the constructed parameter

Constructs a LinkBase object.

Parameters
IconResourcePathQt resource path describing an icon being displayed along with this parameter in user interface dialogs.
OptionalDetermines whether this parameter is optional. Optional parameters do not have to point to valid object IDs.

No further constructor since LinkParamBase parameters must be editable by the user.

Definition at line 1129 of file Object.h.

Member Function Documentation

◆ GetLinkedIDsChild()

virtual ItemIDListType DynExp::ParamsBase::LinkParamBase::GetLinkedIDsChild ( ) const
inlineoverrideprivatevirtual

Returns a list of all object IDs assigned to this parameter.

Returns
List of assigned object IDs.

Implements DynExp::LinkBase.

Definition at line 1139 of file Object.h.

◆ GetLinkTitleChild()

virtual std::string_view DynExp::ParamsBase::LinkParamBase::GetLinkTitleChild ( ) const
inlineoverrideprivatevirtualnoexcept

Returns a reference to this link parameter's title.

Returns
String view to this link parameter's title.

Implements DynExp::LinkBase.

Definition at line 1138 of file Object.h.

◆ operator=()

const ParamType& DynExp::ParamsBase::TypedParamBase< ParamType >::operator=
inline

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

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

Definition at line 587 of file Object.h.


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