QSequentialTaskTreeRunner Class
A sequential task tree execution controller. More...
| Header: | #include <qtasktreerunner.h> |
| Inherits: | QAbstractTaskTreeRunner |
Public Functions
| QSequentialTaskTreeRunner(QObject *parent = nullptr) | |
| virtual | ~QSequentialTaskTreeRunner() |
| void | cancelCurrent() |
| void | enqueue(const QtTaskTree::Group &recipe, SetupHandler &&setupHandler = {}, DoneHandler &&doneHandler = {}, QtTaskTree::CallDoneFlags callDone = QtTaskTree::CallDone::Always) |
| void | resetCurrent() |
Reimplemented Public Functions
| virtual void | cancel() override |
| virtual bool | isRunning() const override |
| virtual void | reset() override |
Detailed Description
Manages sequential task tree execution. Use the enqueue() method to schedule the execution of a given recipe. It's guaranteed that at most one task tree is executing at any given time.
Member Function Documentation
QSequentialTaskTreeRunner::QSequentialTaskTreeRunner(QObject *parent = nullptr)
Constructs a sequential task tree runner for the given parent.
[virtual noexcept] QSequentialTaskTreeRunner::~QSequentialTaskTreeRunner()
Destroys the sequential task tree runner. A possibly running task tree is deleted and enqueued tasks are removed. No task tree's done handler is called nor done() signal is emitted.
See also ~QTaskTree().
[override virtual] void QSequentialTaskTreeRunner::cancel()
Reimplements: QAbstractTaskTreeRunner::cancel().
Cancels the running task tree. Calls task tree' done handler and emits done() signal with DoneWith::Cancel. All queued tasks are removed.
void QSequentialTaskTreeRunner::cancelCurrent()
Cancels the running task tree. Calls task tree' done handler and emits done() signal with DoneWith::Cancel. If there are any enqueued recipes, the dequeued recipe is started.
template <typename SetupHandler = QAbstractTaskTreeRunner::TreeSetupHandler, typename DoneHandler = QAbstractTaskTreeRunner::TreeDoneHandler> void QSequentialTaskTreeRunner::enqueue(const QtTaskTree::Group &recipe, SetupHandler &&setupHandler = {}, DoneHandler &&doneHandler = {}, QtTaskTree::CallDoneFlags callDone = QtTaskTree::CallDone::Always)
Schedules the recipe execution. If no task tree is executing, the runner starts a new task tree synchronously, otherwise the recipe is enqueued. When the currently executing task tree finished, the runner starts a new task tree with a dequeued recipe. Calls setupHandler when new task tree is about to be started. Calls doneHandler when the task tree is finished. The doneHandler is called according to the passed callDone.
[override virtual] bool QSequentialTaskTreeRunner::isRunning() const
Reimplements: QAbstractTaskTreeRunner::isRunning() const.
Returns whether the sequential task tree runner is currently executing a task tree.
[override virtual] void QSequentialTaskTreeRunner::reset()
Reimplements: QAbstractTaskTreeRunner::reset().
Resets the running task tree. No task tree's done handler is called nor done() signal is emitted. All queued tasks are removed.
void QSequentialTaskTreeRunner::resetCurrent()
Resets the running task tree. No task tree's done handler is called nor done() signal is emitted. If there are any enqueued recipes, the dequeued recipe is started.