17 class EventListenersBase;
30 template <
typename ModuleT>
33 return std::make_shared<typename ModuleT::ConfigType>();
43 template <
typename ModuleT>
46 dynamic_Params_cast<ModuleT>(Params.get())->ModuleData = std::make_unique<typename ModuleT::ModuleDataType>();
48 return std::make_unique<ModuleT>(OwnerThreadID, std::move(Params));
93 template <
typename ReceiverType,
typename ArgTupleType>
101 template <
size_t... Indices>
124 template <
size_t... Indices>
139 using EventFuncType =
typename InstantiatedEventFuncTraitsType::EventFuncType;
352 virtual const char*
GetParamClassTag() const noexcept
override {
return "ModuleParamsBase"; }
427 template <
typename...>
468 constexpr
static auto Category() noexcept {
return ""; }
490 virtual bool HasUI() const noexcept {
return false; }
506 virtual std::chrono::milliseconds
GetMainLoopDelay()
const {
return std::chrono::milliseconds(10); }
578 template <
typename ReceiverType,
typename EventType,
typename... ArgsTs>
579 void MakeAndEnqueueEvent(ReceiverType* Receiver, EventType EventFuncPtr, ArgsTs&& ...Args)
const;
706 std::exception_ptr
GetExceptionChild([[maybe_unused]] const std::chrono::milliseconds
Timeout) const override final;
762 template <
typename ReceiverType,
typename... ArgsTs>
764 typename DefaultEvent<ReceiverType, std::tuple<std::remove_reference_t<ArgsTs>...>>::EventFuncPtrType EventFuncPtr,
776 return std::make_unique<DefaultEvent<ReceiverType, EventArgTs>>(EventFunc);
779 template <
typename ReceiverType,
typename EventType,
typename... ArgsTs>
782 if (Receiver !=
this)
783 throw Util::InvalidArgException(
"Receiver cannot point to a module different from the instance MakeAndEnqueueEvent() is called on.");
848 template <
typename To,
typename From, std::enable_if_t<
849 std::is_same_v<ModuleDataBase, std::remove_cv_t<From>>,
int> = 0
857 std::conditional_t<std::is_const_v<From>, std::add_const_t<typename To::ModuleDataType>,
typename To::ModuleDataType>
858 >(std::move(ModuleDataPtr));
889 template <
typename... EventFuncArgs>
913 template <
typename CallableT>
948 template <
typename CallableT>
952 (
dynamic_cast<std::add_const_t<typename Util::member_fn_ptr_traits<CallableT>::instance_type
>&>(Listener).*EventFunc)(Instance, Args...);
965 auto ListenerIt =
Listeners.find(&Listener);
982 auto ListenerIt =
Listeners.find(&Listener);
983 return ListenerIt !=
Listeners.cend() ? ListenerIt->second :
nullptr;
990 std::unordered_map<const ModuleBase*, EventFunctionType>
Listeners;
1009 template <
typename DerivedEvent,
typename... EventFuncArgs>
1027 template <
typename CallableT>
1070 template <
typename DerivedEvent,
typename... EventFuncArgs>
1160 virtual
void closeEvent(QCloseEvent* Event) override;
1202 virtual void closeEvent(QCloseEvent* Event)
override;
1211 virtual void keyPressEvent(QKeyEvent* Event)
override;
1273 : WindowPosX{
Owner, Prefix +
"WindowPosX" },
1274 WindowPosY{
Owner, Prefix +
"WindowPosY" },
1275 WindowWidth{
Owner, Prefix +
"WindowWidth" },
1276 WindowHeight{
Owner, Prefix +
"WindowHeight" },
1286 void ApplyTo(QWidget& Widget,
bool Show =
true)
const;
1292 void FromWidget(
const QWidget& Widget);
1358 bool HasUI() const noexcept override final {
return true; }
1387 void UpdateModuleWindowFocusAction();
1389 void DockWindow() noexcept;
1390 void UndockWindow() noexcept;
1391 void DockUndockWindow() noexcept;
1392 void SetFocus() noexcept;
1393 void FocusMainWindow() noexcept;
1400 void SendKeyPressEventToMainWindow(QKeyEvent* Event) noexcept;
1408 bool IsWindowDocked() noexcept;
1417 bool IsActiveWindow();
1443 template <typename SenderType, typename
SignalType, typename ReceiverType, typename EventType>
1444 void Connect(SenderType* Sender,
SignalType Signal, ReceiverType* Receiver, EventType Event);
1452 template <typename WidgetType>
1453 WidgetType* GetWidget() const;
1456 virtual
void RestoreWindowStatesFromParamsChild() override;
1457 virtual
void UpdateParamsFromWindowStatesChild() override;
1465 void SetWidgetProperties(QWidget* const WindowWidget) const;
1467 void ResetImpl(dispatch_tag<
ModuleBase>) override final;
1499 template <
typename SenderType,
typename SignalType,
typename ReceiverType,
typename EventType>
1502 EnsureCallFromOwningThread();
1504 if (!Sender || !Receiver)
1509 auto Connection = QObject::connect(Sender, Signal, [
this, Receiver, Event](
auto... Args) {
1512 MakeAndEnqueueEvent(Receiver, Event, std::move(Args)...);
1519 catch (
const std::exception& e)
1531 throw Util::InvalidArgException(
"QObject::connect() cannot establish a connection for the given sender and signal types.");
1534 template <
typename W
idgetType>
1545 return &
dynamic_cast<WidgetType&
>(*Widget);
Implementation of DynExp objects as the base for derived resources and implementation of the object p...
Implements DynExp's main window as a Qt-based user interface (UI).
Describes an event which consists of a receiver's member function and a set of arguments to call this...
decltype(DefaultEvent< ReceiverType, ArgTupleType >::MakeEventFuncTraits(std::declval< ArgTupleIndexSequenceType >())) InstantiatedEventFuncTraitsType
Type of the instantiated EventFuncTraits - not actually instantiating it.
DefaultEvent(EventFuncType EventFunc) noexcept
Constructs a DefaultEvent instance.
decltype(std::make_index_sequence< std::tuple_size_v< ArgTupleType > >()) ArgTupleIndexSequenceType
Index sequence for the (pseudo-)instantiation of EventFuncTraits.
virtual void InvokeChild(ModuleInstance &Instance) const override
Invokes the event passing the receiving module's instance reference to it.
const EventFuncType EventFunc
Util::CallableMemberWrapper to store the event receiver, the event function, and its arguments.
constexpr static auto MakeEventFuncTraits(std::index_sequence< Indices... >)
Instantiates EventFuncTraits. This function is not meant to be called. It is used for type deduction ...
typename InstantiatedEventFuncTraitsType::EventFuncPtrType EventFuncPtrType
Signature of an event function. Pointer to ModuleInstance to be passed as parameter instead of refere...
typename InstantiatedEventFuncTraitsType::EventFuncType EventFuncType
Type of a Util::CallableMemberWrapper to store the event.
DynExp's core class acts as the interface between the user interface and DynExp's internal data like ...
Common base class for all events to store them in a FIFO queue to be invoked later.
void Invoke(ModuleInstance &Instance) const
Invokes the event passing the receiving module's instance reference to it.
virtual void InvokeChild(ModuleInstance &Instance) const =0
Invokes the event passing the receiving module's instance reference to it.
Common base class for all managers of event listeners of type TypedEventListeners....
EventListenersBase()=default
virtual ~EventListenersBase()
virtual void Deregister(const ModuleBase &Listener, const std::chrono::milliseconds Timeout=std::chrono::milliseconds(0))=0
Deregisters/unsubscribes module Listener from the event. Indirectly calls ModuleBase::RemoveRegistere...
Common base class for all inter-module events.
InterModuleEventBase()=default
virtual ~InterModuleEventBase()=0
Typed base class for inter-module events to realize CRTP.
InterModuleEvent()=default
virtual void InvokeWithParamsChild(ModuleInstance &Instance, EventListenersType::EventFunctionType EventFunc) const =0
Called by InvokeChild(). Override to call EventFunc with Instance as the first argument and with furt...
virtual ~InterModuleEvent()
virtual void InvokeChild(ModuleInstance &Instance) const override final
Invokes the event passing the receiving module's instance reference to it.
static void Register(const ModuleBase &Listener, CallableT EventFunc)
Registers/Subscribes module Listener to the event with the event function EventFunc....
static void Deregister(const ModuleBase &Listener)
Deregisters/unsubscribes module Listener from the event. Indirectly calls ModuleBase::RemoveRegistere...
static EventListenersType Listeners
Holds one EventListenersType instance per derived event, which manages all the subscribers of Derived...
Allow exclusive access to some of ModuleBase's private methods to any TypedEventListeners class.
ModuleBase & Parent
Owning ModuleBase instance.
constexpr EventListenersOnlyType(ModuleBase &Parent) noexcept
Construcs an instance - one for each ModuleBase instance.
void AddRegisteredEvent(EventListenersBase &EventListeners) const
Adds a manager of event listeners to RegisteredEvents if it was not already added before....
void RemoveRegisteredEvent(EventListenersBase &EventListeners) const
Removes a manager of event listeners from RegisteredEvents if it was added before....
friend class TypedEventListeners
Allow exclusive access to some of ModuleBase's private methods to the module thread ModuleThreadMain(...
void OnPause(ModuleInstance &Instance)
ModuleBase & Parent
Owning ModuleBase instance.
Util::DynExpErrorCodes::DynExpErrorCodes ModuleMainLoop(ModuleInstance &Instance)
void OnError(ModuleInstance &Instance)
constexpr ModuleThreadOnlyType(ModuleBase &Parent) noexcept
Construcs an instance - one for each ModuleBase instance.
void SetReasonWhyPaused(std::string Description)
friend int ModuleThreadMain(ModuleInstance, ModuleBase *const)
Modules run in their own thread. This is the module thread's main function.
void HandleEvent(ModuleInstance &Instance)
void OnResume(ModuleInstance &Instance)
Base class for modules. Modules implement programs on their own (e.g. measurement protocols or server...
void TerminateChild(const std::chrono::milliseconds Timeout) override final
Signals derived classes that terminating the RunnableObject instance's thread is about to be requeste...
ModuleDataTypeSyncPtrType GetModuleData(const std::chrono::milliseconds Timeout=GetModuleDataTimeoutDefault)
Locks the mutex of the module data class instance ModuleData assigned to this ModuleBase instance and...
virtual void OnErrorChild(ModuleInstance &Instance) const
This handler gets called just before the module thread terminates due to an exception....
void OnPause(ModuleInstance &Instance)
This handler gets called just after the module pauses due to e.g. an error in an instrument the modul...
void NotifyChild() override final
Notify derived classes that some state has changed (e.g. the termination of Thread is requested) and ...
void RunChild() override final
Refer to Run().
void ModuleSetReasonWhyPaused(std::string Description)
Sets the reason why this ModuleBase instance has been paused.
void OnDeregisterEvents(ModuleInstance *Instance) const
This event is triggered after the OnExit event. It calls EventListenersBase::Deregister() for all man...
static auto GetExceptionUnsafe(const ModuleDataTypeSyncPtrConstType &ModuleDataPtr)
Getter for ModuleDataBase::ModuleException assuming that the module data has already been locked.
virtual void ResetImpl(dispatch_tag< ModuleBase >)=0
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every de...
virtual void OnInit(ModuleInstance *Instance) const
This event is triggered right before the module thread starts. Override it to lock instruments this m...
const std::unique_ptr< ModuleDataType > ModuleData
Module data belonging to this ModuleBase instance.
void ResetImpl(dispatch_tag< RunnableObject >) override final
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every de...
virtual void OnResumeChild(ModuleInstance &Instance) const
This handler gets called just after the module resumed from a paused state. Override OnResumeChild() ...
void UpdateParamsFromWindowStates()
UpdateParamsFromWindowStates() only calls UpdateParamsFromWindowStatesChild(). Override UpdateParamsF...
void MakeAndEnqueueEvent(ReceiverType *Receiver, EventType EventFuncPtr, ArgsTs &&...Args) const
Calls MakeEvent() to construct a new event and subsequently enqueues the event into the module's even...
virtual std::string GetCategory() const override
Returns the category of this Object type.
virtual void OnExit(ModuleInstance *Instance) const
This event is triggered right before the module thread terminates (not due to an exception,...
void EnqueueEvent(ModuleDataBase::EventPtrType &&Event) const
Enqueues Event at the module event queue's back. Takes ownership of the event. Notifies the module ow...
void RemoveRegisteredEvent(EventListenersBase &EventListeners)
Removes a manager of event listeners from RegisteredEvents if it was added before....
void HandleEvent(ModuleInstance &Instance)
Executes and removes the next pending event from the module's event queue.
ModuleBase(const std::thread::id OwnerThreadID, ParamsBasePtrType &&Params)
Constructs a ModuleBase instance.
virtual void RestoreWindowStatesFromParamsChild()
RestoreWindowStatesFromParams() only calls RestoreWindowStatesFromParamsChild(). Override RestoreWind...
Util::SynchronizedPointer< const ModuleDataType > ModuleDataTypeSyncPtrConstType
Alias for the return type of ModuleBase::GetModuleData() const. Data class instances wrapped into Uti...
void OnResume(ModuleInstance &Instance)
This handler gets called just after the module resumed from a paused state. Override OnResumeChild() ...
ModuleThreadOnlyType ModuleThreadOnly
Allow exclusive access to some of ModuleBase's private methods to the module thread ModuleThreadMain(...
Util::SynchronizedPointer< ModuleDataType > ModuleDataTypeSyncPtrType
Alias for the return type of ModuleBase::GetModuleData(). Data class instances wrapped into Util::Syn...
EventListenersOnlyType EventListenersOnly
Allow exclusive access to some of ModuleBase's private methods to any TypedEventListeners class.
std::unique_ptr< BusyDialog > MakeStartupBusyDialogChild(QWidget *ParentWidget) const override final
Override to make this function return a pointer to a BusyDialog instance. Refer to Run().
std::vector< EventListenersBase * > RegisteredEvents
Holds a list of pointers to managers of event listeners of the events this module has registered/subs...
void OnError(ModuleInstance &Instance)
This handler gets called just before the module thread terminates due to an exception....
constexpr static auto Category() noexcept
Every derived class has to redefine this function.
virtual Util::DynExpErrorCodes::DynExpErrorCodes ModuleMainLoop(ModuleInstance &Instance)=0
Module main loop. The function is executed periodically by the module thread. Also refer to GetMainLo...
void AddRegisteredEvent(EventListenersBase &EventListeners)
Adds a manager of event listeners to RegisteredEvents if it was not already added before....
virtual void UpdateParamsFromWindowStatesChild()
UpdateParamsFromWindowStates() only calls UpdateParamsFromWindowStatesChild(). Override UpdateParamsF...
std::exception_ptr GetExceptionChild([[maybe_unused]] const std::chrono::milliseconds Timeout) const override final
static constexpr auto GetModuleDataTimeoutDefault
Determines the default timeout for GetModuleData() to lock the mutex synchronizing the module's data ...
bool IsReadyChild() const override final
Returns wheter this Object instance is ready (e.g. it is running or connected to a hardware device) a...
virtual void OnPauseChild(ModuleInstance &Instance) const
This handler gets called just after the module pauses due to e.g. an error in an instrument the modul...
ModuleDataTypeSyncPtrType GetNonConstModuleData(const std::chrono::milliseconds Timeout=GetModuleDataTimeoutDefault) const
Always allows ModuleBase to obtain a non-const pointer to the module's data - even in const event fun...
virtual bool TreatModuleExceptionsAsWarnings() const
Determines whether this module should be terminated if an exception leaves the module's main loop or ...
void RestoreWindowStatesFromParams()
RestoreWindowStatesFromParams() only calls RestoreWindowStatesFromParamsChild(). Override RestoreWind...
virtual std::chrono::milliseconds GetMainLoopDelay() const
Specifies in which time intervals the module's event queue runs to handle pending events.
Util::DynExpErrorCodes::DynExpErrorCodes ExecModuleMainLoop(ModuleInstance &Instance)
Runs ModuleMainLoop().
virtual bool HasUI() const noexcept
Determines whether this module possesses a user interface (UI) which is shown in a window dedicated t...
Configurator class for ModuleBase.
virtual ~ModuleConfiguratorBase()=0
ModuleConfiguratorBase()=default
Allow exclusive access to some of ModuleDataBase's private methods to ModuleBase.
ModuleDataBase & Parent
Owning ModuleDataBase instance.
auto & GetNewEventNotifier() noexcept
Getter for NewEventNotifier.
void Reset()
Resets the ModuleDataBase's instance and calls ResetImpl(dispatch_tag<ModuleDataBase>) subsequently.
constexpr ModuleBaseOnlyType(ModuleDataBase &Parent) noexcept
Construcs an instance - one for each ModuleDataBase instance.
Allow exclusive access to some of ModuleDataBase's private methods to the module thread ModuleThreadM...
auto & GetNewEventNotifier() noexcept
Getter for NewEventNotifier.
ModuleDataBase & Parent
Owning ModuleDataBase instance.
constexpr ModuleThreadOnlyType(ModuleDataBase &Parent) noexcept
Construcs an instance - one for each ModuleDataBase instance.
void SetException(std::exception_ptr ModuleException) noexcept
Setter for ModuleDataBase::ModuleException.
friend int ModuleThreadMain(ModuleInstance, ModuleBase *const)
Modules run in their own thread. This is the module thread's main function.
Data structure to contain data which is synchronized in between different threads....
ModuleThreadOnlyType ModuleThreadOnly
Allow exclusive access to some of ModuleDataBase's private methods to the module thread ModuleThreadM...
virtual ~ModuleDataBase()
std::exception_ptr ModuleException
Used to transfer exceptions from the module thread to the main (user interface) thread....
Util::OneToOneNotifier NewEventNotifier
Notifies the thread of the module which owns the respective ModuleDataBase's instance when an event h...
std::queue< EventPtrType > EventQueueType
A module's event queue is a FIFO queue owning the enqueued events.
const auto & GetEventFront() const noexcept
Returns a pointer to the event in the front of the module's event queue without transferring ownershi...
std::unique_ptr< EventBase > EventPtrType
Pointer owning an event.
Util::OneToOneNotifier & GetNewEventNotifier() noexcept
Getter for NewEventNotifier.
auto & GetEventFront() noexcept
Returns a pointer to the event in the front of the module's event queue without transferring ownershi...
void Reset()
Resets the ModuleDataBase's instance and calls ResetImpl(dispatch_tag<ModuleDataBase>) subsequently.
size_t GetNumEnqueuedEvents() const noexcept
Getter for the module event queue's length.
auto GetException() const noexcept
Getter for ModuleException.
void EnqueueEvent(EventPtrType &&Event)
Enqueues Event at the module event queue's back. Takes ownership of the event. Notifies the module ow...
EventQueueType EventQueue
FIFO event queue of the module which owns the respective ModuleDataBase's instance.
virtual void ResetImpl(dispatch_tag< ModuleDataBase >)
Refer to DynExp::ModuleDataBase::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of ...
EventPtrType PopEvent()
Removes one event from the event queue's front and returns the event. Ownership of the event is trans...
ModuleBaseOnlyType ModuleBaseOnly
Allow exclusive access to some of ModuleDataBase's private methods to ModuleBase.
Refer to ParamsBase::dispatch_tag.
Defines data for a thread belonging to a ModuleBase instance. Refer to RunnableInstance.
void Exit() noexcept
Might be called from anywhere where this ModuleInstance instance is accessible to make the associated...
const ModuleBase::ModuleDataGetterType ModuleDataGetter
Getter for module's data. Refer to ModuleBase::ModuleDataGetterType.
bool IsExiting() const noexcept
Getter for ShouldExit.
~ModuleInstance()=default
ModuleInstance(ModuleBase &Owner, std::promise< void > &&ThreadExitedPromise, const ModuleBase::ModuleDataGetterType ModuleDataGetter)
Constructs a non-empty RunnableInstance instance.
bool ShouldExit
Indicates whether the module thread using this ModuleInstance instance should terminate.
Parameter class for ModuleBase.
std::unique_ptr< ModuleDataBase > ModuleData
Just used temporarily during the construction of a module. Refer to MakeModule() and ModuleBase::Modu...
DummyParam Dummy
Dummy parameter which is to be owned once by parameter classes that do not contain any other paramete...
bool ConfigureUsageTypeChild() const noexcept override final
Determines whether the Usage parameter should be configurable in the settings dialog....
void ConfigureParamsImpl(dispatch_tag< RunnableObjectParams >) override final
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to...
friend ModulePtrType MakeModule(const std::thread::id, ParamsBasePtrType &&)
Factory function to generate a module of a specific type.
virtual void ConfigureParamsImpl(dispatch_tag< ModuleParamsBase >)
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to...
virtual ~ModuleParamsBase()=0
ModuleParamsBase(ItemIDType ID, const DynExpCore &Core)
Constructs the parameters for a ModuleBase instance.
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...
const std::thread::id OwnerThreadID
Thread id of the thread which has constructed (and owns) this Object instance.
const ParamsBasePtrType Params
Pointer to the parameter class instance belonging to this Object instance.
Refer to ParamsBase::dispatch_tag.
Dummy parameter which is to be owned once by parameter classes that do not contain any other paramete...
Abstract base class for object parameter classes. Each class derived from class Object must be accomp...
const ItemIDType ID
ID of the Object this parameter class instance belongs to.
const DynExpCore & Core
Reference to DynExp's core.
Tag for function dispatching mechanism within this class used when derived classes are not intended t...
Base class for modules with a Qt-based user interface. Derive from this class to implement modules wi...
WidgetType * GetWidget() const
Getter for Widget.
QModuleWidget * Widget
User interface widget belonging to the module.
void Connect(SenderType *Sender, SignalType Signal, ReceiverType *Receiver, EventType Event)
Uses Qt's connect mechanism to connect a QObject's signal to a DynExp module's event....
bool HasUI() const noexcept override final
Determines whether this module possesses a user interface (UI) which is shown in a window dedicated t...
QMdiArea * MdiArea
Pointer to DynExpManager's QMdiArea.
std::unique_ptr< QModuleDockWidget > DockWidget
Frame for Widget when the module window is undocked from MdiArea.
std::unique_ptr< QMdiSubWindow > MdiSubWindow
Frame for Widget when the module window is docked to MdiArea.
std::unique_ptr< QAction > ModuleWindowFocusAction
Qt action to push module window into focus. When triggered, QModuleWidget::OnFocusWindow() in invoked...
Configurator class for QModuleBase.
QModuleConfiguratorBase()=default
Data class for QModuleBase.
virtual ~QModuleDataBase()=default
virtual void ResetImpl(dispatch_tag< QModuleDataBase >)
QModuleDataBase()=default
Parameter class for QModuleBase.
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...
virtual void ConfigureParamsImpl(dispatch_tag< QModuleParamsBase >)
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to...
WindowStyleParamsExtension WindowStyleParams
Bundles several parameters to describe a UI window's style. Use in parameter classes.
void ConfigureParamsImpl(dispatch_tag< ModuleParamsBase >) override final
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to...
QModuleParamsBase(ItemIDType ID, const DynExpCore &Core)
Constructs the parameters for a QModuleBase instance.
Defines data for a thread belonging to a RunnableObject instance. This data is only accessed by the R...
const RunnableObject & Owner
RunnableObject instance which operates on this RunnableInstance (by its thread). The RunnableObject i...
std::promise< void > ThreadExitedPromise
Signals the RunnableObject instance owning the thread that its thread has terminated....
Configurator class for RunnableObject.
Parameter class for RunnableObject.
Defines an Object which possesses a thread it runs in. The RunnableObject can be started and stopped ...
void SetReasonWhyPaused(std::string Description)
Sets the reason why this RunnableObject instance has been paused.
Typed managers of event listeners class whose instances are owned by classes derived from InterModule...
void DeregisterUnsafe(const ModuleBase &Listener)
This function is the version of Deregister() which is not thread-safe (assuming EventListenersBase's ...
virtual ~TypedEventListeners()=default
std::unordered_map< const ModuleBase *, EventFunctionType > Listeners
Each module can register to each inter-module event with one event function of type EventFunctionType...
void RegisterUnsafe(const ModuleBase &Listener, CallableT EventFunc)
This function is the version of Register() which is not thread-safe (assuming EventListenersBase's mu...
EventFunctionType GetFunc(const ModuleBase &Listener, const std::chrono::milliseconds Timeout=DefaultTimeout) const
Looks up the event function the module Listener has registered/subscribed with.
EventFunctionType GetFuncUnsafe(const ModuleBase &Listener) const
This function is the version of GetFunc() which is not thread-safe (assuming EventListenersBase's mut...
virtual void Deregister(const ModuleBase &Listener, const std::chrono::milliseconds Timeout=std::chrono::milliseconds(0)) override
Deregisters/unsubscribes module Listener from the event. Indirectly calls ModuleBase::RemoveRegistere...
TypedEventListeners()=default
void Register(const ModuleBase &Listener, CallableT EventFunc, const std::chrono::milliseconds Timeout=std::chrono::milliseconds(0))
Registers/Subscribes module Listener to the event with the event function EventFunc....
std::function< void(ModuleInstance *, EventFuncArgs...)> EventFunctionType
Type of event functions to be invoked when the event is triggered. The first ModuleInstance argument ...
Bundles several parameters to describe a UI window's style. Use in parameter classes.
WindowStyleParamsExtension(ParamsBase &Owner, const std::string &Prefix="")
Constructs a WindowStyleParamsExtension instance.
WindowDockingStateType
Indicates the window docking state.
ParamsBase::Param< unsigned int > WindowWidth
Window width.
ParamsBase::Param< int > WindowPosY
Window y coordinate.
WindowStateType
Indicates the window state for showing it.
ParamsBase::Param< WindowDockingStateType > WindowDockingState
Window docking state.
ParamsBase::Param< int > WindowPosX
Window x coordinate.
ParamsBase::Param< WindowStateType > WindowState
Window show state.
ParamsBase::Param< unsigned int > WindowHeight
Window height.
Wraps a member function of some object and stores its default arguments. Moving from CallableMemberWr...
void Log(const std::string &Message, const ErrorType Type=ErrorType::Info, const size_t Line=0, const std::string &Function="", const std::string &File="", const int ErrorCode=0, const std::stacktrace &Trace={}) noexcept
Logs an event from information specified manually.
DynExp exceptions are derived from this class. It contains basic information about the cause of the e...
Interface to allow synchronizing the access to derived classes between different threads by providing...
LockType AcquireLock(const std::chrono::milliseconds Timeout=DefaultTimeout) const
Locks the internal mutex. Blocks until the mutex is locked or until the timeout duration is exceeded.
static constexpr std::chrono::milliseconds DefaultTimeout
Duration which is used as a default timeout within all methods of this class if no different duration...
Interface to allow synchronizing the access to derived classes between different threads by making th...
An invalid argument like a null pointer has been passed to a function.
An operation cannot be performed currently since the related object is in an invalid state like an er...
Helper class to communicate flags between different threads based on a condition variable and a mutex...
Pointer to lock a class derived from ISynchronizedPointerLockable for synchronizing between threads....
SignalType
Type specifying different signal coordinates a lock-in amplifier can record. Not a strongly-typed enu...
DynExp's module namespace contains the implementation of DynExp modules which extend DynExp's core fu...
DynExp's main namespace contains the implementation of DynExp including classes to manage resources (...
ConfiguratorBasePtrType MakeModuleConfig()
Factory function to generate a configurator for a specific module type.
ModulePtrType MakeModule(const std::thread::id OwnerThreadID, ParamsBasePtrType &&Params)
Factory function to generate a module of a specific type.
std::unique_ptr< ParamsBase > ParamsBasePtrType
Alias for a pointer to the parameter system base class ParamsBase.
size_t ItemIDType
ID type of objects/items managed by DynExp.
auto dynamic_ModuleData_cast(Util::SynchronizedPointer< From > &&ModuleDataPtr)
Casts the data base class From into a derived ModuleBase's (To) data class keeping the data locked by...
auto MakeEvent(ReceiverType *Receiver, typename DefaultEvent< ReceiverType, std::tuple< std::remove_reference_t< ArgsTs >... >>::EventFuncPtrType EventFuncPtr, ArgsTs &&...Args)
Creates an event of type DefaultEvent.
std::unique_ptr< ModuleBase > ModulePtrType
Pointer type to store a module (DynExp::ModuleBase) with.
int ModuleThreadMain(ModuleInstance Instance, ModuleBase *const Module)
Modules run in their own thread. This is the module thread's main function.
std::shared_ptr< ConfiguratorBase > ConfiguratorBasePtrType
Alias for a pointer to the configurator base class ConfiguratorBase.
DynExpErrorCodes
DynExp's error codes
typename remove_first_from_tuple< TupleT >::type remove_first_from_tuple_t
Alias for a tuple of types where the first type of the input tuple TupleT is removed.
EventLogger & EventLog()
This function holds a static EventLogger instance and returns a reference to it. DynExp uses only one...
typename member_fn_ptr_traits< CallableT >::argument_types argument_of_t
Alias for a tuple of argument types the member function callable of type CallableT expects.
Accumulates include statements to provide a precompiled header.
Helper struct to allow accessing elements within ArgTupleType.
constexpr EventFuncTraits()=default
void(ReceiverType::*)(ModuleInstance *, std::tuple_element_t< Indices, ArgTupleType >...) const EventFuncPtrType
Signature of an event function. Pointer to ModuleInstance to be passed as parameter instead of refere...