DynExp
Highly flexible laboratory automation for dynamically changing experiments.
Loading...
Searching...
No Matches
OutputPort.h
Go to the documentation of this file.
1// This file is part of DynExp.
2
9#pragma once
10
11#include "stdafx.h"
12#include "FunctionGenerator.h"
13
14namespace DynExpInstr
15{
16 class OutputPort;
17
93
98 {
99 public:
104
105 virtual ~OutputPortData() = default;
106
107 private:
110 };
111
116 {
117 public:
124
125 virtual ~OutputPortParams() = 0;
126
127 virtual const char* GetParamClassTag() const noexcept override { return "OutputPortParams"; }
128
129 protected:
130 void DisableUserEditable();
131
132 private:
135
136 DummyParam Dummy = { *this };
137 };
138
151
158 {
159 public:
163
172
173 constexpr static auto Name() noexcept { return "Output Port"; }
174 constexpr static auto Category() noexcept { return "I/O"; }
175
181
182 virtual ~OutputPort() = 0;
183
184 virtual std::string GetName() const override { return Name(); }
185 virtual std::string GetCategory() const override { return Category(); }
186
192
199
207
215
222
230
239
246 virtual void ResetStreamSize(DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const override { MakeAndEnqueueTask<OutputPortTasks::ResetBufferSizeTask>(CallbackFunc); }
248
249 private:
250 void ResetImpl(dispatch_tag<FunctionGenerator>) override final;
252
253 virtual std::unique_ptr<DynExp::InitTaskBase> MakeInitTask() const override { return DynExp::MakeTask<OutputPortTasks::InitTask>(); }
254 virtual std::unique_ptr<DynExp::ExitTaskBase> MakeExitTask() const override { return DynExp::MakeTask<OutputPortTasks::ExitTask>(); }
255 virtual std::unique_ptr<DynExp::UpdateTaskBase> MakeUpdateTask() const override { return DynExp::MakeTask<OutputPortTasks::UpdateTask>(); }
256 };
257}
Implementation of a function generator meta instrument to generate waveforms.
double ValueType
Data type to represent hardware limits on the sample values to write to the hardware adapter assigned...
const DataStreamBasePtrType SampleStream
Refer to DynExp::InstrumentDataBase::Reset(). Using tag dispatch mechanism to ensure that ResetImpl()...
Configurator class for FunctionGenerator.
Data class for FunctionGenerator.
Parameter class for FunctionGenerator.
Defines a task for deinitializing an instrument within an instrument inheritance hierarchy....
Defines a task for initializing an instrument within an instrument inheritance hierarchy....
Defines a task for updating an instrument within an instrument inheritance hierarchy....
Function generator meta instrument based on the data stream meta instrument to generate waveforms by ...
Configurator class for OutputPort.
Definition OutputPort.h:143
Data class for OutputPort.
Definition OutputPort.h:98
OutputPortData(DataStreamBasePtrType &&SampleStream)
Constructs a DataStreamInstrumentData instance.
Definition OutputPort.h:103
void ResetImpl(dispatch_tag< FunctionGeneratorData >) override final
virtual ~OutputPortData()=default
virtual void ResetImpl(dispatch_tag< OutputPortData >)
Definition OutputPort.h:109
Parameter class for OutputPort.
Definition OutputPort.h:116
OutputPortParams(DynExp::ItemIDType ID, const DynExp::DynExpCore &Core)
Constructs the parameters for a OutputPort instance.
Definition OutputPort.h:122
virtual void ConfigureParamsImpl(dispatch_tag< OutputPortParams >)
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to...
Definition OutputPort.h:134
virtual const char * GetParamClassTag() const noexcept override
This function is intended to be overridden once in each derived class returning the name of the respe...
Definition OutputPort.h:127
void DisableUserEditable()
Calls DynExp::ParamsBase::DisableUserEditable() on all bundled parameters.
DummyParam Dummy
Dummy parameter which is to be owned once by parameter classes that do not contain any other paramete...
Definition OutputPort.h:136
void ConfigureParamsImpl(dispatch_tag< FunctionGeneratorParams >) override final
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to...
Definition OutputPort.h:133
Defines a task for deinitializing an instrument within an instrument inheritance hierarchy....
Definition OutputPort.h:54
void ExitFuncImpl(dispatch_tag< FunctionGeneratorTasks::ExitTask >, DynExp::InstrumentInstance &Instance) override final
Deinitializes the respective instrument within the instrument inheritance hierarchy....
Definition OutputPort.h:55
virtual void ExitFuncImpl(dispatch_tag< ExitTask >, DynExp::InstrumentInstance &Instance)
Deinitializes the respective instrument within the instrument inheritance hierarchy....
Definition OutputPort.h:60
Defines a task for initializing an instrument within an instrument inheritance hierarchy....
Definition OutputPort.h:27
void InitFuncImpl(dispatch_tag< FunctionGeneratorTasks::InitTask >, DynExp::InstrumentInstance &Instance) override final
Initializes the respective instrument within the instrument inheritance hierarchy....
Definition OutputPort.cpp:8
virtual void InitFuncImpl(dispatch_tag< InitTask >, DynExp::InstrumentInstance &Instance)
Initializes the respective instrument within the instrument inheritance hierarchy....
Definition OutputPort.h:33
virtual bool ApplyDataStreamSizeFromParams() const noexcept
Determines whether to update the instrument's data stream size according to the instrument parameters...
Definition OutputPort.h:46
Task to reset the size of the related data stream instrument's stream to the result of OutputPort::Ge...
Definition OutputPort.h:81
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...
ResetBufferSizeTask(CallbackType CallbackFunc) noexcept
Constructs a ResetBufferSizeTask instance.
Definition OutputPort.h:87
Defines a task for updating an instrument within an instrument inheritance hierarchy....
Definition OutputPort.h:67
virtual void UpdateFuncImpl(dispatch_tag< UpdateTask >, DynExp::InstrumentInstance &Instance)
Updates the respective instrument within the instrument inheritance hierarchy. Call UpdateFuncImpl() ...
Definition OutputPort.h:73
void UpdateFuncImpl(dispatch_tag< FunctionGeneratorTasks::UpdateTask >, DynExp::InstrumentInstance &Instance) override final
Updates the respective instrument within the instrument inheritance hierarchy. Call UpdateFuncImpl() ...
Definition OutputPort.h:68
Generic output port meta instrument based on the data stream and function generator meta instruments ...
Definition OutputPort.h:158
virtual DataStreamInstrumentData::ValueType GetHardwareMaxValue() const =0
Indicates the maximal value the underlying hardware can generate. Also refer to GetUserMaxValue().
virtual std::unique_ptr< DynExp::InitTaskBase > MakeInitTask() const override
Factory function for an init task (InitTaskBase). Override to define the desired initialization task ...
Definition OutputPort.h:253
static constexpr auto Name() noexcept
Every derived class has to redefine this function.
Definition OutputPort.h:173
virtual void ResetImpl(dispatch_tag< OutputPort >)=0
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every de...
virtual DataStreamInstrumentData::ValueType GetUserMinValue() const =0
Indicates the minimal allowed value to generate as defined by the user/software. This value should be...
virtual std::unique_ptr< DynExp::UpdateTaskBase > MakeUpdateTask() const override
Factory function for an update task (UpdateTaskBase). Override to define the desired update task in d...
Definition OutputPort.h:255
static constexpr auto Category() noexcept
Every derived class has to redefine this function.
Definition OutputPort.h:174
virtual DataStreamInstrumentData::ValueType GetUserMaxValue() const =0
Indicates the maximal allowed value to generate as defined by the user/software. This value should be...
virtual StreamSizeParamsExtension::ValueType GetStreamSizeParams() const
Retrieves the size of the instrument's data stream from the instrument parameters....
Definition OutputPort.h:198
virtual std::string GetName() const override
Returns the name of this Object type.
Definition OutputPort.h:184
virtual std::unique_ptr< DynExp::ExitTaskBase > MakeExitTask() const override
Factory function for an exit task (ExitTaskBase). Override to define the desired deinitialization tas...
Definition OutputPort.h:254
virtual DataStreamInstrumentData::ValueType GetHardwareMinValue() const =0
Indicates the minimal value the underlying hardware can generate. Also refer to GetUserMinValue().
virtual DataStreamInstrumentData::ValueType GetHardwareResolution() const =0
Indicates the value's resolution the underlying hardware can generate.
virtual std::string GetCategory() const override
Returns the category of this Object type.
Definition OutputPort.h:185
OutputPort(const std::thread::id OwnerThreadID, DynExp::ParamsBasePtrType &&Params)
Constructs an instrument instance.
Definition OutputPort.h:179
virtual void ResetStreamSize(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const override
Enqueues a task to reset the size of the instrument's sample stream to its default value.
Definition OutputPort.h:246
void ResetImpl(dispatch_tag< FunctionGenerator >) override final
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every de...
Type containing the values of all the parameters belonging to StreamSizeParamsExtension.
DynExp's core class acts as the interface between the user interface and DynExp's internal data like ...
Definition DynExpCore.h:127
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
const std::thread::id OwnerThreadID
Thread id of the thread which has constructed (and owns) this Object instance.
Definition Object.h:2302
const ParamsBasePtrType Params
Pointer to the parameter class instance belonging to this Object instance.
Definition Object.h:2303
Refer to ParamsBase::dispatch_tag.
Definition Object.h:2018
Dummy parameter which is to be owned once by parameter classes that do not contain any other paramete...
Definition Object.h:522
const ItemIDType ID
ID of the Object this parameter class instance belongs to.
Definition Object.h:1779
const DynExpCore & Core
Reference to DynExp's core.
Definition Object.h:1780
Tag for function dispatching mechanism within this class used when derived classes are not intended t...
Definition Object.h:349
Base class for all tasks being processed by instruments. The class must not contain public virtual fu...
Definition Instrument.h:892
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
TaskBase(CallbackType CallbackFunc=nullptr) noexcept
Constructs an instrument task.
Definition Instrument.h:979
const CallbackType CallbackFunc
This callback function is called after the task has finished (either successfully or not) with a refe...
Defines the return type of task functions.
Definition Instrument.h:824
Refer to DynExp::ParamsBase::dispatch_tag.
DynExp's instrument namespace contains the implementation of DynExp instruments which extend DynExp's...
DataStreamPtrType< DataStreamBase > DataStreamBasePtrType
Type of a pointer owning a DataStreamBase instance.
std::unique_ptr< ParamsBase > ParamsBasePtrType
Alias for a pointer to the parameter system base class ParamsBase.
Definition Object.h:1807
size_t ItemIDType
ID type of objects/items managed by DynExp.
Accumulates include statements to provide a precompiled header.