DynExp
Highly flexible laboratory automation for dynamically changing experiments.
Object.h File Reference

Implementation of DynExp objects as the base for derived resources and implementation of the object parameter system. More...

Go to the source code of this file.

Classes

struct  DynExp::ManagerTypeOfObjectType< ObjectType, >
 Type trait relating a type ObjectType derived from either class HardwareAdapterBase or class InstrumentBase to the resource manager type (derived from DynExp::CommonResourceManagerBase) managing instances of the type ObjectType. More...
 
class  DynExp::ObjectUserList
 Helper class to enable keeping track of instances of class Object making use of the owner of the respective ObjectUserList's instance. Instances of class Object can register or deregister multiple times as an user which increments or decrements their respective registration count in ObjectUserList::UserList. More...
 
class  DynExp::LinkBase
 Abstract base class of link parameters (to be saved in project files) describing relations between multiple Object (e.g. a module making use of an instrument). More...
 
class  DynExp::ParamsBase
 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...
 
struct  DynExp::ParamsBase::dispatch_tag< typename >
 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  DynExp::ParamsBase::TextList
 Type to identify a text list parameter (one string selected from a list of strings) More...
 
class  DynExp::ParamsBase::IndexedTextList
 Type to identify an indexed text list parameter (one number selected from a list of numbers associated with strings) More...
 
class  DynExp::ParamsBase::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  DynExp::ParamsBase::ParamBase::ParamsBaseOnlyType
 Provides the class ParamsBase access to some private members of class ParamBase. More...
 
class  DynExp::ParamsBase::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  DynExp::ParamsBase::TypedParamBase< ParamType >
 Base class of parameters containing a single value. More...
 
class  DynExp::ParamsBase::TypedListParamBase< ParamType >
 Base class of parameters containing lists of values. More...
 
class  DynExp::ParamsBase::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  DynExp::ParamsBase::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  DynExp::ParamsBase::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  DynExp::ParamsBase::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  DynExp::ParamsBase::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  DynExp::ParamsBase::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  DynExp::ParamsBase::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  DynExp::ParamsBase::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  DynExp::ParamsBase::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...
 
class  DynExp::ParamsBase::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  DynExp::ParamsBase::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  DynExp::ParamsBase::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  DynExp::ParamsBase::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...
 
struct  DynExp::ParamsBase::OwnedParamInfo
 Helper type owning a reference to a parameter and its class tag. More...
 
class  DynExp::ConfiguratorBase
 The configurator classes have the task to generate parameter objects (refer to DynExp::ParamsBase) of the corresponding type for DynExp objects DynExp::Object. For each class derived from DynExp::Object, there must be a respective configurator derived from ConfiguratorBase. More...
 
struct  DynExp::ConfiguratorBase::UpdateConfigFromDialogResult
 Return type of ConfiguratorBase::UpdateConfigFromDialog() indicating the result of the configurator dialog shown to the user to configure an Object's parameters. More...
 
class  DynExp::Object
 Base class for all DynExp Objects like hardware adapters (DynExp::HardwareAdapterBase), instruments (DynExp::InstrumentBase) and modules (DynExp::ModuleBase). Subclasses should also derive either form Util::INonCopyable or Util::ILockable since Object is not intended to be copied. Especially, it must not be moved to another thread (than the one creating it). Logical const-ness: const member functions can be called by other threads, non-const functions are visible only to main thread. More...
 
struct  DynExp::Object::dispatch_tag< typename >
 Refer to ParamsBase::dispatch_tag. More...
 
class  DynExp::Object::LinkedObjectWrapperOnlyType
 Allow exclusive access to some of Object's private methods to any LinkedObjectWrapper<T>. More...
 
class  DynExp::RunnableObjectParams
 Parameter class for RunnableObject. More...
 
class  DynExp::RunnableObjectConfigurator
 Configurator class for RunnableObject. More...
 
class  DynExp::RunnableObject
 Defines an Object which possesses a thread it runs in. The RunnableObject can be started and stopped as well as paused and resumed. More...
 
class  DynExp::RunnableObject::RunnableInstanceOnlyType
 Allow exclusive access to some of RunnableObject's private methods to class RunnableInstance. More...
 
class  DynExp::RunnableObject::NotUnusedException
 Exception type thrown by TerminateImpl() if the RunnableObject cannot be terminated for being used by another Object instance. More...
 
class  DynExp::LinkedObjectWrapperBase
 Polymorphic base class to allow storing LinkedObjectWrapper of any type in a single list. More...
 
struct  DynExp::LinkedObjectWrapperBase::OwnedLinkedObjectWrapperType
 Helper type linking a LinkedObjectWrapperBasePtrType to the corresponding LinkedObjectWrapperContainerBase instance. More...
 
class  DynExp::LinkedObjectWrapper< ObjectT >
 Holds a shared_ptr to a resource (instance of class Object) and lets the resource keep track of its usage count by increasing a respective counter of the resource on construction and by decreasing the counter on destruction of the LinkedObjectWrapper instance again. Not copyable in order not to mess up the usage counter stored in LinkedObjectWrapper::DestinyResource. Only accessed via a thread's instance of class RunnableInstance in that thread. Also refer to RunnableInstance. More...
 
class  DynExp::LinkedObjectWrapperPointer< ObjectT >
 This class describes a pointer to a LinkedObjectWrapper instance. It is a simple wrapper class which only adds specific behavior like always returning a const pointer to a LinkedObjectWrapper instance wrapping a const Object instance. More...
 
class  DynExp::LinkedObjectWrapperContainerBase
 Polymorphic base class to allow storing LinkedObjectWrapperContainer of any type in a single list. More...
 
class  DynExp::LinkedObjectWrapperContainer< ObjectT >
 This class holds a pointer (LinkedObjectWrapperPointer) to a LinkedObjectWrapper. Intances of this class should be owned by classes derived from class InstrumentDataBase or class ModuleDataBase. These instances provide access to objects referenced by object link parameters. LinkedObjectWrapperContainer does not own the referenced LinkedObjectWrapper. The LinkedObjectWrapper itself is owned by class RunnableInstance. The pointer hold here is also set and managed by class RunnableInstance. Also refer to class RunnableInstance. More...
 
class  DynExp::LinkedObjectWrapperContainerList< ObjectT >
 This class defines a list of LinkedObjectWrapperContainer instances. The list owns the contained LinkedObjectWrapperContainer instances. Intances of this class should be owned by classes derived from class InstrumentDataBase or class ModuleDataBase. These instances provide access to objects referenced by object link list parameters (ListParam). The list's entries are exclusively managed by the respective instance of class RunnableInstance. RunnableInstance stores references to list entries. Every list manipulation RunnableInstance is not aware of might cause dangling references! More...
 
class  DynExp::ObjectLinkBase
 Base class for object link parameter types to allow SFINAE in ParamsBase::Param for ObjectLink of any type. More...
 
class  DynExp::ObjectLink< ObjectT >
 Type to define object link parameters as ParamsBase::Param< ObjectLink< ObjectT > > or to define object link list parameters as ParamsBase::ListParam< ObjectLink< ObjectT > >. Such parameters own (one or multiple) ObjectLink instances and assign a resource to each instance. ObjectLink instances hold a std::weak_ptr to the resource and lock this weak_ptr if requested returning a respective LinkedObjectWrapper instance. A new resource can be assigned to an ObjectLink instance while LinkedObjectWrapper(s) exist since they hold an independent shared_ptr to the resource they have been created from. ObjectLink does not need to be thread-safe itself. All operations on it are performed through the respective ParamsBase::Param or ParamsBase::ListParam instance. To operate on those instances, the ParamsBase instance owning the respective parameter needs to be locked which renders ObjectLink implicitely thread-safe. More...
 
class  DynExp::RunnableInstance
 Defines data for a thread belonging to a RunnableObject instance. This data is only accessed by the RunnableObject instance's thread. So, no synchronization mechanism is needed. Furthermore, this class is designed to exist only on the stack. RunnableInstance instances are to be passed as a parameter to the respective thread functions. This ensures that a RunnableInstance instances is deleted when its thread function returns. This class is responsible for locking an object link (list) parameter (ParamsBase::Param< ObjectLink< ObjectT > > or ParamsBase::ListParam< ObjectLink< ObjectT > >) hold by a class derived (indirectly) from class ParamsBase and for storing the locked resource in a LinkedObjectWrapper instance. In turn, the created LinkedObjectWrapper instance is stored in a LinkedObjectWrapperContainer instance hold by a class derived (indirectly) from InstrumentDataBase or from ModuleDataBase. Furthermore, this class is responsible for unlocking LinkedObjectWrapper instances it created. Unlocking is triggered either on request or on destruction of the RunnableInstance instance owning the LinkedObjectWrapper instance. More...
 

Namespaces

 DynExp
 DynExp's main namespace contains the implementation of DynExp including classes to manage resources (DynExp objects like hardware adapters, instruments, and modules) as well as their dependencies and parameters.
 

Typedefs

using DynExp::ItemIDListType = std::vector< ItemIDType >
 Type of a list of IDs belonging to objects managed by DynExp. More...
 
template<typename ObjectType >
using DynExp::ManagerTypeOfObjectType_t = typename ManagerTypeOfObjectType< ObjectType >::type
 Alias for a resource manager type (derived from DynExp::CommonResourceManagerBase) managing resources of type ObjectType. More...
 
using DynExp::ParamsBasePtrType = std::unique_ptr< ParamsBase >
 Alias for a pointer to the parameter system base class ParamsBase. More...
 
using DynExp::ConfiguratorBasePtrType = std::shared_ptr< ConfiguratorBase >
 Alias for a pointer to the configurator base class ConfiguratorBase. More...
 

Functions

template<typename ParamType >
auto DynExp::operator== (const ParamsBase::TypedParamBase< ParamType > &lhs, const ParamType &rhs)
 Provides (in)equality comparison operators for two parameters. Since C++20, inequality operators (operator!=) are generated by compiler. More...
 
template<typename ParamType >
auto DynExp::operator<=> (const ParamsBase::TypedParamBase< ParamType > &lhs, const ParamType &rhs)
 Provides three-way comparison for two parameters. More...
 
template<typename ConfiguratorT >
ParamsBasePtrType DynExp::MakeParams (ItemIDType ID, const DynExpCore &Core)
 Factory function to generate an Object's parameters. More...
 
template<typename T >
T::ParamsType * DynExp::dynamic_Params_cast (ParamsBasePtrType::element_type *Params)
 Casts the parameter base class to a derived Object's parameter class. More...
 
template<typename To , typename From , std::enable_if_t< std::is_same_v< ParamsBase, std::remove_cv_t< From >>, int > = 0>
auto DynExp::dynamic_Params_cast (Util::SynchronizedPointer< From > &&ParamsPtr)
 Casts the parameter base class From to a derived Object's (To) parameter class keeping the parameters locked by Util::SynchronizedPointer for thread-safe casting. More...
 
template<typename To , typename From , std::enable_if_t< std::is_base_of_v< Object, To > &&std::is_base_of_v< Object, From >, int > = 0>
auto DynExp::dynamic_Object_cast (From *Obj)
 Casts an Object to a derived type. More...
 

Detailed Description

Implementation of DynExp objects as the base for derived resources and implementation of the object parameter system.

Definition in file Object.h.


Class Documentation

◆ DynExp::ManagerTypeOfObjectType

struct DynExp::ManagerTypeOfObjectType

template<typename ObjectType, std::enable_if_t< std::is_base_of_v< HardwareAdapterBase, ObjectType >||std::is_base_of_v< InstrumentBase, ObjectType >, int > = 0>
struct DynExp::ManagerTypeOfObjectType< ObjectType, >

Type trait relating a type ObjectType derived from either class HardwareAdapterBase or class InstrumentBase to the resource manager type (derived from DynExp::CommonResourceManagerBase) managing instances of the type ObjectType.

Template Parameters
ObjectTypeType to relate to a corresponding resource manager

Definition at line 54 of file Object.h.

Class Members
typedef conditional_t< is_base_of_v< HardwareAdapterBase, ObjectType >, HardwareAdapterManager, InstrumentManager > type Resource manager type managing instances of type ObjectType.

◆ DynExp::ParamsBase::dispatch_tag

struct DynExp::ParamsBase::dispatch_tag

template<typename>
struct DynExp::ParamsBase::dispatch_tag< typename >

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] -> ...

Template Parameters
Type(derived from class ParamsBase) to instantiate the dispatch tag template with.

Definition at line 349 of file Object.h.

◆ DynExp::ParamsBase::TextList

class DynExp::ParamsBase::TextList

Type to identify a text list parameter (one string selected from a list of strings)

Definition at line 369 of file Object.h.

◆ DynExp::ParamsBase::IndexedTextList

class DynExp::ParamsBase::IndexedTextList

Type to identify an indexed text list parameter (one number selected from a list of numbers associated with strings)

Definition at line 370 of file Object.h.

◆ DynExp::ParamsBase::OwnedParamInfo

struct DynExp::ParamsBase::OwnedParamInfo

Helper type owning a reference to a parameter and its class tag.

Definition at line 1690 of file Object.h.

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.

◆ DynExp::Object::dispatch_tag

struct DynExp::Object::dispatch_tag

template<typename>
struct DynExp::Object::dispatch_tag< typename >

Refer to ParamsBase::dispatch_tag.

Template Parameters
Type(derived from class Object) to instantiate the dispatch tag template with.

Definition at line 2018 of file Object.h.