DynExp
Highly flexible laboratory automation for dynamically changing experiments.
|
Abstract base class for object parameter classes. Each class derived from class Object
must be accompanied by a parameter class derived from ParamsBase
. These parameter classes are intended to contain the object's parameters (sub-classes of ParamsBase::ParamBase
) which are stored in DynExp project files and which can be configured in the respective object instance's settings dialog or programmatically. Parameter classes are synchronized in between different threads (e.g. the main thread and an instrument/module thread).
More...
Classes | |
struct | dispatch_tag |
Tag for function dispatching mechanism within this class used when derived classes are not intended to override a specific function, but to add functionality. Some class B derived from class A overrides a function f accepting an argument of type dispatch_tag< A > declared as virtual in class A. Class B itself declares a virtual function accepting an argument of type dispatch_tag< B > to be overriden by a class C derived from class B. The function defined in class B is called by the base class A and it itself has to call the function overriden in class C. Calls to respective functions are performed using an instance of the respective dispatch tag. This allows to form a chain of calls f() [defined in A] -> f(dispatch_tag< A >) [declared in A, defined in B] -> f(dispatch_tag< B >) [declared in B, defined in C] -> ... More... | |
class | DummyParam |
Dummy parameter which is to be owned once by parameter classes that do not contain any other parameter. It ensures the presence of the respective level in the XML hierarchy. Parameter is skipped when saving/loading because of its empty name. More... | |
class | IndexedTextList |
Type to identify an indexed text list parameter (one number selected from a list of numbers associated with strings) More... | |
class | LinkListParamBase |
Base class for link list parameters to multiple Object of any (but all the same) type specifying the underlying parameter type. The underlying type is the integral DynExp::ItemIDType type, which stores the IDs of the linked objects. More... | |
class | LinkParamBase |
Base class for link parameters to a single Object of any type specifying the underlying parameter type. The underlying type is the integral DynExp::ItemIDType type, which stores the ID of the linked object. More... | |
class | LinkParamStarter |
Makes sure the object link parameters of the associated ParamsBase instance are in a ready state by performing the initialization stepwise to allow updating the UI in between. Instances of this class can only be used once. More... | |
class | ListParam |
class | ListParam< ArithmeticType, std::enable_if_t< std::is_arithmetic_v< ArithmeticType > > > |
List parameter for numbers. If ParamType is an arithmetic type (integral or floating point), then extend TypedListParamBase's functionality by specifying the allowed number range and format. More... | |
class | ListParam< LinkType, std::enable_if_t< std::is_base_of_v< ObjectLinkBase, LinkType > > > |
Parameter for link lists to multiple Object . If LinkType is derived from ObjectLinkBase, then extend TypedParamBase's functionality by providing link instantiation functionality and by overriding AddToDialogChild(). More... | |
class | ListParam< ParamType, std::enable_if_t< !std::is_arithmetic_v< ParamType > &&!std::is_base_of_v< ObjectLinkBase, ParamType > > > |
General list parameter for any ParamType (except the ones which are further specified below). More... | |
struct | OwnedParamInfo |
Helper type owning a reference to a parameter and its class tag. More... | |
class | Param |
class | Param< ArithmeticType, std::enable_if_t< std::is_arithmetic_v< ArithmeticType > > > |
Parameter for numbers. If ParamType is an arithmetic type (integral or floating point), then extend TypedParamBase's functionality by specifying the allowed number range and format. More... | |
class | Param< EnumType, std::enable_if_t< std::is_enum_v< EnumType > > > |
Parameter for enumerations which are convertible to a numeric type. If ParamType is an enum, then extend TypedParamBase's functionality by providing conversion functionality and by overriding AddToDialogChild(). More... | |
class | Param< LinkType, std::enable_if_t< std::is_base_of_v< ObjectLinkBase, LinkType > > > |
Parameter for links to a single Object . If LinkType is derived from ObjectLinkBase, then extend TypedParamBase's functionality by providing link instantiation functionality and by overriding AddToDialogChild(). More... | |
class | Param< ParamType, std::enable_if_t< !std::is_arithmetic_v< ParamType > &&!std::is_base_of_v< Text, ParamType > &&!std::is_base_of_v< TextList, ParamType > &&!std::is_base_of_v< IndexedTextList, ParamType > &&!std::is_enum_v< ParamType > &&!std::is_base_of_v< ObjectLinkBase, ParamType > > > |
General parameter for any ParamType (except the ones which are further specified below). More... | |
class | Param< ParamType, std::enable_if_t< std::is_base_of_v< IndexedTextList, ParamType > > > |
Parameter for indexed strings selected from a predefined list of strings. If ParamType is of type ParamsBase::IndexedTextList, then extend TypedParamBase's functionality by providing text list functionality and by overriding AddToDialogChild(). In this case, the parameter does not store the string itself, but the selected index (of type Util::TextListIndexType) of the predefined text list. More... | |
class | Param< ParamType, std::enable_if_t< std::is_base_of_v< Text, ParamType > > > |
Parameter for strings. If ParamType is of type ParamsBase::Text, then extend TypedParamBase's functionality by indicating the text's purpose and by overriding AddToDialogChild(). More... | |
class | Param< ParamType, std::enable_if_t< std::is_base_of_v< TextList, ParamType > > > |
Parameter for strings selected from a predefined list of strings. If ParamType is of type ParamsBase::TextList, then extend TypedParamBase's functionality by providing text list functionality and by overriding AddToDialogChild(). More... | |
class | ParamBase |
Abstract base class for a single object parameter. Parameters derived from this class are automatically stored in the DynExp project file. Additionally, derived parameters might be configured in settings dialogs dynamically generated for objects according to the parameters belonging to it. More... | |
class | TextList |
Type to identify a text list parameter (one string selected from a list of strings) More... | |
class | TypedListParamBase |
Base class of parameters containing lists of values. More... | |
class | TypedParamBase |
Base class of parameters containing a single value. More... | |
Public Types | |
enum | UsageType { Unique , Shared } |
Determines whether an Object can be linked to only one (unique) or multiple (shared) other objects. More... | |
using | ObjectLinkParamsType = std::vector< std::reference_wrapper< LinkBase > > |
Type of a list of all owned object link parameters. More... | |
using | EnumParamSignedIntegerType = intmax_t |
Parameter type to convert signed eumeration parameters to. More... | |
using | EnumParamUnsignedIntegerType = uintmax_t |
Parameter type to convert unsigned eumeration parameters to. More... | |
template<typename EnumType > | |
using | LargestEnumUnderlyingType = std::conditional_t< std::is_signed_v< std::underlying_type_t< EnumType > >, EnumParamSignedIntegerType, EnumParamUnsignedIntegerType > |
Type trait providing an integer type for enumeration types which allows to store the value of enumeration variables of that type in a file. More... | |
using | Text = Util::TextType |
String type of text-type parameters (DynExp::ParamsBase::Param) More... | |
template<typename ArithmeticType > | |
using | UnderlyingArithmeticParamType = TypedParamBase< ArithmeticType > |
using | UnderlyingTextParamType = TypedParamBase< Util::TextType > |
using | UnderlyingTextListParamType = TypedParamBase< Util::TextType > |
using | UnderlyingIndexedTextListParamType = TypedParamBase< Util::TextListIndexType > |
template<typename EnumType > | |
using | UnderlyingEnumParamType = TypedParamBase< LargestEnumUnderlyingType< EnumType > > |
If ParamType is an enum, then use largest signed/unsigned integral type as the underlying type since the enum's underlying type has to be integral. More... | |
using | UnderlyingLinkParamType = TypedParamBase< ItemIDType > |
template<typename ArithmeticType > | |
using | UnderlyingArithmeticListParamType = TypedListParamBase< ArithmeticType > |
using | UnderlyingLinkListParamType = TypedListParamBase< ItemIDType > |
Public Member Functions | |
ParamsBase (ItemIDType ID, const DynExpCore &Core) | |
Constructs the base class of an object parameter class. More... | |
virtual | ~ParamsBase ()=0 |
virtual const char * | GetParamClassTag () const noexcept |
This function is intended to be overridden once in each derived class returning the name of the respective class. Parameters defined in any class within the ParamsBase hierarchy will receive a 'this' pointer pointing to ParamsBase when their ParamBase constructors are called. The ParamBase constructors will register the respective parameter in ParamsBase::OwnedParams calling GetParamClassTag() on the given 'this' pointer. This allows the ParamBase constructor to obtain the name of the class where the respective parameter was declared in. The name is used as an XML tag containing related parameters in the project files. Here, it is fully intended that the virtual call to GetParamClassTag() leads only to a call of GetParamClassTag() of the current dynamic type of ParamsBase! More... | |
QDomElement | ConfigToXML (QDomDocument &Document) const |
Creates an XML node with a tag name as determined by GetParamClassTag() containing all parameters belonging to this ParamsBase instance. More... | |
void | ConfigFromXML (const QDomElement &XMLElement) const |
Retrieves all parameters belonging to this ParamsBase instance from an XML node with a tag name as determined by GetParamClassTag() More... | |
void | ConfigFromDialog (ParamsConfigDialog &Dialog) |
Adds all parameters belonging to this ParamsBase instance to a settings dialog to let the user configure the parameter values. More... | |
bool | Validate () const |
Refer to ParamBase::Validate(). More... | |
ItemIDType | GetID () const noexcept |
Returns the ID of the Object this parameter class instance belongs to. More... | |
const auto & | GetCore () const noexcept |
Returns a reference to DynExp's core. More... | |
const auto & | GetObjectLinkParams () const noexcept |
Returns a list of all object link parameters owned by this parameter class instance. More... | |
bool | ConfigureUsageType () const noexcept |
Determines whether the Usage parameter should be configurable in the settings dialog. Override ConfigureUsageTypeChild() in order to adjust. More... | |
const NetworkParamsExtension * | GetNetworkAddressParams () const noexcept |
Returns the network address parameters of a derived gRPC instrument. Override GetNetworkAddressParamsChild() in order to adjust. More... | |
Public Member Functions inherited from Util::INonCopyable | |
INonCopyable (const INonCopyable &)=delete | |
INonCopyable & | operator= (const INonCopyable &)=delete |
Static Public Member Functions | |
static Util::TextValueListType< UsageType > | AvlblUsageTypeStrList () |
Maps description strings to the ParamsBase::UsageType enum's items. More... | |
static void | DisableUserEditable (ParamBase &Param) noexcept |
Sets the UserEditable property of the parameter Param to false. Refer to ParamBase::UserEditable. More... | |
Public Attributes | |
Param< ParamsConfigDialog::TextType > | ObjectName = { *this, "ObjectName", "Name", "Name to identify this item", false } |
String set by the user to identify the object this parameter class instance belongs to. More... | |
Param< UsageType > | Usage |
Determines whether an object can be used by only one other ("unique") or by multiple other ("shared") objects. More... | |
Private Types | |
using | OwnedParamsType = std::vector< OwnedParamInfo > |
List type of information on parameters owned by this ParamsBase instance (and its derived classes) More... | |
Private Member Functions | |
void | ConfigureParams () |
Called by ConfigFromDialog() to apply changes to parameters owned by this parameter class instance before a settings dialog is displayed to let the user configure the parameters. More... | |
virtual void | ConfigureParamsImpl (dispatch_tag< ParamsBase >) |
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to descend the inheritance hierarchy. Override to add functionality to ConfigureParams(). Refer to DynExp::ParamsBase::dispatch_tag. More... | |
virtual bool | ConfigureUsageTypeChild () const noexcept |
Determines whether the Usage parameter should be configurable in the settings dialog. Override ConfigureUsageTypeChild() in order to adjust. More... | |
virtual const NetworkParamsExtension * | GetNetworkAddressParamsChild () const noexcept |
Returns the network address parameters of a derived gRPC instrument. Override GetNetworkAddressParamsChild() in order to adjust. More... | |
std::filesystem::path | ToAbsolutePath (const std::filesystem::path &Path) const |
Transforms the path Path into an absolute path relative to ProjectParams::ProjectFilename. More... | |
Private Attributes | |
const ItemIDType | ID |
ID of the Object this parameter class instance belongs to. More... | |
const DynExpCore & | Core |
Reference to DynExp's core. More... | |
Important declaration order | |
These vectors must be declared before any members derived from ParamBase are declared! This is the case since ParamBase's constructor and constructors of classes derived from ParamBase access these vectors. Declaring these vectors first ensures that their lifetimes exceed those of any members derived from ParamBase. The order of OwnedParams is important! Subsequent entries with equal OwnedParamInfo::ClassTag will be stored within the same XML tag. If OwnedParamInfo::ClassTag differs from the previous one, a respective sub-tag is introduced. | |
OwnedParamsType | OwnedParams |
List of all parameters owned by this parameter class instance. More... | |
ObjectLinkParamsType | ObjectLinkParams |
List of all object link parameters owned by this parameter class instance. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Util::ISynchronizedPointerLockable | |
ISynchronizedPointerLockable () | |
~ISynchronizedPointerLockable () | |
Object should never be destroyed before completely unlocked. More... | |
Protected Member Functions inherited from Util::INonCopyable | |
constexpr | INonCopyable ()=default |
~INonCopyable ()=default | |
Abstract base class for object parameter classes. Each class derived from class Object
must be accompanied by a parameter class derived from ParamsBase
. These parameter classes are intended to contain the object's parameters (sub-classes of ParamsBase::ParamBase
) which are stored in DynExp project files and which can be configured in the respective object instance's settings dialog or programmatically. Parameter classes are synchronized in between different threads (e.g. the main thread and an instrument/module thread).
Object
, always lock the mutex of the corresponding parameter class before the mutex of the corresponding data class (or only one of them). struct DynExp::ParamsBase::dispatch_tag |
Tag for function dispatching mechanism within this class used when derived classes are not intended to override a specific function, but to add functionality. Some class B derived from class A overrides a function f accepting an argument of type dispatch_tag< A > declared as virtual in class A. Class B itself declares a virtual function accepting an argument of type dispatch_tag< B > to be overriden by a class C derived from class B. The function defined in class B is called by the base class A and it itself has to call the function overriden in class C. Calls to respective functions are performed using an instance of the respective dispatch tag. This allows to form a chain of calls f() [defined in A] -> f(dispatch_tag< A >) [declared in A, defined in B] -> f(dispatch_tag< B >) [declared in B, defined in C] -> ...
Type | (derived from class ParamsBase ) to instantiate the dispatch tag template with. |
class DynExp::ParamsBase::IndexedTextList |
class DynExp::ParamsBase::ListParam |
struct DynExp::ParamsBase::OwnedParamInfo |
Helper type owning a reference to a parameter and its class tag.
Class Members | ||
---|---|---|
const char *const | ClassTag | Denotes the result of GetParamClassTag() of the class where the respective OwnedParam was declared in. |
const reference_wrapper< ParamBase > | OwnedParam | Reference to the parameter. |
class DynExp::ParamsBase::Param |
class DynExp::ParamsBase::TextList |
using DynExp::ParamsBase::EnumParamSignedIntegerType = intmax_t |
using DynExp::ParamsBase::EnumParamUnsignedIntegerType = uintmax_t |
using DynExp::ParamsBase::LargestEnumUnderlyingType = std::conditional_t< std::is_signed_v<std::underlying_type_t<EnumType> >, EnumParamSignedIntegerType, EnumParamUnsignedIntegerType > |
Type trait providing an integer type for enumeration types which allows to store the value of enumeration variables of that type in a file.
EnumType | Integer enumeration type - do not use strongly-typed enumerations as DynExp parameter types. |
using DynExp::ParamsBase::ObjectLinkParamsType = std::vector<std::reference_wrapper<LinkBase> > |
|
private |
List type of information on parameters owned by this ParamsBase instance (and its derived classes)
String type of text-type parameters (DynExp::ParamsBase::Param)
using DynExp::ParamsBase::UnderlyingArithmeticListParamType = TypedListParamBase<ArithmeticType> |
using DynExp::ParamsBase::UnderlyingArithmeticParamType = TypedParamBase<ArithmeticType> |
using DynExp::ParamsBase::UnderlyingEnumParamType = TypedParamBase<LargestEnumUnderlyingType<EnumType> > |
If ParamType
is an enum, then use largest signed/unsigned integral type as the underlying type since the enum's underlying type has to be integral.
EnumType | Enumeration type which is convertible to a numeric type (only unscoped enumerations) |
|
inline |
|
pure virtual |
Definition at line 198 of file Object.cpp.
|
static |
Maps description strings to the ParamsBase::UsageType enum's items.
Definition at line 282 of file Object.cpp.
void DynExp::ParamsBase::ConfigFromDialog | ( | ParamsConfigDialog & | Dialog | ) |
Adds all parameters belonging to this ParamsBase instance to a settings dialog to let the user configure the parameter values.
Dialog | Settings dialog to add UI controls for adjusting the parameters to. The dialog is not automatically opened/shown by this function. |
Definition at line 260 of file Object.cpp.
void DynExp::ParamsBase::ConfigFromXML | ( | const QDomElement & | XMLElement | ) | const |
Retrieves all parameters belonging to this ParamsBase instance from an XML node with a tag name as determined by GetParamClassTag()
XMLElement | XML element containing a single child node with a tag name as determined by GetParamClassTag() |
Definition at line 222 of file Object.cpp.
QDomElement DynExp::ParamsBase::ConfigToXML | ( | QDomDocument & | Document | ) | const |
Creates an XML node with a tag name as determined by GetParamClassTag() containing all parameters belonging to this ParamsBase instance.
Document | XML document to create the DOM elements in |
Definition at line 202 of file Object.cpp.
|
private |
Called by ConfigFromDialog() to apply changes to parameters owned by this parameter class instance before a settings dialog is displayed to let the user configure the parameters.
Definition at line 297 of file Object.cpp.
|
inlineprivatevirtual |
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to descend the inheritance hierarchy. Override to add functionality to ConfigureParams(). Refer to DynExp::ParamsBase::dispatch_tag.
Reimplemented in DynExp::RunnableObjectParams, DynExp::HardwareAdapterParamsBase, and DynExp::ProjectParams.
|
inlinenoexcept |
Determines whether the Usage parameter should be configurable in the settings dialog. Override ConfigureUsageTypeChild() in order to adjust.
|
inlineprivatevirtualnoexcept |
Determines whether the Usage parameter should be configurable in the settings dialog. Override ConfigureUsageTypeChild() in order to adjust.
Reimplemented in DynExp::ModuleParamsBase.
|
staticnoexcept |
Sets the UserEditable
property of the parameter Param
to false. Refer to ParamBase::UserEditable.
Param | Parameter for which to set UserEditable to false |
Definition at line 292 of file Object.cpp.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Returns the network address parameters of a derived gRPC instrument. Override GetNetworkAddressParamsChild() in order to adjust.
|
inlineprivatevirtualnoexcept |
Returns the network address parameters of a derived gRPC instrument. Override GetNetworkAddressParamsChild() in order to adjust.
Reimplemented in DynExpModule::gRPCModuleParams< gRPCServices >, and DynExpModule::gRPCModuleParams< gRPCServices... >.
|
inlinenoexcept |
|
inlinevirtualnoexcept |
This function is intended to be overridden once in each derived class returning the name of the respective class. Parameters defined in any class within the ParamsBase hierarchy will receive a 'this' pointer pointing to ParamsBase when their ParamBase constructors are called. The ParamBase constructors will register the respective parameter in ParamsBase::OwnedParams calling GetParamClassTag() on the given 'this' pointer. This allows the ParamBase constructor to obtain the name of the class where the respective parameter was declared in. The name is used as an XML tag containing related parameters in the project files. Here, it is fully intended that the virtual call to GetParamClassTag() leads only to a call of GetParamClassTag() of the current dynamic type of ParamsBase!
Reimplemented in DynExp::ProjectParams, DynExp::RunnableObjectParams, DynExpModule::Widefield::WidefieldMicroscopeParams, DynExpModule::Trajectory1DParams, DynExpModule::StreamManipulatorParams, DynExpModule::Stage1DParams, DynExpModule::SpectrumViewer::SpectrumViewerParams, DynExpModule::SignalPlotterParams, DynExpModule::SignalDesignerParams, DynExpModule::OutputPortWriterParams, DynExpModule::ODMR::ODMRParams, DynExpModule::NetworkTimeTaggerParams< gRPCServices >, DynExpModule::NetworkDigitalOutParams< gRPCServices >, DynExpModule::NetworkDigitalInParams< gRPCServices >, DynExpModule::NetworkDataStreamInstrumentParams< gRPCServices >, DynExpModule::NetworkDataStreamInstrumentParams< gRPCServices... >, DynExpModule::NetworkAnalogOutParams< gRPCServices >, DynExpModule::NetworkAnalogInParams< gRPCServices >, DynExpModule::LockinAmplifierControlParams, DynExpModule::InputPortReaderParams, DynExpModule::ImageViewer::ImageViewerParams, DynExpModule::gRPCModuleParams< gRPCServices >, DynExpModule::gRPCModuleParams< gRPCServices... >, DynExpModule::ArbitraryFunctionFromCSVParams, DynExp::QModuleParamsBase, DynExp::ModuleParamsBase, DynExpInstr::TimeTaggerParams, DynExpInstr::PositionerStageParams, DynExpInstr::SpectrometerParams, DynExpInstr::OutputPortParams, DynExpInstr::LockinAmplifierParams, DynExpInstr::InputPortParams, DynExpInstr::FunctionGeneratorParams, DynExpInstr::DigitalOutParams, DynExpInstr::DigitalInParams, DynExpInstr::DataStreamInstrumentParams, DynExpInstr::CameraParams, DynExpInstr::AnalogOutParams, DynExpInstr::AnalogInParams, DynExpInstr::ZI_MFLIParams, DynExpInstr::SwabianInstrumentsPulseStreamerParams, DynExpInstr::SmarActParams, DynExpInstr::RS_SMC100AParams, DynExpInstr::RS_SMB100BParams, DynExpInstr::QutoolsQuTAGParams, DynExpInstr::PVCamParams, DynExpInstr::PI_C_862_Params, DynExpInstr::NIDAQDigitalOutParams, DynExpInstr::NIDAQDigitalInParams, DynExpInstr::NIDAQAnalogOutParams, DynExpInstr::NIDAQAnalogInParams, DynExpInstr::NenionLeakvalveF3Params, DynExpInstr::InterModuleCommunicatorParams, DynExpInstr::DummyDataStreamInstrumentParams, DynExpInstr::DummyCameraParams, DynExp::InstrumentParamsBase, DynExpHardware::ZILabOneHardwareAdapterParams, DynExpHardware::SIPulseStreamerHardwareAdapterParams, DynExpHardware::SmarActHardwareAdapterParams, DynExp::HardwareAdapterSerialPortParams, DynExpHardware::QutoolsTDCHardwareAdapterParams, DynExpHardware::PVCamHardwareAdapterParams, DynExpHardware::NIDAQHardwareAdapterParams, DynExpHardware::gRPCHardwareAdapterParams< gRPCStub >, DynExpHardware::gRPCHardwareAdapterParams< pulse_streamer::PulseStreamer >, DynExp::HardwareAdapterTcpSocketParams, DynExp::QSerialCommunicationHardwareAdapterParams, DynExp::SerialCommunicationHardwareAdapterParams, and DynExp::HardwareAdapterParamsBase.
|
private |
Transforms the path Path
into an absolute path relative to ProjectParams::ProjectFilename.
Path | Relative path to be transformed |
Path
itself if it is either empty or already absolute. Definition at line 305 of file Object.cpp.
bool DynExp::ParamsBase::Validate | ( | ) | const |
Refer to ParamBase::Validate().
Definition at line 271 of file Object.cpp.
|
private |
|
private |
|
private |
Param<ParamsConfigDialog::TextType> DynExp::ParamsBase::ObjectName = { *this, "ObjectName", "Name", "Name to identify this item", false } |
|
private |
Determines whether an object can be used by only one other ("unique") or by multiple other ("shared") objects.