DynExp
Highly flexible laboratory automation for dynamically changing experiments.
AnalogIn.cpp
Go to the documentation of this file.
1 // This file is part of DynExp.
2 
3 #include "stdafx.h"
4 #include "AnalogIn.h"
5 
6 namespace DynExpInstr
7 {
9  {
11  }
12 
14  {
15  }
16 
18  {
19  }
20 
22  {
23  }
24 
26  {
27  }
28 
30  {
31  ReadData(CallbackFunc);
32 
33  auto InstrData = dynamic_InstrumentData_cast<AnalogIn>(GetInstrumentData());
34  auto Sample = InstrData->GetSampleStream()->ReadBasicSample().Value;
35 
36  return Sample;
37  }
38 
40  {
42 
43  auto InstrData = dynamic_InstrumentData_cast<AnalogIn>(GetInstrumentData());
44  auto Sample = InstrData->GetSampleStream()->ReadBasicSample().Value;
45 
46  return Sample;
47  }
48 
50  {
52  }
53 }
Defines a meta instrument for a single analog input port to read a data stream consisting of analog v...
void ResetImpl(dispatch_tag< InputPortData >) override final
Definition: AnalogIn.cpp:8
void DisableUserEditable()
Calls DynExp::ParamsBase::DisableUserEditable() on all bundled parameters.
Definition: AnalogIn.cpp:17
virtual AnalogInData::SampleStreamType::SampleType Get(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Reads one sample from the sample stream. CallbackFunc gets called after the task DataStreamInstrument...
Definition: AnalogIn.cpp:29
virtual ~AnalogIn()=0
Definition: AnalogIn.cpp:25
virtual AnalogInData::SampleStreamType::SampleType GetSync() const
Synchronized version of Get(), which blocks until a DataStreamInstrument::ReadData() task getting enq...
Definition: AnalogIn.cpp:39
void ResetImpl(dispatch_tag< InputPort >) override final
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every de...
Definition: AnalogIn.cpp:49
SampleT SampleType
Alias for SampleT.
virtual void ReadData(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Enqueues a task to read data from the hardware to the data stream. The default implementation does no...
InstrumentDataTypeSyncPtrType GetInstrumentData(const std::chrono::milliseconds Timeout=GetInstrumentDataTimeoutDefault)
Locks the mutex of the instrument data class instance InstrumentData assigned to this InstrumentBase ...
Definition: Instrument.cpp:222
ExceptionContainer AsSyncTask(void(DerivedInstrT::*TaskFunc)(TaskFuncArgTs...) const, ArgTs &&...Args) const
Calls a (derived) instrument's function which inserts a task into the instrument's task queue synchro...
Definition: Instrument.h:649
Refer to ParamsBase::dispatch_tag.
Definition: Instrument.h:146
Refer to ParamsBase::dispatch_tag.
Definition: Object.h:2018
std::function< void(const TaskBase &, ExceptionContainer &)> CallbackType
Type of a callback function which is invoked when a task has finished, failed or has been aborted....
Definition: Instrument.h:939
DynExp's instrument namespace contains the implementation of DynExp instruments which extend DynExp's...
Definition: Instrument.h:1254
Accumulates include statements to provide a precompiled header.