DynExp
Highly flexible laboratory automation for dynamically changing experiments.
Loading...
Searching...
No Matches
InputPort.h
Go to the documentation of this file.
1// This file is part of DynExp.
2
9#pragma once
10
11#include "stdafx.h"
13
14namespace DynExpInstr
15{
16 class InputPort;
17
93
98 {
99 public:
104
105 virtual ~InputPortData() = default;
106
107 private:
110 };
111
116 {
117 public:
124
125 virtual ~InputPortParams() = 0;
126
127 virtual const char* GetParamClassTag() const noexcept override { return "InputPortParams"; }
128
129 protected:
130 void DisableUserEditable();
131
132 private:
135
136 DummyParam Dummy = { *this };
137 };
138
151
157 {
158 public:
162
171
172 constexpr static auto Name() noexcept { return "Input Port"; }
173 constexpr static auto Category() noexcept { return "I/O"; }
174
180
181 virtual ~InputPort() = 0;
182
183 virtual std::string GetName() const override { return Name(); }
184 virtual std::string GetCategory() const override { return Category(); }
185
191
198
205
212
220
227 virtual void ResetStreamSize(DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const override { MakeAndEnqueueTask<InputPortTasks::ResetBufferSizeTask>(CallbackFunc); }
229
230 private:
231 void ResetImpl(dispatch_tag<DataStreamInstrument>) override final;
233
234 virtual std::unique_ptr<DynExp::InitTaskBase> MakeInitTask() const override { return DynExp::MakeTask<InputPortTasks::InitTask>(); }
235 virtual std::unique_ptr<DynExp::ExitTaskBase> MakeExitTask() const override { return DynExp::MakeTask<InputPortTasks::ExitTask>(); }
236 virtual std::unique_ptr<DynExp::UpdateTaskBase> MakeUpdateTask() const override { return DynExp::MakeTask<InputPortTasks::UpdateTask>(); }
237 };
238}
Implementation of a data stream meta instrument and of data streams input/output devices might work o...
Configurator class for DataStreamInstrument.
Data class for DataStreamInstrument.
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()...
Parameter class for DataStreamInstrument.
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....
Implementation of the data stream meta instrument, which is a base class for all instruments reading/...
Configurator class for InputPort.
Definition InputPort.h:143
Data class for InputPort.
Definition InputPort.h:98
InputPortData(DataStreamBasePtrType &&SampleStream)
Constructs a DataStreamInstrumentData instance.
Definition InputPort.h:103
void ResetImpl(dispatch_tag< DataStreamInstrumentData >) override final
Definition InputPort.cpp:40
virtual void ResetImpl(dispatch_tag< InputPortData >)
Definition InputPort.h:109
virtual ~InputPortData()=default
Parameter class for InputPort.
Definition InputPort.h:116
void DisableUserEditable()
Calls DynExp::ParamsBase::DisableUserEditable() on all bundled parameters.
Definition InputPort.cpp:49
DummyParam Dummy
Dummy parameter which is to be owned once by parameter classes that do not contain any other paramete...
Definition InputPort.h:136
void ConfigureParamsImpl(dispatch_tag< DataStreamInstrumentParams >) override final
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to...
Definition InputPort.h:133
virtual void ConfigureParamsImpl(dispatch_tag< InputPortParams >)
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to...
Definition InputPort.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 InputPort.h:127
InputPortParams(DynExp::ItemIDType ID, const DynExp::DynExpCore &Core)
Constructs the parameters for a InputPort instance.
Definition InputPort.h:122
Defines a task for deinitializing an instrument within an instrument inheritance hierarchy....
Definition InputPort.h:54
void ExitFuncImpl(dispatch_tag< DataStreamInstrumentTasks::ExitTask >, DynExp::InstrumentInstance &Instance) override final
Deinitializes the respective instrument within the instrument inheritance hierarchy....
Definition InputPort.h:55
virtual void ExitFuncImpl(dispatch_tag< ExitTask >, DynExp::InstrumentInstance &Instance)
Deinitializes the respective instrument within the instrument inheritance hierarchy....
Definition InputPort.h:60
Defines a task for initializing an instrument within an instrument inheritance hierarchy....
Definition InputPort.h:27
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 void InitFuncImpl(dispatch_tag< InitTask >, DynExp::InstrumentInstance &Instance)
Initializes the respective instrument within the instrument inheritance hierarchy....
Definition InputPort.h:33
Task to reset the size of the related data stream instrument's stream to the result of InputPort::Get...
Definition InputPort.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...
Definition InputPort.cpp:29
ResetBufferSizeTask(CallbackType CallbackFunc) noexcept
Constructs a ResetBufferSizeTask instance.
Definition InputPort.h:87
Defines a task for updating an instrument within an instrument inheritance hierarchy....
Definition InputPort.h:67
void UpdateFuncImpl(dispatch_tag< DataStreamInstrumentTasks::UpdateTask >, DynExp::InstrumentInstance &Instance) override final
Updates the respective instrument within the instrument inheritance hierarchy. Call UpdateFuncImpl() ...
Definition InputPort.h:68
virtual void UpdateFuncImpl(dispatch_tag< UpdateTask >, DynExp::InstrumentInstance &Instance)
Updates the respective instrument within the instrument inheritance hierarchy. Call UpdateFuncImpl() ...
Definition InputPort.h:73
Generic input port meta instrument based on the data stream meta instrument to read data from hardwar...
Definition InputPort.h:157
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
static constexpr auto Name() noexcept
Every derived class has to redefine this function.
Definition InputPort.h:172
virtual DataStreamInstrumentData::ValueType GetHardwareResolution() const =0
Indicates the value's resolution the underlying hardware can record.
virtual DataStreamInstrumentData::ValueType GetHardwareMinValue() const =0
Indicates the minimal value the underlying hardware can record.
virtual std::string GetCategory() const override
Returns the category of this Object type.
Definition InputPort.h:184
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 InputPort.h:236
virtual void ResetImpl(dispatch_tag< InputPort >)=0
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every de...
virtual DataStreamInstrumentData::ValueType GetHardwareMaxValue() const =0
Indicates the maximal value the underlying hardware can record.
virtual std::unique_ptr< DynExp::InitTaskBase > MakeInitTask() const override
Factory function for an init task (InitTaskBase). Override to define the desired initialization task ...
Definition InputPort.h:234
InputPort(const std::thread::id OwnerThreadID, DynExp::ParamsBasePtrType &&Params)
Constructs an instrument instance.
Definition InputPort.h:178
virtual std::string GetName() const override
Returns the name of this Object type.
Definition InputPort.h:183
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 InputPort.h:227
static constexpr auto Category() noexcept
Every derived class has to redefine this function.
Definition InputPort.h:173
virtual StreamSizeParamsExtension::ValueType GetStreamSizeParams() const
Retrieves the size of the instrument's data stream from the instrument parameters....
Definition InputPort.h:197
virtual std::unique_ptr< DynExp::ExitTaskBase > MakeExitTask() const override
Factory function for an exit task (ExitTaskBase). Override to define the desired deinitialization tas...
Definition InputPort.h:235
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.