DynExp
Highly flexible laboratory automation for dynamically changing experiments.
Loading...
Searching...
No Matches
CommonModuleEvents.h
Go to the documentation of this file.
1// This file is part of DynExp.
2
9#pragma once
10
11#include "stdafx.h"
12#include "Module.h"
13
14namespace DynExpModule
15{
20 class FinishedEvent : public DynExp::InterModuleEvent<FinishedEvent>
21 {
22 public:
26 FinishedEvent() = default;
27
33
34 virtual ~FinishedEvent() {}
35
36 virtual std::string GetName() const override { return "Finished"; }
37
38 private:
42 virtual void InvokeWithParamsChild(DynExp::ModuleInstance& Instance, EventListenersType::EventFunctionType EventFunc) const override;
43 };
44
48 class SetFilenameEvent : public DynExp::InterModuleEvent<SetFilenameEvent, std::string>
49 {
50 public:
55 SetFilenameEvent(const std::string& Filename = "unknown") : Filename(Filename) {}
56
62
63 virtual ~SetFilenameEvent() {}
64
65 virtual std::string GetName() const override { return "Set filename to \"unknown.<ext>\"."; }
66
67 private:
71 virtual void InvokeWithParamsChild(DynExp::ModuleInstance& Instance, EventListenersType::EventFunctionType EventFunc) const override;
72
77 const std::string Filename;
78 };
79
85 class StartEvent : public DynExp::InterModuleEvent<StartEvent>
86 {
87 public:
91 StartEvent() = default;
92
98
99 virtual ~StartEvent() {}
100
101 virtual std::string GetName() const override { return "Start"; }
102
103 private:
107 virtual void InvokeWithParamsChild(DynExp::ModuleInstance& Instance, EventListenersType::EventFunctionType EventFunc) const override;
108 };
109
114 class StopEvent : public DynExp::InterModuleEvent<StopEvent>
115 {
116 public:
120 StopEvent() = default;
121
127
128 virtual ~StopEvent() {}
129
130 virtual std::string GetName() const override { return "Stop"; }
131
132 private:
136 virtual void InvokeWithParamsChild(DynExp::ModuleInstance& Instance, EventListenersType::EventFunctionType EventFunc) const override;
137 };
138
143 class TriggerEvent : public DynExp::InterModuleEvent<TriggerEvent>
144 {
145 public:
149 TriggerEvent() = default;
150
156
157 virtual ~TriggerEvent() {}
158
159 virtual std::string GetName() const override { return "Trigger"; }
160
161 private:
165 virtual void InvokeWithParamsChild(DynExp::ModuleInstance& Instance, EventListenersType::EventFunctionType EventFunc) const override;
166 };
167}
Implementation of DynExp module objects.
This event signals that an action (like a measurement) started by a TriggerEvent has been completed.
FinishedEvent(const FinishedEvent &Other, DynExp::ItemIDType CommunicatorID)
FinishedEvent()=default
Constructs an inter-module event.
virtual void InvokeWithParamsChild(DynExp::ModuleInstance &Instance, EventListenersType::EventFunctionType EventFunc) const override
Called by InvokeChild(). Override to call EventFunc with Instance as the first argument and with furt...
virtual std::string GetName() const override
Returns the name of this event type.
This event tells the receiver where to store e.g. acquired data.
SetFilenameEvent(const SetFilenameEvent &Other, DynExp::ItemIDType CommunicatorID)
virtual void InvokeWithParamsChild(DynExp::ModuleInstance &Instance, EventListenersType::EventFunctionType EventFunc) const override
Called by InvokeChild(). Override to call EventFunc with Instance as the first argument and with furt...
SetFilenameEvent(const std::string &Filename="unknown")
Constructs a SetFilenameEvent event.
virtual std::string GetName() const override
Returns the name of this event type.
const std::string Filename
Filename where to store data (path and name, no file extension). The receiving module is responsible ...
This event is intended to make the receiver prepare an action (like a measurement) that is started wh...
StartEvent()=default
Constructs an inter-module event.
virtual void InvokeWithParamsChild(DynExp::ModuleInstance &Instance, EventListenersType::EventFunctionType EventFunc) const override
Called by InvokeChild(). Override to call EventFunc with Instance as the first argument and with furt...
StartEvent(const StartEvent &Other, DynExp::ItemIDType CommunicatorID)
virtual std::string GetName() const override
Returns the name of this event type.
This event is intended to make the receiver stop an action (like a measurement).
virtual void InvokeWithParamsChild(DynExp::ModuleInstance &Instance, EventListenersType::EventFunctionType EventFunc) const override
Called by InvokeChild(). Override to call EventFunc with Instance as the first argument and with furt...
virtual std::string GetName() const override
Returns the name of this event type.
StopEvent()=default
Constructs an inter-module event.
StopEvent(const StopEvent &Other, DynExp::ItemIDType CommunicatorID)
This event is intended to make the receiver start an action (like a measurement) after it received a ...
virtual std::string GetName() const override
Returns the name of this event type.
virtual void InvokeWithParamsChild(DynExp::ModuleInstance &Instance, EventListenersType::EventFunctionType EventFunc) const override
Called by InvokeChild(). Override to call EventFunc with Instance as the first argument and with furt...
TriggerEvent(const TriggerEvent &Other, DynExp::ItemIDType CommunicatorID)
TriggerEvent()=default
Constructs an inter-module event.
const ItemIDType CommunicatorID
ID of the DynExpInstr::InterModuleCommunicator instance that sends the event.
Definition Module.h:1200
Typed base class for inter-module events to realize CRTP.
Definition Module.h:1211
InterModuleEvent()=default
Constructs an inter-module event.
Defines data for a thread belonging to a ModuleBase instance. Refer to RunnableInstance.
Definition Module.h:840
std::function< void(ModuleInstance *, EventFuncArgs...)> EventFunctionType
Type of event functions to be invoked when the event is triggered. The first ModuleInstance argument ...
Definition Module.h:1008
DynExp's module namespace contains the implementation of DynExp modules which extend DynExp's core fu...
size_t ItemIDType
ID type of objects/items managed by DynExp.
Accumulates include statements to provide a precompiled header.