DynExp
Highly flexible laboratory automation for dynamically changing experiments.
DynExpHardware::SIPulseStreamerHardwareAdapter Class Reference
+ Inheritance diagram for DynExpHardware::SIPulseStreamerHardwareAdapter:

Classes

struct  PulseType
 Swabian Instruments Pulse Streamer 8/2's internal representation of a single pulse. More...
 
struct  SampleType
 Sample of one output channel. More...
 

Public Types

using ParamsType = SIPulseStreamerHardwareAdapterParams
 
using ConfigType = SIPulseStreamerHardwareAdapterConfigurator
 
- Public Types inherited from DynExpHardware::gRPCHardwareAdapter< pulse_streamer::PulseStreamer >
using ParamsType = gRPCHardwareAdapterParams< pulse_streamer::PulseStreamer >
 Type of the parameter class belonging to this Object type. Declare this alias in every derived class with the respective parameter class accompanying the derived Object. More...
 
using ConfigType = gRPCHardwareAdapterConfigurator< pulse_streamer::PulseStreamer >
 Type of the configurator class belonging to this Object type. Declare this alias in every derived class with the respective configurator class accompanying the derived Object. More...
 
using gRPCStubType = pulse_streamer::PulseStreamer
 gRPCStub gRPC stub class which is used to transfer data. More...
 
- Public Types inherited from DynExp::HardwareAdapterBase
using ParamsType = HardwareAdapterParamsBase
 Type of the parameter class belonging to this Object type. Declare this alias in every derived class with the respective parameter class accompanying the derived Object. More...
 
using ConfigType = HardwareAdapterConfiguratorBase
 Type of the configurator class belonging to this Object type. Declare this alias in every derived class with the respective configurator class accompanying the derived Object. More...
 
- Public Types inherited from DynExp::Object
using ParamsType = ParamsBase
 Type of the parameter class belonging to this Object type. Declare this alias in every derived class with the respective parameter class accompanying the derived Object. More...
 
using ParamsTypeSyncPtrType = Util::SynchronizedPointer< ParamsType >
 Alias for the return type of Object::GetParams(). Parameters wrapped into Util::SynchronizedPointer can be accessed in a thread-safe way. More...
 
using ParamsConstTypeSyncPtrType = Util::SynchronizedPointer< const ParamsType >
 Alias for the return type of Object::GetParams() const. Parameters wrapped into Util::SynchronizedPointer can be accessed in a thread-safe way. More...
 
using ConfigType = ConfiguratorBase
 Type of the configurator class belonging to this Object type. Declare this alias in every derived class with the respective configurator class accompanying the derived Object. More...
 
using ParamsGetterType = Util::CallableMemberWrapper< Object, decltype(&Object::GetParams)>
 Invoking an instance of this alias is supposed to call Object::GetParams() of the instance the Util::CallableMemberWrapper has been constructed with. More...
 

Public Member Functions

 SIPulseStreamerHardwareAdapter (const std::thread::id OwnerThreadID, DynExp::ParamsBasePtrType &&Params)
 
virtual ~SIPulseStreamerHardwareAdapter ()
 
virtual std::string GetName () const override
 Returns the name of this Object type. More...
 
virtual std::string GetCategory () const override
 Returns the category of this Object type. More...
 
void ResetDevice () const
 
void SetConstantOutput (const PulseType &Pulse={}) const
 
void ForceFinalSample () const
 
void SetSamples (SIPulseStreamerHardwareAdapterParams::OutputChannelType OutputChannel, const std::vector< SampleType > &NewSamples) const
 
void SetNumRuns (int64_t NumRuns=-1) const
 
void SetTrigger (SIPulseStreamerHardwareAdapterParams::TriggerEdgeType TriggerEdge, SIPulseStreamerHardwareAdapterParams::TriggerModeType TriggerMode=SIPulseStreamerHardwareAdapterParams::TriggerModeType::Normal) const
 
void ForceTrigger () const
 
void RearmTrigger () const
 
bool IsStreaming () const
 
bool HasSequence () const
 
bool HasFinished () const
 
- Public Member Functions inherited from DynExpHardware::gRPCHardwareAdapter< pulse_streamer::PulseStreamer >
 gRPCHardwareAdapter (const std::thread::id OwnerThreadID, DynExp::ParamsBasePtrType &&Params)
 
virtual ~gRPCHardwareAdapter ()
 
- Public Member Functions inherited from DynExp::HardwareAdapterBase
 HardwareAdapterBase (const std::thread::id OwnerThreadID, ParamsBasePtrType &&Params)
 Constructs a hardware adapter instance. More...
 
virtual ~HardwareAdapterBase ()=0
 
void ResetException () const
 Sets LastException to nullptr in a thread-safe way. More...
 
bool IsConnected () const noexcept
 Determines the connection status of the hardware interface. More...
 
- Public Member Functions inherited from Util::INonCopyable
 INonCopyable (const INonCopyable &)=delete
 
INonCopyableoperator= (const INonCopyable &)=delete
 
- Public Member Functions inherited from DynExp::Object
ItemIDType GetID () const noexcept
 Returns the ID of this Object instance. Thread-safe since ID is const. More...
 
std::string GetCategoryAndName () const
 Builds a string from an Object's category and name to allow the user to identify an Object's type. More...
 
void EnsureReadyState (bool IsAutomaticStartup)
 Ensures that this Object instance is ready by possibly starting its worker thread or by opening connections to hardware devices. More...
 
void CheckLinkedObjectStates () const
 Checks whether Object instances this instance uses are in a ready state. Override CheckLinkedObjectStatesChild() to implement this behavior. More...
 
void Reset ()
 Resets this Object instance (including all its derived classes) by calling ResetImpl(). A reset implies that the derived classes reload all their parameters from Params and that all LinkedObjectWrapper instances owned by this Object instance become invalidated. More...
 
void BlockIfUnused (const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout)
 Blocks this Object instance setting Object::IsBlocked to true. Refer to Object::IsBlocked for the consequences. More...
 
ParamsConstTypeSyncPtrType GetParams (const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault) const
 Locks the mutex of the parameter class instance Params assigned to this Object instance and returns a pointer to the locked Params. More...
 
ParamsTypeSyncPtrType GetParams (const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault)
 Locks the mutex of the parameter class instance Params assigned to this Object instance and returns a pointer to the locked Params. More...
 
auto GetObjectName (const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault) const
 Returns the name of this Object instance. More...
 
bool IsSharedUsageEnabled (const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault) const
 Returns whether shared usage has been enabled for this Object instance. Refer to ParamsBase::UsageType. More...
 
void SetWarning (std::string Description, int ErrorCode) const
 Setter for Object::Warning. Sets the warning by a description and an error code. More...
 
void SetWarning (const Util::Exception &e) const
 Setter for Object::Warning. Sets the warning by retrieving the warning data from an exception e. More...
 
void ClearWarning () const
 Resets Object::Warning. More...
 
auto GetWarning () const
 Returns Object::Warning in a thread-safe way by copying its internal data. More...
 
std::exception_ptr GetException (const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout) const
 Returns a pointer to the exception which has caused this Object instance to fail. More...
 
bool IsReady () const
 Returns wheter this Object instance is ready (e.g. it is running or connected to a hardware device) and not blocked (refer to Object::IsBlocked). More...
 
auto GetUseCount (const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout) const
 Counts the registered useres in a thread-safe way. More...
 
bool IsUnused (const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout) const
 Returns whether this Object instance is used by other instances. More...
 
auto GetUserIDs (const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout) const
 Returns a list of the IDs of the registered users in a thread-safe way. More...
 
auto GetUserNamesString (const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout) const
 Builds a string describing which users are registered containing their object names, categories and type names in a thread-safe way. More...
 

Static Public Member Functions

constexpr static auto Name () noexcept
 
constexpr static auto Category () noexcept
 
- Static Public Member Functions inherited from DynExpHardware::gRPCHardwareAdapter< pulse_streamer::PulseStreamer >
constexpr static auto Name () noexcept
 Every derived class has to redefine this function. More...
 
constexpr static auto Category () noexcept
 Every derived class has to redefine this function. More...
 
- Static Public Member Functions inherited from DynExp::HardwareAdapterBase
constexpr static auto Category () noexcept
 Every derived class has to redefine this function. More...
 
- Static Public Member Functions inherited from DynExp::Object
static std::string CategoryAndNameToStr (const std::string &Category, const std::string &Name)
 Builds a string from an Object's category and name to allow the user to identify an Object's type. More...
 

Private Types

template<typename MessageType >
using StubFuncPtrType = grpc::Status(pulse_streamer::PulseStreamer::Stub::*)(grpc::ClientContext *, const MessageType &, pulse_streamer::PulseStreamerReply *)
 

Private Member Functions

void ResetImpl (dispatch_tag< gRPCHardwareAdapter >) override final
 
virtual void ResetImpl (dispatch_tag< SIPulseStreamerHardwareAdapter >)
 
template<typename MessageType >
uint32_t InvokeStubFunc (StubFuncPtrType< MessageType > Func, const MessageType &Message) const
 
uint32_t InvokeStubFunc (StubFuncPtrType< pulse_streamer::VoidMessage > Func) const
 
std::vector< PulseTypeComposePulseSequence () const
 
virtual void OpenUnsafeChild () override
 Override to add additional initialization steps. Gets executed after the gRPC connection has been established. More...
 
void ResetDeviceUnsafe () const
 
void SetConstantOutputUnsafe (const PulseType &Pulse={}) const
 
void ForceFinalSampleUnsafe () const
 
void SetSamplesUnsafe (SIPulseStreamerHardwareAdapterParams::OutputChannelType OutputChannel, const std::vector< SampleType > &NewSamples) const
 
void SetNumRunsUnsafe (int64_t NumRuns=-1) const
 
void SetTriggerUnsafe (SIPulseStreamerHardwareAdapterParams::TriggerEdgeType TriggerEdge, SIPulseStreamerHardwareAdapterParams::TriggerModeType TriggerMode=SIPulseStreamerHardwareAdapterParams::TriggerModeType::Normal) const
 
void ForceTriggerUnsafe () const
 
void RearmTriggerUnsafe () const
 
bool IsStreamingUnsafe () const
 
bool HasSequenceUnsafe () const
 
bool HasFinishedUnsafe () const
 

Private Attributes

std::vector< SampleTypeSamples
 Combined sample vector of all channels. Assumed to be always sorted. More...
 
int64_t NumRuns
 How often to repeat the sample sequence. -1 means indefinitely. More...
 

Additional Inherited Members

- Public Attributes inherited from DynExp::Object
LinkedObjectWrapperOnlyType LinkedObjectWrapperOnly
 Allow exclusive access to some of Object's private methods to any LinkedObjectWrapper<T>. More...
 
- Static Public Attributes inherited from DynExp::HardwareAdapterBase
static constexpr auto ShortTimeoutDefault = std::chrono::milliseconds(10)
 Default timeout e.g. used as a default for calls to Object::GetException(). More...
 
static constexpr auto HardwareOperationTimeout = std::chrono::milliseconds(100)
 Default timeout used to lock the mutex provided by the base class Util::ILockable to synchronize access to the hardware interface in between multiple instrument threads. More...
 
- Static Public Attributes inherited from Util::ILockable
static constexpr std::chrono::milliseconds DefaultTimeout = std::chrono::milliseconds(10)
 Duration which is used as a default timeout within all methods of this class if no different duration is passed to them. More...
 
- Static Public Attributes inherited from DynExp::Object
static constexpr std::chrono::milliseconds GetParamsTimeoutDefault = std::chrono::milliseconds(100)
 Default timeout used by Object::GetParams() to lock the mutex of the parameter instance assigned to this Object instance. More...
 
- Protected Types inherited from Util::ILockable
using MutexType = std::timed_mutex
 
using LockType = std::unique_lock< MutexType >
 
- Protected Member Functions inherited from DynExpHardware::gRPCHardwareAdapter< pulse_streamer::PulseStreamer >
gRPCStub::Stub & GetStubUnsafe () const
 Getter for the gRPC stub. More...
 
void CheckError (const grpc::Status Result, const std::source_location Location=std::source_location::current()) const
 Checks whether Result denotes an error state. If this is the case, a respective gRPCException is constructed from Result and thrown. More...
 
bool IsOpenedUnsafe () const noexcept
 Checks whether the gRPCHardwareAdapter is connected to a server. More...
 
- Protected Member Functions inherited from DynExp::HardwareAdapterBase
void ThrowException (std::exception_ptr Exception) const
 Stores Exception in LastException, wraps it in a Util::ForwardedException and throws the wrapped excetion by calling Util::ForwardException(). More...
 
void ThrowExceptionUnsafe (std::exception_ptr Exception) const
 Stores Exception in LastException, wraps it in a Util::ForwardedException and throws the wrapped excetion by calling Util::ForwardException(). More...
 
void SetExceptionUnsafe (std::exception_ptr Exception) const
 Stores Exception in LastException. More...
 
auto GetExceptionUnsafe () const
 Getter for LastException. More...
 
- Protected Member Functions inherited from Util::ILockable
 ILockable ()=default
 
 ~ILockable ()=default
 
LockType AcquireLock (const std::chrono::milliseconds Timeout=DefaultTimeout) const
 Locks the internal mutex. Blocks until the mutex is locked or until the timeout duration is exceeded. More...
 
- Protected Member Functions inherited from Util::INonCopyable
constexpr INonCopyable ()=default
 
 ~INonCopyable ()=default
 
- Protected Member Functions inherited from DynExp::Object
 Object (const std::thread::id OwnerThreadID, ParamsBasePtrType &&Params)
 Constructs an Object instance. More...
 
virtual ~Object ()=0
 
void EnsureCallFromOwningThread () const
 Asserts that the call to this function is performed from the thread which constructed this Object instance (the thread with the id stored in Object::OwnerThreadID). More...
 
ParamsTypeSyncPtrType GetNonConstParams (const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault) const
 Allows derived Objects to edit their own parameters - even in const task functions (for instruments) or event functions (for modules). More...
 
auto LockUserList (const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout)
 Locks the user list for thread-safe manipulation. More...
 
void DeregisterAllUnsafe ()
 Deregisters all users and notifies them that they need to check the states of their used linked objects. More...
 
auto GetUseCountUnsafe ()
 
auto GetUserNamesStringUnsafe () const
 
bool IsUnusedUnsafe ()
 Returns whether this Object instance is used by other instances (not thread-safe). More...
 

Detailed Description

Member Typedef Documentation

◆ ConfigType

◆ ParamsType

◆ StubFuncPtrType

template<typename MessageType >
using DynExpHardware::SIPulseStreamerHardwareAdapter::StubFuncPtrType = grpc::Status(pulse_streamer::PulseStreamer::Stub::*)(grpc::ClientContext*, const MessageType&, pulse_streamer::PulseStreamerReply*)
private

Constructor & Destructor Documentation

◆ SIPulseStreamerHardwareAdapter()

DynExpHardware::SIPulseStreamerHardwareAdapter::SIPulseStreamerHardwareAdapter ( const std::thread::id  OwnerThreadID,
DynExp::ParamsBasePtrType &&  Params 
)

◆ ~SIPulseStreamerHardwareAdapter()

DynExpHardware::SIPulseStreamerHardwareAdapter::~SIPulseStreamerHardwareAdapter ( )
virtual

Member Function Documentation

◆ Category()

constexpr static auto DynExpHardware::SIPulseStreamerHardwareAdapter::Category ( )
inlinestaticconstexprnoexcept

◆ ComposePulseSequence()

std::vector< SIPulseStreamerHardwareAdapter::PulseType > DynExpHardware::SIPulseStreamerHardwareAdapter::ComposePulseSequence ( ) const
private

◆ ForceFinalSample()

void DynExpHardware::SIPulseStreamerHardwareAdapter::ForceFinalSample ( ) const

◆ ForceFinalSampleUnsafe()

void DynExpHardware::SIPulseStreamerHardwareAdapter::ForceFinalSampleUnsafe ( ) const
private

◆ ForceTrigger()

void DynExpHardware::SIPulseStreamerHardwareAdapter::ForceTrigger ( ) const

◆ ForceTriggerUnsafe()

void DynExpHardware::SIPulseStreamerHardwareAdapter::ForceTriggerUnsafe ( ) const
private

◆ GetCategory()

virtual std::string DynExpHardware::SIPulseStreamerHardwareAdapter::GetCategory ( ) const
inlineoverridevirtual

Returns the category of this Object type.

Reimplemented from DynExpHardware::gRPCHardwareAdapter< pulse_streamer::PulseStreamer >.

Definition at line 106 of file HardwareAdapterSwabianInstrumentsPulseStreamer.h.

◆ GetName()

virtual std::string DynExpHardware::SIPulseStreamerHardwareAdapter::GetName ( ) const
inlineoverridevirtual

Returns the name of this Object type.

Reimplemented from DynExpHardware::gRPCHardwareAdapter< pulse_streamer::PulseStreamer >.

Definition at line 105 of file HardwareAdapterSwabianInstrumentsPulseStreamer.h.

◆ HasFinished()

bool DynExpHardware::SIPulseStreamerHardwareAdapter::HasFinished ( ) const

◆ HasFinishedUnsafe()

bool DynExpHardware::SIPulseStreamerHardwareAdapter::HasFinishedUnsafe ( ) const
private

◆ HasSequence()

bool DynExpHardware::SIPulseStreamerHardwareAdapter::HasSequence ( ) const

◆ HasSequenceUnsafe()

bool DynExpHardware::SIPulseStreamerHardwareAdapter::HasSequenceUnsafe ( ) const
private

◆ InvokeStubFunc() [1/2]

template<typename MessageType >
uint32_t DynExpHardware::SIPulseStreamerHardwareAdapter::InvokeStubFunc ( StubFuncPtrType< MessageType >  Func,
const MessageType &  Message 
) const
private

◆ InvokeStubFunc() [2/2]

uint32_t DynExpHardware::SIPulseStreamerHardwareAdapter::InvokeStubFunc ( StubFuncPtrType< pulse_streamer::VoidMessage >  Func) const
inlineprivate

◆ IsStreaming()

bool DynExpHardware::SIPulseStreamerHardwareAdapter::IsStreaming ( ) const

◆ IsStreamingUnsafe()

bool DynExpHardware::SIPulseStreamerHardwareAdapter::IsStreamingUnsafe ( ) const
private

◆ Name()

constexpr static auto DynExpHardware::SIPulseStreamerHardwareAdapter::Name ( )
inlinestaticconstexprnoexcept

◆ OpenUnsafeChild()

void DynExpHardware::SIPulseStreamerHardwareAdapter::OpenUnsafeChild ( )
overrideprivatevirtual

Override to add additional initialization steps. Gets executed after the gRPC connection has been established.

Reimplemented from DynExpHardware::gRPCHardwareAdapter< pulse_streamer::PulseStreamer >.

Definition at line 231 of file HardwareAdapterSwabianInstrumentsPulseStreamer.cpp.

◆ RearmTrigger()

void DynExpHardware::SIPulseStreamerHardwareAdapter::RearmTrigger ( ) const

◆ RearmTriggerUnsafe()

void DynExpHardware::SIPulseStreamerHardwareAdapter::RearmTriggerUnsafe ( ) const
private

◆ ResetDevice()

void DynExpHardware::SIPulseStreamerHardwareAdapter::ResetDevice ( ) const

◆ ResetDeviceUnsafe()

void DynExpHardware::SIPulseStreamerHardwareAdapter::ResetDeviceUnsafe ( ) const
private

◆ ResetImpl() [1/2]

void DynExpHardware::SIPulseStreamerHardwareAdapter::ResetImpl ( dispatch_tag< gRPCHardwareAdapter )
finaloverrideprivatevirtual

◆ ResetImpl() [2/2]

virtual void DynExpHardware::SIPulseStreamerHardwareAdapter::ResetImpl ( dispatch_tag< SIPulseStreamerHardwareAdapter )
inlineprivatevirtual

◆ SetConstantOutput()

void DynExpHardware::SIPulseStreamerHardwareAdapter::SetConstantOutput ( const PulseType Pulse = {}) const

◆ SetConstantOutputUnsafe()

void DynExpHardware::SIPulseStreamerHardwareAdapter::SetConstantOutputUnsafe ( const PulseType Pulse = {}) const
private

◆ SetNumRuns()

void DynExpHardware::SIPulseStreamerHardwareAdapter::SetNumRuns ( int64_t  NumRuns = -1) const

◆ SetNumRunsUnsafe()

void DynExpHardware::SIPulseStreamerHardwareAdapter::SetNumRunsUnsafe ( int64_t  NumRuns = -1) const
private

◆ SetSamples()

void DynExpHardware::SIPulseStreamerHardwareAdapter::SetSamples ( SIPulseStreamerHardwareAdapterParams::OutputChannelType  OutputChannel,
const std::vector< SampleType > &  NewSamples 
) const

◆ SetSamplesUnsafe()

void DynExpHardware::SIPulseStreamerHardwareAdapter::SetSamplesUnsafe ( SIPulseStreamerHardwareAdapterParams::OutputChannelType  OutputChannel,
const std::vector< SampleType > &  NewSamples 
) const
private

◆ SetTrigger()

void DynExpHardware::SIPulseStreamerHardwareAdapter::SetTrigger ( SIPulseStreamerHardwareAdapterParams::TriggerEdgeType  TriggerEdge,
SIPulseStreamerHardwareAdapterParams::TriggerModeType  TriggerMode = SIPulseStreamerHardwareAdapterParams::TriggerModeType::Normal 
) const

◆ SetTriggerUnsafe()

void DynExpHardware::SIPulseStreamerHardwareAdapter::SetTriggerUnsafe ( SIPulseStreamerHardwareAdapterParams::TriggerEdgeType  TriggerEdge,
SIPulseStreamerHardwareAdapterParams::TriggerModeType  TriggerMode = SIPulseStreamerHardwareAdapterParams::TriggerModeType::Normal 
) const
private

Member Data Documentation

◆ NumRuns

int64_t DynExpHardware::SIPulseStreamerHardwareAdapter::NumRuns
mutableprivate

How often to repeat the sample sequence. -1 means indefinitely.

Definition at line 153 of file HardwareAdapterSwabianInstrumentsPulseStreamer.h.

◆ Samples

std::vector<SampleType> DynExpHardware::SIPulseStreamerHardwareAdapter::Samples
mutableprivate

Combined sample vector of all channels. Assumed to be always sorted.

Definition at line 152 of file HardwareAdapterSwabianInstrumentsPulseStreamer.h.


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