DynExp
Highly flexible laboratory automation for dynamically changing experiments.
Loading...
Searching...
No Matches
DigitalOut.cpp
Go to the documentation of this file.
1// This file is part of DynExp.
2
3#include "stdafx.h"
4#include "DigitalOut.h"
5
6namespace DynExpInstr
7{
12
17
22
26
31
35
39
41 {
42 {
43 auto InstrData = dynamic_InstrumentData_cast<DigitalOut>(GetInstrumentData());
44
45 InstrData->GetSampleStream()->WriteBasicSample({ static_cast<BasicSample::DataType>(Sample), 0 });
46 } // InstrData unlocked here.
47
48 WriteData(CallbackFunc);
49 }
50
52 {
53 AsSyncTask(&DigitalOut::Set, Sample);
54 }
55
57 {
58 {
59 auto InstrParams = DynExp::dynamic_Params_cast<DigitalOut>(GetParams());
60 auto InstrData = dynamic_InstrumentData_cast<DigitalOut>(GetInstrumentData());
61
62 DigitalOutData::SampleStreamType::SampleType DefaultValue = InstrParams->DefaultValue;
63 auto SampleStream = InstrData->GetSampleStream();
64
65 SampleStream->Clear();
66 for (auto i = SampleStream->GetStreamSizeWrite(); i > 0; --i)
67 SampleStream->WriteBasicSample({ static_cast<BasicSample::DataType>(DefaultValue), 0 });
68 } // InstrParams and InstrData unlocked here.
69
70 WriteData();
71 }
72
74 {
75 SetDefault();
76 }
77
82}
Defines a meta instrument for a single digital output port to write a data stream consisting of digit...
SampleT SampleType
Alias for SampleT.
void ResetImpl(dispatch_tag< OutputPortData >) override final
void DisableUserEditable()
Calls DynExp::ParamsBase::DisableUserEditable() on all bundled parameters.
void ExitFuncImpl(dispatch_tag< OutputPortTasks::ExitTask >, DynExp::InstrumentInstance &Instance) override final
Deinitializes the respective instrument within the instrument inheritance hierarchy....
void InitFuncImpl(dispatch_tag< OutputPortTasks::InitTask >, DynExp::InstrumentInstance &Instance) override final
Initializes the respective instrument within the instrument inheritance hierarchy....
Definition DigitalOut.cpp:8
virtual void SetDefault(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Writes DigitalOutParams::DefaultValue to the sample stream. CallbackFunc gets called after the task D...
virtual void OnPrepareExitChild() const override
This function enables derived classes to enqueue tasks to be executed directly before the final exit ...
void ResetImpl(dispatch_tag< OutputPort >) override final
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every de...
virtual void Set(DigitalOutData::SampleStreamType::SampleType Sample, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Writes one sample to the sample stream. CallbackFunc gets called after the task DataStreamInstrument:...
virtual void SetSync(DigitalOutData::SampleStreamType::SampleType Sample) const
Synchronized version of Set(), which blocks until Sample has been written.
Refer to DynExp::ParamsBase::dispatch_tag.
Refer to DynExp::ParamsBase::dispatch_tag.
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
Refer to ParamsBase::dispatch_tag.
Definition Object.h:2018
static void DisableUserEditable(ParamBase &Param) noexcept
Sets the UserEditable property of the parameter Param to false. Refer to ParamBase::UserEditable.
Definition Object.cpp:292
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...
Accumulates include statements to provide a precompiled header.
double DataType
Data type of time and value.