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

Data class for DataStreamInstrument. More...

+ Inheritance diagram for DynExpInstr::DataStreamInstrumentData:

Public Types

enum class  UnitType {
  Arbitrary , LogicLevel , Counts , Volt ,
  Ampere , Power_W , Power_dBm
}
 Units which can be used for data stream instruments. More...
 
using ValueType = double
 Data type to represent hardware limits on the sample values to write to the hardware adapter assigned to the related DataStreamInstrument instance. More...
 
- Public Types inherited from DynExp::InstrumentDataBase
using TaskQueueType = std::list< std::unique_ptr< TaskBase > >
 Type of an instrument task queue owning the tasks within. More...
 
using TaskQueueIteratorType = TaskQueueType::const_iterator
 Const iterator type to elements of TaskQueueType. More...
 

Public Member Functions

 DataStreamInstrumentData (DataStreamBasePtrType &&SampleStream)
 Constructs a DataStreamInstrumentData instance. More...
 
virtual ~DataStreamInstrumentData ()=default
 
DataStreamBasePtrType::element_type * GetSampleStream () const noexcept
 Getter for the data stream instrument's sample stream. Logical const-ness: always returns a non-const type to allow modules to directly manipulate the sample stream. More...
 
template<typename T >
auto GetCastSampleStream () const
 Casts the data stream instrument's sample stream to a derived data stream type. More...
 
ValueType GetHardwareMinValue () const noexcept
 Returns HardwareMinValue. More...
 
ValueType GetHardwareMaxValue () const noexcept
 Returns HardwareMaxValue. More...
 
UnitType GetValueUnit () const noexcept
 Returns ValueUnit. More...
 
void SetHardwareMinValue (ValueType Value) noexcept
 Sets HardwareMinValue. More...
 
void SetHardwareMaxValue (ValueType Value) noexcept
 Sets HardwareMaxValue. More...
 
void SetValueUnit (UnitType Unit) noexcept
 Sets ValueUnit. More...
 
- Public Member Functions inherited from DynExp::InstrumentDataBase
 InstrumentDataBase ()
 
virtual ~InstrumentDataBase ()
 
auto GetLastUpdateTime () const
 Getter for LastUpdate. More...
 
auto GetException () const noexcept
 Getter for InstrumentDataBase::InstrumentException. More...
 
void EnqueueTask (std::unique_ptr< TaskBase > &&Task)
 Enqueues a task at the back of an instrument's task queue and notifies the instrument about the new task. More...
 
void EnqueuePriorityTask (std::unique_ptr< TaskBase > &&Task)
 Enqueues a task at the front of an instrument's task queue and notifies the instrument about the new task. More...
 
std::unique_ptr< TaskBasePopTaskFront ()
 Removes a task from the front of an instrument's task queue. More...
 
std::unique_ptr< TaskBasePopTaskBack ()
 Removes a task from the back of an instrument's task queue. More...
 
auto GetTaskFront () noexcept
 Getter for first enqueued task. More...
 
auto GetTaskBack () noexcept
 Getter for last enqueued task. More...
 
size_t GetNumEnqueuedTasks () const noexcept
 Getter for the instrument task queue's length. More...
 
std::unique_ptr< TaskBasePopFinishedTask ()
 Removes a task from the front of an instrument's list of finished tasks. More...
 
size_t GetNumFinishedTasks () const noexcept
 Getter for the length of the instrument's list of finished tasks. More...
 
bool IsQueueClosed () const noexcept
 Determines whether the instrument task queue is closed. More...
 
- Public Member Functions inherited from Util::INonCopyable
 INonCopyable (const INonCopyable &)=delete
 
INonCopyableoperator= (const INonCopyable &)=delete
 

Static Public Member Functions

static const char * UnitTypeToStr (const UnitType &Unit)
 Returns a descriptive string of a respective unit to be e.g. used in plots. More...
 

Private Member Functions

void ResetImpl (dispatch_tag< InstrumentDataBase >) override final
 
virtual void ResetImpl (dispatch_tag< DataStreamInstrumentData >)
 

Private Attributes

const DataStreamBasePtrType SampleStream
 Refer to DynExp::InstrumentDataBase::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every derived class gets called - starting from InstrumentDataBase, descending the inheritance hierarchy. Override in order to reset derived classes. More...
 
Hardware-specific

These values denote hardware limits/settings and should be obtained from the hardware adapter assigned to the related DataStreamInstrument instance.

ValueType HardwareMinValue
 Minimal possible value to read/write from/to the hardware adapter. More...
 
ValueType HardwareMaxValue
 Maximal possible value to read/write from/to the hardware adapter. More...
 
UnitType ValueUnit
 Unit type of the values to be read/written from/to the hardware adapter. More...
 

Additional Inherited Members

- Public Attributes inherited from DynExp::InstrumentDataBase
InstrumentBaseOnlyType InstrumentBaseOnly
 Allow exclusive access to some of InstrumentDataBase's private methods to InstrumentBase. More...
 
InstrumenThreadOnlyType InstrumentThreadOnly
 Allow exclusive access to some of InstrumentDataBase's private methods to the instrument thread InstrumentThreadMain(). More...
 
- Protected Member Functions inherited from Util::ISynchronizedPointerLockable
 ISynchronizedPointerLockable ()
 
 ~ISynchronizedPointerLockable ()
 Object should never be destroyed before completely unlocked. More...
 
- Protected Member Functions inherited from Util::INonCopyable
constexpr INonCopyable ()=default
 
 ~INonCopyable ()=default
 

Detailed Description

Data class for DataStreamInstrument.

Definition at line 793 of file DataStreamInstrument.h.

Member Typedef Documentation

◆ ValueType

Data type to represent hardware limits on the sample values to write to the hardware adapter assigned to the related DataStreamInstrument instance.

Definition at line 800 of file DataStreamInstrument.h.

Member Enumeration Documentation

◆ UnitType

Units which can be used for data stream instruments.

Warning
If this is changed, also change ConvertUnitType() functions in NetworkDataStreamInstrument.h and the UnitType enumeration in Common.proto.
Enumerator
Arbitrary 

Arbitrary units (a.u.)

LogicLevel 

Logic level (TTL) units (1 or 0)

Counts 

Count rate in counts per second (cps)

Volt 

Voltage in Volt (V)

Ampere 

Electric current in Ampere (A)

Power_W 

Power in Watt (W)

Power_dBm 

Power in dBm.

Definition at line 807 of file DataStreamInstrument.h.

Constructor & Destructor Documentation

◆ DataStreamInstrumentData()

DynExpInstr::DataStreamInstrumentData::DataStreamInstrumentData ( DataStreamBasePtrType &&  SampleStream)

Constructs a DataStreamInstrumentData instance.

Parameters
SampleStreamData stream the related DataStreamInstrument instance operates on. The DataStreamInstrumentData instance takes ownership of the stream.
Exceptions
Util::InvalidArgExceptionis thrown if SampleStream is nullptr.

Definition at line 101 of file DataStreamInstrument.cpp.

◆ ~DataStreamInstrumentData()

virtual DynExpInstr::DataStreamInstrumentData::~DataStreamInstrumentData ( )
virtualdefault

Member Function Documentation

◆ GetCastSampleStream()

template<typename T >
auto DynExpInstr::DataStreamInstrumentData::GetCastSampleStream ( ) const
inline

Casts the data stream instrument's sample stream to a derived data stream type.

Template Parameters
TType derived from DataStreamBase to cast to
Returns
Returns SampleStream cast to using dynamic_cast.
Exceptions
Util::TypeErrorExceptionis thrown if the cast fails.

Definition at line 849 of file DataStreamInstrument.h.

◆ GetHardwareMaxValue()

ValueType DynExpInstr::DataStreamInstrumentData::GetHardwareMaxValue ( ) const
inlinenoexcept

Returns HardwareMaxValue.

Definition at line 859 of file DataStreamInstrument.h.

◆ GetHardwareMinValue()

ValueType DynExpInstr::DataStreamInstrumentData::GetHardwareMinValue ( ) const
inlinenoexcept

Returns HardwareMinValue.

Definition at line 858 of file DataStreamInstrument.h.

◆ GetSampleStream()

DataStreamBasePtrType::element_type* DynExpInstr::DataStreamInstrumentData::GetSampleStream ( ) const
inlinenoexcept

Getter for the data stream instrument's sample stream. Logical const-ness: always returns a non-const type to allow modules to directly manipulate the sample stream.

Returns
Returns SampleStream.

Definition at line 840 of file DataStreamInstrument.h.

◆ GetValueUnit()

UnitType DynExpInstr::DataStreamInstrumentData::GetValueUnit ( ) const
inlinenoexcept

Returns ValueUnit.

Definition at line 860 of file DataStreamInstrument.h.

◆ ResetImpl() [1/2]

virtual void DynExpInstr::DataStreamInstrumentData::ResetImpl ( dispatch_tag< DataStreamInstrumentData )
inlineprivatevirtual

◆ ResetImpl() [2/2]

void DynExpInstr::DataStreamInstrumentData::ResetImpl ( dispatch_tag< InstrumentDataBase )
finaloverrideprivate

Definition at line 108 of file DataStreamInstrument.cpp.

◆ SetHardwareMaxValue()

void DynExpInstr::DataStreamInstrumentData::SetHardwareMaxValue ( ValueType  Value)
inlinenoexcept

Sets HardwareMaxValue.

Definition at line 862 of file DataStreamInstrument.h.

◆ SetHardwareMinValue()

void DynExpInstr::DataStreamInstrumentData::SetHardwareMinValue ( ValueType  Value)
inlinenoexcept

Sets HardwareMinValue.

Definition at line 861 of file DataStreamInstrument.h.

◆ SetValueUnit()

void DynExpInstr::DataStreamInstrumentData::SetValueUnit ( UnitType  Unit)
inlinenoexcept

Sets ValueUnit.

Definition at line 863 of file DataStreamInstrument.h.

◆ UnitTypeToStr()

const char * DynExpInstr::DataStreamInstrumentData::UnitTypeToStr ( const UnitType Unit)
static

Returns a descriptive string of a respective unit to be e.g. used in plots.

Parameters
UnitUnit type as used by data stream instruments.
Returns
Returns the human-readable unit string.

Definition at line 86 of file DataStreamInstrument.cpp.

Member Data Documentation

◆ HardwareMaxValue

ValueType DynExpInstr::DataStreamInstrumentData::HardwareMaxValue
private

Maximal possible value to read/write from/to the hardware adapter.

Definition at line 877 of file DataStreamInstrument.h.

◆ HardwareMinValue

ValueType DynExpInstr::DataStreamInstrumentData::HardwareMinValue
private

Minimal possible value to read/write from/to the hardware adapter.

Definition at line 876 of file DataStreamInstrument.h.

◆ SampleStream

const DataStreamBasePtrType DynExpInstr::DataStreamInstrumentData::SampleStream
private

Refer to DynExp::InstrumentDataBase::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every derived class gets called - starting from InstrumentDataBase, descending the inheritance hierarchy. Override in order to reset derived classes.

Pointer to the base class of the data stream instrument's sample stream

Definition at line 869 of file DataStreamInstrument.h.

◆ ValueUnit

UnitType DynExpInstr::DataStreamInstrumentData::ValueUnit
private

Unit type of the values to be read/written from/to the hardware adapter.

Definition at line 878 of file DataStreamInstrument.h.


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