![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution More...
#include <tasktree.h>
Public Member Functions | |
Group | withTimeout (std::chrono::milliseconds timeout, const std::function< void()> &handler={}) const |
Attaches TimeoutTask to a copy of this ExecutableItem, elapsing after timeout in milliseconds, with an optionally provided timeout handler, and returns the coupled item. | |
Group | withLog (const QString &logName) const |
Attaches a custom debug printout to a copy of this ExecutableItem, issued on task startup and after the task is finished, and returns the coupled item. | |
template<typename SenderSignalPairGetter> | |
Group | withCancel (SenderSignalPairGetter &&getter, std::initializer_list< GroupItem > postCancelRecipe={}) const |
template<typename SenderSignalPairGetter> | |
Group | withAccept (SenderSignalPairGetter &&getter) const |
Public Member Functions inherited from Tasking::GroupItem | |
template<typename StorageStruct> | |
GroupItem (const Storage< StorageStruct > &storage) | |
Constructs a GroupItem element holding the storage object. | |
GroupItem (const GroupItems &children) | |
Constructs a GroupItem element with a given list of items. | |
GroupItem (std::initializer_list< GroupItem > children) |
Protected Member Functions | |
ExecutableItem ()=default | |
ExecutableItem (const TaskHandler &handler) | |
Protected Member Functions inherited from Tasking::GroupItem | |
GroupItem (const Loop &loop) | |
GroupItem ()=default | |
GroupItem (Type type) | |
GroupItem (const GroupData &data) | |
GroupItem (const TaskHandler &handler) | |
void | addChildren (const GroupItems &children) |
Friends | |
TASKING_EXPORT friend Group | operator! (const ExecutableItem &item) |
Returns a Group with the DoneResult of item negated. | |
TASKING_EXPORT friend Group | operator&& (const ExecutableItem &first, const ExecutableItem &second) |
Returns a Group with first and second tasks merged with conjunction. | |
TASKING_EXPORT friend Group | operator|| (const ExecutableItem &first, const ExecutableItem &second) |
Returns a Group with first and second tasks merged with disjunction. | |
TASKING_EXPORT friend Group | operator&& (const ExecutableItem &item, DoneResult result) |
TASKING_EXPORT friend Group | operator|| (const ExecutableItem &item, DoneResult result) |
Additional Inherited Members | |
Public Types inherited from Tasking::GroupItem | |
using | GroupSetupHandler = std::function<SetupResult()> |
using | GroupDoneHandler = std::function<DoneResult(DoneWith)> |
Protected Types inherited from Tasking::GroupItem | |
enum class | Type { List , Group , GroupData , Storage , TaskHandler } |
using | InterfaceCreateHandler = std::function<TaskInterface *(void)> |
using | InterfaceSetupHandler = std::function<SetupResult(TaskInterface &)> |
using | InterfaceDoneHandler = std::function<DoneResult(const TaskInterface &, DoneWith)> |
Static Protected Member Functions inherited from Tasking::GroupItem | |
static GroupItem | groupHandler (const GroupHandler &handler) |
template<typename Result, typename Function, typename ... Args, typename DecayedFunction = std::decay_t<Function>> | |
static constexpr bool | isInvocable () |
\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution
Base class for executable task items. \reentrant
ExecutableItem
provides an additional interface for items containing executable tasks. Use withTimeout() to attach a timeout to a task. Use withLog() to include debugging information about the task startup and the execution result.
Definition at line 316 of file tasktree.h.
|
protecteddefault |
|
inlineprotected |
Definition at line 329 of file tasktree.h.
References Tasking::GroupItem::GroupItem().
Group Tasking::ExecutableItem::withAccept | ( | SenderSignalPairGetter && | getter | ) | const |
Definition at line 429 of file tasktree.h.
Group Tasking::ExecutableItem::withCancel | ( | SenderSignalPairGetter && | getter, |
std::initializer_list< GroupItem > | postCancelRecipe = {} ) const |
Definition at line 416 of file tasktree.h.
Attaches a custom debug printout to a copy of this
ExecutableItem, issued on task startup and after the task is finished, and returns the coupled item.
The debug printout includes a timestamp of the event (start or finish) and logName to identify the specific task in the debug log.
The finish printout contains the additional information whether the execution was synchronous or asynchronous, its result (the value described by the DoneWith enum), and the total execution time in milliseconds.
Definition at line 1596 of file tasktree.cpp.
References Tasking::activeTaskTree(), Tasking::TaskTree::asyncCount(), and Tasking::StorageBase::Storage.
Group Tasking::ExecutableItem::withTimeout | ( | std::chrono::milliseconds | timeout, |
const std::function< void()> & | handler = {} ) const |
Attaches TimeoutTask
to a copy of this
ExecutableItem, elapsing after timeout in milliseconds, with an optionally provided timeout handler, and returns the coupled item.
When the ExecutableItem finishes before timeout passes, the returned item finishes immediately with the task's result. Otherwise, handler is invoked (if provided), the task is canceled, and the returned item finishes with an error.
Definition at line 1562 of file tasktree.cpp.
References Tasking::finishAllAndError, Tasking::parallel, Tasking::stopOnSuccessOrError, and Tasking::Success.
|
friend |
Returns a Group with the DoneResult of item negated.
If item reports DoneResult::Success, the returned item reports DoneResult::Error. If item reports DoneResult::Error, the returned item reports DoneResult::Success.
The returned item is equivalent to:
Definition at line 1644 of file tasktree.cpp.
References Tasking::Error, and Tasking::toDoneResult().
|
friend |
Returns a Group with first and second tasks merged with conjunction.
Both first and second tasks execute in sequence. If both tasks report DoneResult::Success, the returned item reports DoneResult::Success. Otherwise, the returned item reports DoneResult::Error.
The returned item is \l {https://en.wikipedia.org/wiki/Short-circuit_evaluation}{short-circuiting}: if the first task reports DoneResult::Error, the second task is skipped, and the returned item reports DoneResult::Error immediately.
The returned item is equivalent to:
{Group
{ parallel, stopOnError, first, second }}. In this case: if the {first finished} task reports DoneResult::Error, the other task is canceled, and the group reports DoneResult::Error immediately.Definition at line 1678 of file tasktree.cpp.
References Tasking::stopOnError.
|
friend |
Definition at line 1724 of file tasktree.cpp.
References Tasking::finishAllAndError, Tasking::stopOnError, and Tasking::Success.
|
friend |
Returns a Group with first and second tasks merged with disjunction.
Both first and second tasks execute in sequence. If both tasks report DoneResult::Error, the returned item reports DoneResult::Error. Otherwise, the returned item reports DoneResult::Success.
The returned item is \l {https://en.wikipedia.org/wiki/Short-circuit_evaluation}{short-circuiting}: if the first task reports DoneResult::Success, the second task is skipped, and the returned item reports DoneResult::Success immediately.
The returned item is equivalent to:
{Group
{ parallel, stopOnSuccess, first, second }}. In this case: if the {first finished} task reports DoneResult::Success, the other task is canceled, and the group reports DoneResult::Success immediately.Definition at line 1709 of file tasktree.cpp.
References Tasking::stopOnSuccess.
|
friend |
Definition at line 1739 of file tasktree.cpp.
References Tasking::Error, Tasking::finishAllAndSuccess, and Tasking::stopOnError.