DynExp
Highly flexible laboratory automation for dynamically changing experiments.
Loading...
Searching...
No Matches
Laser.h
Go to the documentation of this file.
1// This file is part of DynExp.
2
8#pragma once
9
10#include "stdafx.h"
11#include "Instrument.h"
12
13namespace DynExpInstr
14{
15 class Laser;
16
61
66 {
67 public:
78
79 LaserData() = default;
80 virtual ~LaserData() = default;
81
82 void SetFrequencyValue(double Frequency) noexcept { this->Frequency = Frequency; }
83 auto GetFrequencyValue() const noexcept { return Frequency; }
84 void SetIntensityValue(double Intensity) noexcept { this->Intensity = Intensity; }
85 auto GetIntensityValue() const noexcept { return Intensity; }
86 void SetScanRangeValue(double ScanRange) noexcept { this->ScanRange = ScanRange; }
87 auto GetScanRangeValue() const noexcept { return ScanRange; }
88 void SetScanRateValue(double ScanRate) noexcept { this->ScanRate = ScanRate; }
89 auto GetScanRateValue() const noexcept { return ScanRate; }
90
95 auto GetLaserState() const noexcept { return GetLaserStateChild(); }
96
97 private:
98 void ResetImpl(dispatch_tag<InstrumentDataBase>) override final;
100
105 virtual LaserStateType GetLaserStateChild() const noexcept = 0;
107
108 double Frequency = 0.0;
109 double Intensity = 0.0;
110 double ScanRange = 0.0;
111 double ScanRate = 0.0;
112 };
113
117 class LaserParams : public DynExp::InstrumentParamsBase
118 {
119 public:
124 LaserParams(DynExp::ItemIDType ID, const DynExp::DynExpCore& Core) : InstrumentParamsBase(ID, Core) {}
125
126 virtual ~LaserParams() = 0;
127
128 virtual const char* GetParamClassTag() const noexcept override { return "LaserParams"; }
129
130 private:
133
134 DummyParam Dummy = { *this };
135 };
136
141 {
142 public:
145
146 LaserConfigurator() = default;
147 virtual ~LaserConfigurator() = 0;
148 };
149
154 {
155 public:
159
168
169 constexpr static auto Name() noexcept { return "Laser"; }
170 constexpr static auto Category() noexcept { return "I/O"; }
171
175 Laser(const std::thread::id OwnerThreadID, DynExp::ParamsBasePtrType&& Params)
176 : InstrumentBase(OwnerThreadID, std::move(Params)) {}
177
178 virtual ~Laser() = 0;
179
180 virtual std::string GetName() const override { return Name(); }
181 virtual std::string GetCategory() const override { return Category(); }
182
183 virtual std::chrono::milliseconds GetTaskQueueDelay() const override { return std::chrono::milliseconds(50); }
184
189
194
200
206 virtual double GetMinFrequency() const { return GetMaxFrequency(); }
207
212 virtual double GetMaxFrequency() const = 0;
213
219 virtual double GetMinIntensity() const { return GetMaxIntensity(); }
220
225 virtual double GetMaxIntensity() const = 0;
226
232 virtual double GetMinScanRange() const { return 0.0; }
233
239 virtual double GetMaxScanRange() const { return 0.0; }
240
246 virtual double GetMinScanRate() const { return 0.0; }
247
253 virtual double GetMaxScanRate() const { return 0.0; }
254
260 virtual double GetModeHopFreeTuningRange() const { return 0.0; }
262
269
274 virtual void SetFrequency(double Frequency, DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const = 0;
275
281 virtual void SetIntensity(double Intensity, DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const = 0;
282
288 virtual void SetScanRange(double ScanRange, DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const = 0;
289
295 virtual void SetScanRate(double ScanRate, DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const = 0;
296
301 virtual void Enable(DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const = 0;
302
307 virtual void Disable(DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const = 0;
308
315 virtual void ScanContinuously(DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const;
316
323 virtual void DisableScan(DynExp::TaskBase::CallbackType CallbackFunc = nullptr) const;
325
326 private:
327 void ResetImpl(dispatch_tag<InstrumentBase>) override final;
328 virtual void ResetImpl(dispatch_tag<Laser>) = 0;
329 };
330}
Implementation of DynExp instrument objects.
Configurator class for Laser.
Definition Laser.h:141
Data class for Laser.
Definition Laser.h:66
double ScanRate
Current scan rate.
Definition Laser.h:111
auto GetScanRateValue() const noexcept
Getter for ScanRate.
Definition Laser.h:89
virtual ~LaserData()=default
virtual LaserStateType GetLaserStateChild() const noexcept=0
Returns the laser's current state.
void SetScanRangeValue(double ScanRange) noexcept
Setter for ScanRange.
Definition Laser.h:86
double Frequency
Current frequency.
Definition Laser.h:108
LaserStateType
Possible laser states.
Definition Laser.h:71
@ Startup
The laser is warming up.
@ Error
The laser is in an error state.
@ EmissionEnabledConstant
The laser is emitting in constant mode.
@ EmissionEnabledScanning
The laser is emitting in scan mode.
@ Ready
The laser is ready for emission.
void SetFrequencyValue(double Frequency) noexcept
Setter for Frequency.
Definition Laser.h:82
void ResetImpl(dispatch_tag< InstrumentDataBase >) override final
Definition Laser.cpp:8
auto GetFrequencyValue() const noexcept
Getter for Frequency.
Definition Laser.h:83
double Intensity
Current intensity.
Definition Laser.h:109
virtual void ResetImpl(dispatch_tag< LaserData >)
Definition Laser.h:99
void SetScanRateValue(double ScanRate) noexcept
Setter for ScanRate.
Definition Laser.h:88
auto GetScanRangeValue() const noexcept
Getter for ScanRange.
Definition Laser.h:87
auto GetLaserState() const noexcept
Returns the laser's current state.
Definition Laser.h:95
void SetIntensityValue(double Intensity) noexcept
Setter for Intensity.
Definition Laser.h:84
double ScanRange
Current scan range.
Definition Laser.h:110
auto GetIntensityValue() const noexcept
Getter for Intensity.
Definition Laser.h:85
Parameter class for Laser.
Definition Laser.h:118
LaserParams(DynExp::ItemIDType ID, const DynExp::DynExpCore &Core)
Constructs the parameters for a Laser instance.
Definition Laser.h:124
void ConfigureParamsImpl(dispatch_tag< InstrumentParamsBase >) override final
Definition Laser.h:131
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 Laser.h:128
virtual void ConfigureParamsImpl(dispatch_tag< LaserParams >)
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to...
Definition Laser.h:132
Defines a task for deinitializing an instrument within an instrument inheritance hierarchy....
Definition Laser.h:39
void ExitFuncImpl(dispatch_tag< ExitTaskBase >, DynExp::InstrumentInstance &Instance) override final
Definition Laser.h:40
virtual void ExitFuncImpl(dispatch_tag< ExitTask >, DynExp::InstrumentInstance &Instance)
Deinitializes the respective instrument within the instrument inheritance hierarchy....
Definition Laser.h:45
Defines a task for initializing an instrument within an instrument inheritance hierarchy....
Definition Laser.h:26
void InitFuncImpl(dispatch_tag< InitTaskBase >, DynExp::InstrumentInstance &Instance) override final
Definition Laser.h:27
virtual void InitFuncImpl(dispatch_tag< InitTask >, DynExp::InstrumentInstance &Instance)
Initializes the respective instrument within the instrument inheritance hierarchy....
Definition Laser.h:32
Defines a task for updating an instrument within an instrument inheritance hierarchy....
Definition Laser.h:52
void UpdateFuncImpl(dispatch_tag< UpdateTaskBase >, DynExp::InstrumentInstance &Instance) override final
Definition Laser.h:53
virtual void UpdateFuncImpl(dispatch_tag< UpdateTask >, DynExp::InstrumentInstance &Instance)
Updates the respective instrument within the instrument inheritance hierarchy. Call UpdateFuncImpl() ...
Definition Laser.h:58
Meta instrument for a laser.
Definition Laser.h:154
static constexpr auto Name() noexcept
Every derived class has to redefine this function.
Definition Laser.h:169
virtual double GetMinIntensity() const
Determines the minimal emission intensity. The default implementation returns GetMaxIntensity() which...
Definition Laser.h:219
virtual void Enable(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Enables emission in constant mode.
virtual double GetMaxIntensity() const =0
Determines the maximal emission intensity.
virtual std::string GetCategory() const override
Returns the category of this Object type.
Definition Laser.h:181
virtual void ResetImpl(dispatch_tag< Laser >)=0
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every de...
virtual double GetMinScanRange() const
Determines the minimal frequency scan range. The default implementation returns 0....
Definition Laser.h:232
Laser(const std::thread::id OwnerThreadID, DynExp::ParamsBasePtrType &&Params)
Constructs an instrument instance.
Definition Laser.h:175
virtual DynExp::Units::UnitType GetFrequencyUnit() const =0
Determines the frequency unit.
virtual double GetModeHopFreeTuningRange() const
Determines the mode hop free tuning range. The default implementation returns 0.0,...
Definition Laser.h:260
virtual DynExp::Units::UnitType GetIntensityUnit() const =0
Determines the intensity unit.
virtual double GetMinFrequency() const
Determines the minimal emission frequency. The default implementation returns GetMaxFrequency() which...
Definition Laser.h:206
virtual double GetMaxScanRange() const
Determines the maximal frequency scan range. The default implementation returns 0....
Definition Laser.h:239
virtual double GetMaxScanRate() const
Determines the maximal frequency scan rate. The default implementation returns 0.0,...
Definition Laser.h:253
virtual std::chrono::milliseconds GetTaskQueueDelay() const override
Specifies in which time intervals the instrument's task queue runs to handle pending tasks.
Definition Laser.h:183
virtual std::string GetName() const override
Returns the name of this Object type.
Definition Laser.h:180
virtual void SetIntensity(double Intensity, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Sets the laser's output intensity.
virtual double GetMaxFrequency() const =0
Determines the maximal emission frequency.
virtual void SetScanRate(double ScanRate, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Sets the laser's frequency scan rate.
virtual void Disable(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Disables emission.
virtual void SetFrequency(double Frequency, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Sets the laser's emission frequency.
virtual void SetScanRange(double ScanRange, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const =0
Sets the laser's frequency scan range.
static constexpr auto Category() noexcept
Every derived class has to redefine this function.
Definition Laser.h:170
virtual double GetMinScanRate() const
Determines the minimal frequency scan rate. The default implementation returns 0.0,...
Definition Laser.h:246
DynExp's core class acts as the interface between the user interface and DynExp's internal data like ...
Definition DynExpCore.h:127
Defines a task for deinitializing an instrument within an instrument inheritance hierarchy....
Refer to DynExp::ParamsBase::dispatch_tag.
Defines a task for initializing an instrument within an instrument inheritance hierarchy....
Refer to DynExp::ParamsBase::dispatch_tag.
Base class for instruments. Instruments comprise virtual devices (meta instruments) and physial devic...
Definition Instrument.h:480
Configurator class for InstrumentBase.
Definition Instrument.h:464
Data structure to contain data which is synchronized in between different threads....
Definition Instrument.h:135
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:813
Refer to ParamsBase::dispatch_tag.
Definition Object.h:2026
Dummy parameter which is to be owned once by parameter classes that do not contain any other paramete...
Definition Object.h:522
Tag for function dispatching mechanism within this class used when derived classes are not intended t...
Definition Object.h:349
Type owning a callback function which is invoked when a task has finished, failed,...
Definition Instrument.h:978
Defines a task for updating an instrument within an instrument inheritance hierarchy....
Refer to DynExp::ParamsBase::dispatch_tag.
DynExp's instrument namespace contains the implementation of DynExp instruments which extend DynExp's...
UnitType
Units which can be used with DynExp instruments.
Definition Units.h:28
DynExp's main namespace contains the implementation of DynExp including classes to manage resources (...
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.