DynExp
Highly flexible laboratory automation for dynamically changing experiments.
InputPort.cpp
Go to the documentation of this file.
1 // This file is part of DynExp.
2 
3 #include "stdafx.h"
4 #include "InputPort.h"
5 
6 namespace DynExpInstr
7 {
9  {
11 
12  // ...after the entire instrument has been initialized.
13  auto Instr = DynExp::dynamic_Object_cast<InputPort>(&Instance.GetOwner());
14 
16  {
17  const auto StreamSize = Instr->GetStreamSizeParams().StreamSize;
18  auto InstrData = DynExp::dynamic_InstrumentData_cast<InputPort>(Instance.InstrumentDataGetter());
19 
20  InstrData->GetSampleStream()->SetStreamSize(StreamSize);
21  } // InstrData unlocked here.
22 
23  auto InstrData = DynExp::dynamic_InstrumentData_cast<InputPort>(Instance.InstrumentDataGetter());
24  InstrData->SetHardwareMinValue(Instr->GetHardwareMinValue());
25  InstrData->SetHardwareMaxValue(Instr->GetHardwareMaxValue());
26  InstrData->SetValueUnit(Instr->GetValueUnit());
27  }
28 
30  {
31  auto Instr = DynExp::dynamic_Object_cast<InputPort>(&Instance.GetOwner());
32  const auto StreamSize = Instr->GetStreamSizeParams().StreamSize;
33  auto InstrData = DynExp::dynamic_InstrumentData_cast<InputPort>(Instance.InstrumentDataGetter());
34 
35  InstrData->GetSampleStream()->SetStreamSize(StreamSize);
36 
37  return {};
38  }
39 
41  {
42  ResetImpl(dispatch_tag<InputPortData>());
43  }
44 
46  {
47  }
48 
50  {
51  }
52 
54  {
55  }
56 
58  {
59  }
60 
62  {
63  ResetImpl(dispatch_tag<InputPort>());
64  }
65 }
Defines a generic input port meta instrument which is used to read data from hardware and to write th...
void ResetImpl(dispatch_tag< DataStreamInstrumentData >) override final
Definition: InputPort.cpp:40
void DisableUserEditable()
Calls DynExp::ParamsBase::DisableUserEditable() on all bundled parameters.
Definition: InputPort.cpp:49
virtual bool ApplyDataStreamSizeFromParams() const noexcept
Determines whether to update the instrument's data stream size according to the instrument parameters...
Definition: InputPort.h:46
void InitFuncImpl(dispatch_tag< DataStreamInstrumentTasks::InitTask >, DynExp::InstrumentInstance &Instance) override final
Initializes the respective instrument within the instrument inheritance hierarchy....
Definition: InputPort.cpp:8
virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
Definition: InputPort.cpp:29
void ResetImpl(dispatch_tag< DataStreamInstrument >) override final
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every de...
Definition: InputPort.cpp:61
virtual ~InputPort()=0
Definition: InputPort.cpp:57
Refer to DynExp::ParamsBase::dispatch_tag.
Definition: Instrument.h:1120
Refer to ParamsBase::dispatch_tag.
Definition: Instrument.h:146
Defines data for a thread belonging to a InstrumentBase instance. Refer to RunnableInstance.
Definition: Instrument.h:772
const InstrumentBase::InstrumentDataGetterType InstrumentDataGetter
Getter for instrument's data. Refer to InstrumentBase::InstrumentDataGetterType.
Definition: Instrument.h:791
Refer to ParamsBase::dispatch_tag.
Definition: Object.h:2018
const auto & GetOwner() const noexcept
Returns Owner.
Definition: Object.h:3524
Defines the return type of task functions.
Definition: Instrument.h:824
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.