|
DynExp
Highly flexible laboratory automation for dynamically changing experiments.
|
Type owning a callback function which is invoked when a task has finished, failed, or has been aborted. It is ensured that the callback function is invoked latest upon destruction of the respective CallbackType instance. A callback function can only be invoked once through a CallbackType instance.
More...
#include <Instrument.h>
Public Types | |
| using | FuncType = std::function< void(const TaskBase *, ExceptionContainer &)> |
Type of the owned callback function. The function receives a pointer to the task the CallbackType instance is owned by. If it has no owner, nullptr is passed. The second parameter is a reference to a wrapper holding an exception which might have occurred while executing the owning task. | |
Public Member Functions | |
| CallbackType () | |
Constructs a CallbackType instance with an empty CallbackFunc. | |
| CallbackType (std::nullptr_t) | |
Constructs a CallbackType instance with an empty CallbackFunc. | |
| CallbackType (FuncType &&CallbackFunc) | |
Constructs a CallbackType instance owning a callback function. | |
| CallbackType (CallbackType &&Other) | |
Copies CallbackFunc and HasBeenCalled from other and ensures that Other will never be invoked. | |
| ~CallbackType () | |
Calls operator()() passing nullptr to the first argument of FuncType. Swallows all exceptions possibly occuring during the execution of CallbackFunc. | |
| template<typename... ArgTs> | |
| void | operator() (ArgTs &&...Args) |
| Invokes CallbackFunc if it has not been invoked before. | |
| operator bool () const noexcept | |
| Returns false if CallbackFunc is empty, true otherwise. | |
Private Attributes | |
| const FuncType | CallbackFunc |
| Pointer to the owned callback function. | |
| bool | HasBeenCalled = false |
| Indicates whether CallbackFunc has been invoked already. | |
Type owning a callback function which is invoked when a task has finished, failed, or has been aborted. It is ensured that the callback function is invoked latest upon destruction of the respective CallbackType instance. A callback function can only be invoked once through a CallbackType instance.
Definition at line 977 of file Instrument.h.
| using DynExp::TaskBase::CallbackType::FuncType = std::function<void(const TaskBase*, ExceptionContainer&)> |
Type of the owned callback function. The function receives a pointer to the task the CallbackType instance is owned by. If it has no owner, nullptr is passed. The second parameter is a reference to a wrapper holding an exception which might have occurred while executing the owning task.
Definition at line 986 of file Instrument.h.
|
inline |
Constructs a CallbackType instance with an empty CallbackFunc.
Definition at line 991 of file Instrument.h.
|
inline |
Constructs a CallbackType instance with an empty CallbackFunc.
Definition at line 996 of file Instrument.h.
|
inline |
Constructs a CallbackType instance owning a callback function.
| CallbackFunc | Pointer to the callback function to take ownership of. |
Definition at line 1002 of file Instrument.h.
| DynExp::TaskBase::CallbackType::CallbackType | ( | CallbackType && | Other | ) |
Copies CallbackFunc and HasBeenCalled from other and ensures that Other will never be invoked.
| Other | CallbackType instance to move from. |
Definition at line 496 of file Instrument.cpp.
| DynExp::TaskBase::CallbackType::~CallbackType | ( | ) |
Calls operator()() passing nullptr to the first argument of FuncType. Swallows all exceptions possibly occuring during the execution of CallbackFunc.
Definition at line 502 of file Instrument.cpp.
|
inlinenoexcept |
Returns false if CallbackFunc is empty, true otherwise.
Definition at line 1036 of file Instrument.h.
|
inline |
Invokes CallbackFunc if it has not been invoked before.
| ...ArgTs | Types of arguments to pass to CallbackFunc. Refer to FuncType. |
| ...Args | Arguments to forward to CallbackFunc. |
Definition at line 1023 of file Instrument.h.
|
private |
Pointer to the owned callback function.
Definition at line 1039 of file Instrument.h.
|
private |
Indicates whether CallbackFunc has been invoked already.
Definition at line 1041 of file Instrument.h.