|
DynExp
Highly flexible laboratory automation for dynamically changing experiments.
|
Defines data for a thread belonging to a ModuleBase instance. Refer to RunnableInstance.
More...
#include <Module.h>
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. | |
| ModuleInstance (ModuleInstance &&Other) | |
Move-constructs a RunnableInstance instance. Other becomes empty. Not noexcept since LinkedObjectWrapperBase::ListType (std::list) move constructor might throw. | |
| ~ModuleInstance ()=default | |
| void | Exit () noexcept |
Might be called from anywhere where this ModuleInstance instance is accessible to make the associated module terminate. | |
| bool | IsExiting () const noexcept |
| Getter for ShouldExit. | |
Public Member Functions inherited from DynExp::RunnableInstance | |
| ~RunnableInstance () | |
| const auto & | GetOwner () const noexcept |
| Returns Owner. | |
| void | BlockUntilReadyToStart () const noexcept |
Blocks until ThreadMayStart is set to true. Thread functions to be run by RunnableObject instances are required to call this function before they access the parameters passed to them (except to call this function). | |
| 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. | |
| 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. | |
| 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)! | |
| 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. | |
| template<typename ObjectT > | |
| void | UnlockObject (LinkedObjectWrapperContainerList< ObjectT > &ObjectWrapperContainerList) |
Unlocks Object instances stored in the LinkedObjectWrapperContainerList ObjectWrapperContainerList. | |
| 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. | |
| 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. | |
Public Member Functions inherited from Util::INonCopyable | |
| INonCopyable (const INonCopyable &)=delete | |
| INonCopyable & | operator= (const INonCopyable &)=delete |
Public Attributes | |
| const ModuleBase::ModuleDataGetterType | ModuleDataGetter |
| Getter for module's data. Refer to ModuleBase::ModuleDataGetterType. | |
Public Attributes inherited from DynExp::RunnableInstance | |
| const Object::ParamsGetterType | ParamsGetter |
Invoke to obtain the parameters (derived from ParamsBase) of Owner. | |
| RunnableObjectOnlyType | RunnableObjectOnly |
Allow exclusive access to some of RunnableInstance's private variables to RunnableObject. | |
Private Attributes | |
| bool | ShouldExit = false |
Indicates whether the module thread using this ModuleInstance instance should terminate. | |
Additional Inherited Members | |
Protected Member Functions inherited from DynExp::RunnableInstance | |
| RunnableInstance (RunnableObject &Owner, std::promise< void > &&ThreadExitedPromise) | |
Constructs a non-empty RunnableInstance instance. | |
| RunnableInstance (RunnableInstance &&Other) | |
Move-constructs a RunnableInstance instance. Other becomes empty. Not noexcept since LinkedObjectWrapperBase::ListType (std::list) move constructor might throw. | |
Protected Member Functions inherited from Util::INonCopyable | |
| constexpr | INonCopyable ()=default |
| ~INonCopyable ()=default | |
Defines data for a thread belonging to a ModuleBase instance. Refer to RunnableInstance.
| DynExp::ModuleInstance::ModuleInstance | ( | ModuleBase & | Owner, |
| std::promise< void > && | ThreadExitedPromise, | ||
| const ModuleBase::ModuleDataGetterType | ModuleDataGetter | ||
| ) |
Constructs a non-empty RunnableInstance instance.
| Owner | Refer to Owner. |
| ThreadExitedPromise | Refer to ThreadExitedPromise. |
| ModuleDataGetter | Getter for module's data. Refer to ModuleBase::ModuleDataGetterType. |
Definition at line 416 of file Module.cpp.
| DynExp::ModuleInstance::ModuleInstance | ( | ModuleInstance && | Other | ) |
Move-constructs a RunnableInstance instance. Other becomes empty. Not noexcept since LinkedObjectWrapperBase::ListType (std::list) move constructor might throw.
| Other | RunnableInstance instance to move from |
Definition at line 423 of file Module.cpp.
|
default |
|
inlinenoexcept |
Might be called from anywhere where this ModuleInstance instance is accessible to make the associated module terminate.
|
inlinenoexcept |
Getter for ShouldExit.
ModuleInstance should terminate, false otherwise. | const ModuleBase::ModuleDataGetterType DynExp::ModuleInstance::ModuleDataGetter |
Getter for module's data. Refer to ModuleBase::ModuleDataGetterType.
|
private |
Indicates whether the module thread using this ModuleInstance instance should terminate.