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

Defines data for a thread belonging to a ModuleBase instance. Refer to RunnableInstance. More...

+ Inheritance diagram for DynExp::ModuleInstance:

Public Member Functions

 ModuleInstance (ModuleBase &Owner, std::promise< void > &&ThreadExitedPromise, const ModuleBase::ModuleDataGetterType ModuleDataGetter)
 Constructs a non-empty RunnableInstance instance. More...
 
 ModuleInstance (ModuleInstance &&Other)
 Move-constructs a RunnableInstance instance. Other becomes empty. Not noexcept since LinkedObjectWrapperBase::ListType (std::list) move constructor might throw. More...
 
 ~ModuleInstance ()=default
 
void Exit () noexcept
 Might be called from anywhere where this ModuleInstance instance is accessible to make the associated module terminate. More...
 
bool IsExiting () const noexcept
 Getter for ShouldExit. More...
 
- Public Member Functions inherited from DynExp::RunnableInstance
const auto & GetOwner () const noexcept
 Returns Owner. More...
 
template<typename ObjectT >
void TryLockObject (const ParamsBase::Param< ObjectLink< ObjectT >> &LinkParam, LinkedObjectWrapperContainer< ObjectT > &ObjectWrapperContainer, std::chrono::milliseconds Timeout=ObjectLinkBase::LockObjectTimeoutDefault)
 Locks an Object instance referenced by a parameter LinkParam of type ParamsBase::Param< ObjectLink< ObjectT > > and makes the LinkedObjectWrapperContainer ObjectWrapperContainer point to the locked resource. More...
 
template<typename ObjectT >
void LockObject (const ParamsBase::Param< ObjectLink< ObjectT >> &LinkParam, LinkedObjectWrapperContainer< ObjectT > &ObjectWrapperContainer, std::chrono::milliseconds Timeout=ObjectLinkBase::LockObjectTimeoutDefault)
 Locks an Object instance referenced by a parameter LinkParam of type ParamsBase::Param< ObjectLink< ObjectT > > and makes the LinkedObjectWrapperContainer ObjectWrapperContainer point to the locked resource. More...
 
template<typename ObjectT >
void UnlockObject (LinkedObjectWrapperContainer< ObjectT > &ObjectWrapperContainer)
 Unlocks an Object instance stored in the LinkedObjectWrapperContainer ObjectWrapperContainer. The LinkedObjectWrapperPointer contained in ObjectWrapperContainer is invalidated (set to nullptr)! More...
 
template<typename ObjectT >
void LockObject (const ParamsBase::ListParam< ObjectLink< ObjectT >> &LinkListParam, LinkedObjectWrapperContainerList< ObjectT > &ObjectWrapperContainerList, std::chrono::milliseconds Timeout=ObjectLinkBase::LockObjectTimeoutDefault)
 Locks Object instances referenced by a list parameter LinkListParam of type ParamsBase::ListParam< ObjectLink< ObjectT > > and creates containers in LinkedObjectWrapperContainerList ObjectWrapperContainerList which point to the locked resources. More...
 
template<typename ObjectT >
void UnlockObject (LinkedObjectWrapperContainerList< ObjectT > &ObjectWrapperContainerList)
 Unlocks Object instances stored in the LinkedObjectWrapperContainerList ObjectWrapperContainerList. More...
 
bool CareAboutWrappers ()
 Unregisters owned LinkedObjectWrapper instances from their destiny resources in case of the respective destiny resource not being in a ready state (e.g. a stopped/error state). Registers again after the respective destiny resource has returned to a ready state. More...
 
std::string GetNotReadyObjectNamesString () const
 Finds all linked Object instances Owner makes use of which are not in a ready state and builds a string identifying all these Object instances. More...
 
- Public Member Functions inherited from Util::INonCopyable
 INonCopyable (const INonCopyable &)=delete
 
INonCopyableoperator= (const INonCopyable &)=delete
 

Public Attributes

const ModuleBase::ModuleDataGetterType ModuleDataGetter
 Getter for module's data. Refer to ModuleBase::ModuleDataGetterType. More...
 
- Public Attributes inherited from DynExp::RunnableInstance
const Object::ParamsGetterType ParamsGetter
 Invoke to obtain the parameters (derived from ParamsBase) of Owner. More...
 

Private Attributes

bool ShouldExit = false
 Indicates whether the module thread using this ModuleInstance instance should terminate. More...
 

Additional Inherited Members

- Protected Member Functions inherited from DynExp::RunnableInstance
 RunnableInstance (RunnableObject &Owner, std::promise< void > &&ThreadExitedPromise)
 Constructs a non-empty RunnableInstance instance. More...
 
 RunnableInstance (RunnableInstance &&Other)
 Move-constructs a RunnableInstance instance. Other becomes empty. Not noexcept since LinkedObjectWrapperBase::ListType (std::list) move constructor might throw. More...
 
 ~RunnableInstance ()
 
- Protected Member Functions inherited from Util::INonCopyable
constexpr INonCopyable ()=default
 
 ~INonCopyable ()=default
 

Detailed Description

Defines data for a thread belonging to a ModuleBase instance. Refer to RunnableInstance.

Definition at line 792 of file Module.h.

Constructor & Destructor Documentation

◆ ModuleInstance() [1/2]

DynExp::ModuleInstance::ModuleInstance ( ModuleBase Owner,
std::promise< void > &&  ThreadExitedPromise,
const ModuleBase::ModuleDataGetterType  ModuleDataGetter 
)

Constructs a non-empty RunnableInstance instance.

Parameters
OwnerRefer to Owner.
ThreadExitedPromiseRefer to ThreadExitedPromise.
ModuleDataGetterGetter for module's data. Refer to ModuleBase::ModuleDataGetterType.

Definition at line 389 of file Module.cpp.

◆ ModuleInstance() [2/2]

DynExp::ModuleInstance::ModuleInstance ( ModuleInstance &&  Other)

Move-constructs a RunnableInstance instance. Other becomes empty. Not noexcept since LinkedObjectWrapperBase::ListType (std::list) move constructor might throw.

Parameters
OtherRunnableInstance instance to move from

Definition at line 396 of file Module.cpp.

◆ ~ModuleInstance()

DynExp::ModuleInstance::~ModuleInstance ( )
default

Member Function Documentation

◆ Exit()

void DynExp::ModuleInstance::Exit ( )
inlinenoexcept

Might be called from anywhere where this ModuleInstance instance is accessible to make the associated module terminate.

Definition at line 813 of file Module.h.

◆ IsExiting()

bool DynExp::ModuleInstance::IsExiting ( ) const
inlinenoexcept

Getter for ShouldExit.

Returns
Returns true if the module associated with this ModuleInstance should terminate, false otherwise.

Definition at line 820 of file Module.h.

Member Data Documentation

◆ ModuleDataGetter

const ModuleBase::ModuleDataGetterType DynExp::ModuleInstance::ModuleDataGetter

Getter for module's data. Refer to ModuleBase::ModuleDataGetterType.

Definition at line 825 of file Module.h.

◆ ShouldExit

bool DynExp::ModuleInstance::ShouldExit = false
private

Indicates whether the module thread using this ModuleInstance instance should terminate.

Definition at line 832 of file Module.h.


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