DynExp
Highly flexible laboratory automation for dynamically changing experiments.
Instrument.h File Reference

Implementation of DynExp instrument objects. More...

Go to the source code of this file.

Classes

class  DynExp::ExceptionContainer
 Wrapper holding a pointer to an exception and providing functionality for accessing it. Used to transfer exceptions between an instrument's task and the ModuleBase module enqueuing the task. Refer to TaskBase::CallbackType. More...
 
class  DynExp::InstrumentDataBase
 Data structure to contain data which is synchronized in between different threads. This is needed since the instrument thread, the threads of different modules, as well as the main thread might access the instrument at the same time. Every class (indirectly) derived from class InstrumentBase must be accompanied by a instrument data class derived from InstrumentDataBase. InstrumentDataBase and derived classes contain data shared by the respective instrument, module and main threads. Data only used by the instrument itself should be private members of the instrument class. More...
 
struct  DynExp::InstrumentDataBase::dispatch_tag< typename >
 Refer to ParamsBase::dispatch_tag. More...
 
class  DynExp::InstrumentDataBase::InstrumentBaseOnlyType
 Allow exclusive access to some of InstrumentDataBase's private methods to InstrumentBase. More...
 
class  DynExp::InstrumentDataBase::InstrumenThreadOnlyType
 Allow exclusive access to some of InstrumentDataBase's private methods to the instrument thread InstrumentThreadMain(). More...
 
class  DynExp::InstrumentParamsBase
 Parameter class for InstrumentBase. More...
 
class  DynExp::InstrumentConfiguratorBase
 Configurator class for InstrumentBase. More...
 
class  DynExp::InstrumentBase
 Base class for instruments. Instruments comprise virtual devices (meta instruments) and physial devices (instruments). While meta instruments are used by modules (ModuleBase) as an abstraction layer, physical instruments derive from meta instruments and make usually use of one hardware adapter (HardwareAdapterBase) to communicate with the underlying hardware. More...
 
class  DynExp::InstrumentBase::InstrumenThreadOnlyType
 Allow exclusive access to some of InstrumentBase's private methods to the instrument thread InstrumentThreadMain(). More...
 
class  DynExp::InstrumentInstance
 Defines data for a thread belonging to a InstrumentBase instance. Refer to RunnableInstance. More...
 
class  DynExp::TaskResultType
 Defines the return type of task functions. More...
 
class  DynExp::TaskBase
 Base class for all tasks being processed by instruments. The class must not contain public virtual functions since TaskBase::CallbackFunc could call them in TaskBase's destructor. More...
 
class  DynExp::TaskBase::InstrumentBaseOnlyType
 Allow exclusive access to some of TaskBase's private methods to InstrumentBase. More...
 
class  DynExp::TaskBase::InstrumentDataBaseOnlyType
 Allow exclusive access to some of TaskBase's private methods to InstrumentDataBase. More...
 
class  DynExp::DefaultTask
 Default task which does not do anything. Though, calling it ensures that TaskBase::CallbackFunc gets called. This is required to avoid InstrumentBase::AsSyncTask() getting stuck in an infinite loop. All functions overridden from meta instruments, which are expected to enqueue a task, must at least enqueue a DefaultTask (by calling MakeAndEnqueueTask< DynExp::DefaultTask >(CallbackFunc);) More...
 
class  DynExp::InitTaskBase
 Defines a task for initializing an instrument within an instrument inheritance hierarchy. Each instrument (indirectly) derived from class InstrumentBase must be accompanied by an initialization task class derived from InitTaskBase. Even if the task does not do anything, at least it has to call InitTaskBase::InitFuncImpl() of the derived instrument's initialization task class. More...
 
struct  DynExp::InitTaskBase::dispatch_tag< typename >
 Refer to DynExp::ParamsBase::dispatch_tag. More...
 
class  DynExp::ExitTaskBase
 Defines a task for deinitializing an instrument within an instrument inheritance hierarchy. Each instrument (indirectly) derived from class InstrumentBase must be accompanied by a deinitialization task class derived from ExitTaskBase. Even if the task does not do anything, at least it has to call ExitTaskBase::ExitFuncImpl() of the derived instrument's deinitialization task class. More...
 
struct  DynExp::ExitTaskBase::dispatch_tag< typename >
 Refer to DynExp::ParamsBase::dispatch_tag. More...
 
class  DynExp::UpdateTaskBase
 Defines a task for updating an instrument within an instrument inheritance hierarchy. Each instrument (indirectly) derived from class InstrumentBase must be accompanied by an update task class derived from UpdateTaskBase. Even if the task does not do anything, at least it has to call UpdateTaskBase::UpdateFuncImpl() of the derived instrument's update task class. More...
 
struct  DynExp::UpdateTaskBase::dispatch_tag< typename >
 Refer to DynExp::ParamsBase::dispatch_tag. More...
 
class  DynExp::ArriveAtLatchTask
 Defines a task which arrives at a std::latch when it is executed. This is useful to synchronize multiple instruments and make their execution block until a set of instruments has arrived at the latch. Refer to InstrumentBase::EnqueueArriveAtLatchTask() and to WaitForInstruments(). More...
 

Namespaces

 DynExp
 DynExp's main namespace contains the implementation of DynExp including classes to manage resources (DynExp objects like hardware adapters, instruments, and modules) as well as their dependencies and parameters.
 
 DynExpInstr
 DynExp's instrument namespace contains the implementation of DynExp instruments which extend DynExp's core functionality in a modular way.
 

Typedefs

using DynExp::InstrumentPtrType = std::shared_ptr< InstrumentBase >
 Pointer type to store an instrument (DynExp::InstrumentBase) with. More...
 

Functions

template<typename InstrumentT >
ConfiguratorBasePtrType DynExp::MakeInstrumentConfig ()
 Factory function to generate a configurator for a specific instrument type. More...
 
template<typename InstrumentT >
InstrumentPtrType DynExp::MakeInstrument (const std::thread::id OwnerThreadID, ParamsBasePtrType &&Params)
 Factory function to generate an instrument of a specific type. More...
 
template<typename TaskT , typename... ArgTs>
std::unique_ptr< TaskT > DynExp::MakeTask (ArgTs &&...Args)
 Factory function to create a task to be enqueued in an instrument's task queue. More...
 
int DynExp::InstrumentThreadMain (InstrumentInstance Instance, InstrumentBase *const Instrument)
 Instruments run in their own thread. This is the instrument thread's main function. More...
 
template<typename To , typename From , std::enable_if_t< std::is_same_v< InstrumentDataBase, std::remove_cv_t< From >>, int > = 0>
auto DynExp::dynamic_InstrumentData_cast (Util::SynchronizedPointer< From > &&InstrumentDataPtr)
 Casts the data base class From into a derived InstrumentBase's (To) data class keeping the data locked by Util::SynchronizedPointer for thread-safe casting. More...
 
template<typename... InstrTs>
void DynExp::WaitForInstruments (InstrTs &... Instruments)
 Blocks until every instrument passed to the function as a reference parameter has arrived at a synchronization point. More...
 

Detailed Description

Implementation of DynExp instrument objects.

Definition in file Instrument.h.


Class Documentation

◆ DynExp::InstrumentDataBase::dispatch_tag

struct DynExp::InstrumentDataBase::dispatch_tag

template<typename>
struct DynExp::InstrumentDataBase::dispatch_tag< typename >

Refer to ParamsBase::dispatch_tag.

Template Parameters
Type(derived from class InstrumentDataBase) to instantiate the dispatch tag template with.

Definition at line 146 of file Instrument.h.

◆ DynExp::InitTaskBase::dispatch_tag

struct DynExp::InitTaskBase::dispatch_tag

template<typename>
struct DynExp::InitTaskBase::dispatch_tag< typename >

Refer to DynExp::ParamsBase::dispatch_tag.

Template Parameters
Type(derived from DynExp::InitTaskBase) to instantiate the dispatch tag template with.

Definition at line 1120 of file Instrument.h.

◆ DynExp::ExitTaskBase::dispatch_tag

struct DynExp::ExitTaskBase::dispatch_tag

template<typename>
struct DynExp::ExitTaskBase::dispatch_tag< typename >

Refer to DynExp::ParamsBase::dispatch_tag.

Template Parameters
Type(derived from DynExp::ExitTaskBase) to instantiate the dispatch tag template with.

Definition at line 1151 of file Instrument.h.

◆ DynExp::UpdateTaskBase::dispatch_tag

struct DynExp::UpdateTaskBase::dispatch_tag

template<typename>
struct DynExp::UpdateTaskBase::dispatch_tag< typename >

Refer to DynExp::ParamsBase::dispatch_tag.

Template Parameters
Type(derived from DynExp::UpdateTaskBase) to instantiate the dispatch tag template with.

Definition at line 1182 of file Instrument.h.