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

Abstract base class of link parameters (to be saved in project files) describing relations between multiple Object (e.g. a module making use of an instrument). More...

+ Inheritance diagram for DynExp::LinkBase:

Public Member Functions

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

Thread-safe since const member variables are returned.

std::string_view GetIconResourcePath () const noexcept
 
bool IsOptional () const noexcept
 

Protected Member Functions

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

Private Member Functions

Override

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

virtual void EnsureReadyStateChild ()=0
 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...
 
virtual bool IsReadyChild ()=0
 Returns whether the object where this link parameter points to is in a ready state. More...
 
virtual std::string_view GetLinkTitleChild () const noexcept=0
 Returns a reference to this link parameter's title. More...
 
virtual ItemIDListType GetLinkedIDsChild () const =0
 Returns a list of all object IDs assigned to this parameter. More...
 
virtual const CommonResourceManagerBaseGetCommonManagerChild () const noexcept=0
 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...
 

Private Attributes

const std::string_view IconResourcePath
 Qt resource path describing an icon being displayed along with this parameter in user interface dialogs. More...
 
const bool Optional
 Determines whether this parameter is optional. Optional parameters do not have to point to valid object IDs. More...
 

Detailed Description

Abstract base class of link parameters (to be saved in project files) describing relations between multiple Object (e.g. a module making use of an instrument).

Definition at line 183 of file Object.h.

Constructor & Destructor Documentation

◆ LinkBase()

DynExp::LinkBase::LinkBase ( std::string_view  IconResourcePath = {},
bool  Optional = false 
)
inline

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.

Definition at line 193 of file Object.h.

◆ ~LinkBase()

virtual DynExp::LinkBase::~LinkBase ( )
inlineprotectedvirtual

Definition at line 197 of file Object.h.

Member Function Documentation

◆ EnsureReadyState()

void DynExp::LinkBase::EnsureReadyState ( )
inline

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.

Definition at line 264 of file Object.h.

◆ EnsureReadyStateChild()

virtual void DynExp::LinkBase::EnsureReadyStateChild ( )
privatepure virtual

◆ GetCommonManager()

const CommonResourceManagerBase* DynExp::LinkBase::GetCommonManager ( ) const
inlinenoexcept

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.

Returns
Returns the address of the resource manager managing resources to be possibly linked to this parameter.

Definition at line 289 of file Object.h.

◆ GetCommonManagerChild()

virtual const CommonResourceManagerBase* DynExp::LinkBase::GetCommonManagerChild ( ) const
privatepure virtualnoexcept

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.

Returns
Returns the address of the resource manager managing resources to be possibly linked to this parameter.

Implemented in DynExp::ParamsBase::ListParam< LinkType, std::enable_if_t< std::is_base_of_v< ObjectLinkBase, LinkType > > >, and DynExp::ParamsBase::Param< LinkType, std::enable_if_t< std::is_base_of_v< ObjectLinkBase, LinkType > > >.

◆ GetIconResourcePath()

std::string_view DynExp::LinkBase::GetIconResourcePath ( ) const
inlinenoexcept

Definition at line 256 of file Object.h.

◆ GetLinkedIDs()

ItemIDListType DynExp::LinkBase::GetLinkedIDs ( ) const
inline

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

Returns
List of assigned object IDs.

Definition at line 282 of file Object.h.

◆ GetLinkedIDsChild()

virtual ItemIDListType DynExp::LinkBase::GetLinkedIDsChild ( ) const
privatepure virtual

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

Returns
List of assigned object IDs.

Implemented in DynExp::ParamsBase::LinkListParamBase, and DynExp::ParamsBase::LinkParamBase.

◆ GetLinkTitle()

std::string_view DynExp::LinkBase::GetLinkTitle ( ) const
inlinenoexcept

Returns a reference to this link parameter's title.

Returns
String view to this link parameter's title.

Definition at line 276 of file Object.h.

◆ GetLinkTitleChild()

virtual std::string_view DynExp::LinkBase::GetLinkTitleChild ( ) const
privatepure virtualnoexcept

Returns a reference to this link parameter's title.

Returns
String view to this link parameter's title.

Implemented in DynExp::ParamsBase::LinkListParamBase, and DynExp::ParamsBase::LinkParamBase.

◆ IsOptional()

bool DynExp::LinkBase::IsOptional ( ) const
inlinenoexcept

Definition at line 257 of file Object.h.

◆ IsReady()

bool DynExp::LinkBase::IsReady ( )
inline

Returns whether the object where this link parameter points to is in a ready state.

Returns
Returns true if it is in a ready state, false otherwise.

Definition at line 270 of file Object.h.

◆ IsReadyChild()

virtual bool DynExp::LinkBase::IsReadyChild ( )
privatepure virtual

Returns whether the object where this link parameter points to is in a ready state.

Returns
Returns true if it is in a ready state, false otherwise.

Implemented in DynExp::ParamsBase::ListParam< LinkType, std::enable_if_t< std::is_base_of_v< ObjectLinkBase, LinkType > > >, and DynExp::ParamsBase::Param< LinkType, std::enable_if_t< std::is_base_of_v< ObjectLinkBase, LinkType > > >.

◆ MakeObjectIDsWithLabels()

template<typename ObjectType >
auto DynExp::LinkBase::MakeObjectIDsWithLabels ( const ManagerTypeOfObjectType_t< ObjectType > &  Manager) const
inlineprotected

Finds all resources managed by the given resource manager matching type ObjectTpye and returns a list of information about these objects.

Template Parameters
ObjectTypeType of objects assignable to this link.
Parameters
ManagerResource manager to find resources in.
Returns
Util::TextValueListType containing object IDs and their description (object names, categories and type names) of objects assignable to this link.
Exceptions
Util::EmptyExceptionis thrown if Manager does not contain any resource matching type ObjectTpye and if LinkBase::Optional is false.

Definition at line 222 of file Object.h.

◆ ShareResource()

template<typename ResourceManagerType >
auto DynExp::LinkBase::ShareResource ( const ResourceManagerType &  Manager,
ItemIDType  ID 
)
inlineprotected

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.

Template Parameters
ResourceManagerTypeType ot the resource manager containing the resource specified by ID.
Parameters
ManagerResource manager containing the resource specified by ID.
IDID of the resource to share.
Returns
shared_ptr pointing to the non-const resource.

Definition at line 209 of file Object.h.

Member Data Documentation

◆ IconResourcePath

const std::string_view DynExp::LinkBase::IconResourcePath
private

Qt resource path describing an icon being displayed along with this parameter in user interface dialogs.

Definition at line 307 of file Object.h.

◆ Optional

const bool DynExp::LinkBase::Optional
private

Determines whether this parameter is optional. Optional parameters do not have to point to valid object IDs.

Definition at line 312 of file Object.h.


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