![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inmodule TaskingSolution More...
Classes | |
class | Barrier |
class | ConcurrentCall |
class | ConcurrentCallTaskAdapter |
class | ConditionData |
class | ContainerNode |
class | CustomTask |
\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution More... | |
class | Do |
class | Else |
class | ElseIf |
class | ElseIfItem |
class | ElseItem |
class | ExecutableItem |
\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution More... | |
class | ExecutionContextActivator |
class | For |
class | Forever |
class | Group |
\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution More... | |
class | GroupItem |
\typealias Tasking::GroupItems More... | |
class | Guard |
class | GuardLocker |
class | If |
class | Loop |
class | LoopData |
class | LoopForever |
class | LoopList |
class | LoopRepeat |
class | LoopThreadData |
class | LoopUntil |
class | NetworkQuery |
class | RuntimeContainer |
class | RuntimeIteration |
class | RuntimeTask |
class | SharedBarrier |
class | SimpleTaskAdapter |
class | Storage |
\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution More... | |
class | StorageBase |
class | StorageData |
class | StorageThreadData |
class | Sync |
\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution More... | |
class | TaskAdapter |
\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution More... | |
class | TaskInterface |
\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution More... | |
class | TaskNode |
class | TaskTree |
\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution More... | |
class | TaskTreePrivate |
class | TaskTreeRunner |
class | TaskTreeTaskAdapter |
class | TcpSocket |
class | Then |
class | ThenItem |
class | TimeoutTaskAdapter |
struct | TimerData |
struct | TimerThreadData |
class | When |
Typedefs | |
template<typename T> | |
using | ConcurrentCallTask = CustomTask<ConcurrentCallTaskAdapter<T>> |
using | BarrierTask = SimpleCustomTask<Barrier> |
template<int Limit = 1> | |
using | MultiBarrier = Storage<SharedBarrier<Limit>> |
using | SingleBarrier = MultiBarrier<1> |
using | BarrierKickerGetter = std::function<ExecutableItem(const SingleBarrier &)> |
using | NetworkQueryTask = SimpleCustomTask<NetworkQuery> |
using | StoragePtr = void * |
using | TimeoutCallback = std::function<void()> |
using | GroupItems = QList<GroupItem> |
template<typename Task> | |
using | SimpleCustomTask = CustomTask<SimpleTaskAdapter<Task>> |
using | TaskTreeTask = CustomTask<TaskTreeTaskAdapter> |
using | TimeoutTask = CustomTask<TimeoutTaskAdapter> |
using | TcpSocketTask = SimpleCustomTask<TcpSocket> |
Enumerations | |
enum class | NetworkOperation { Get , Put , Post , Delete } |
enum class | WorkflowPolicy { StopOnError , ContinueOnError , StopOnSuccess , ContinueOnSuccess , StopOnSuccessOrError , FinishAllAndSuccess , FinishAllAndError } |
enum class | SetupResult { Continue , StopWithSuccess , StopWithError } |
enum class | DoneResult { Success , Error } |
enum class | DoneWith { Success , Error , Cancel } |
enum class | CallDoneIf { SuccessOrError , Success , Error } |
Functions | |
template<int Limit> | |
ExecutableItem | waitForBarrierTask (const MultiBarrier< Limit > &sharedBarrier) |
template<typename Signal> | |
ExecutableItem | signalAwaiter (const typename QtPrivate::FunctionPointer< Signal >::Object *sender, Signal signal) |
static Group | conditionRecipe (const Storage< bool > &bodyExecutedStorage, const ConditionData &condition) |
static ExecutableItem | conditionsRecipe (const QList< ConditionData > &conditions) |
ThenItem | operator>> (const If &ifItem, const Then &thenItem) |
ThenItem | operator>> (const ElseIfItem &elseIfItem, const Then &thenItem) |
ElseIfItem | operator>> (const ThenItem &thenItem, const ElseIf &elseIfItem) |
ElseItem | operator>> (const ThenItem &thenItem, const Else &elseItem) |
GroupItem | parallelLimit (int limit) |
Constructs a group's element describing the \l{Execution Mode}{execution mode}. | |
GroupItem | workflowPolicy (WorkflowPolicy policy) |
Constructs a group's \l {Workflow Policy} {workflow policy} element for a given policy. | |
Group | operator>> (const For &forItem, const Do &doItem) |
Group | operator>> (const When &whenItem, const Do &doItem) |
static TaskTree * | activeTaskTree () |
DoneResult | toDoneResult (bool success) |
static SetupResult | toSetupResult (bool success) |
static DoneResult | toDoneResult (DoneWith doneWith) |
static DoneWith | toDoneWith (DoneResult result) |
static QString | currentTime () |
static QString | logHeader (const QString &logName) |
Group | operator! (const ExecutableItem &item) |
Group | operator&& (const ExecutableItem &first, const ExecutableItem &second) |
Group | operator|| (const ExecutableItem &first, const ExecutableItem &second) |
Group | operator&& (const ExecutableItem &item, DoneResult result) |
Group | operator|| (const ExecutableItem &item, DoneResult result) |
static bool | initialSuccessBit (WorkflowPolicy workflowPolicy) |
static bool | isProgressive (RuntimeContainer *container) |
static std::vector< TaskNode > | createChildren (TaskTreePrivate *taskTreePrivate, const GroupItems &children) |
static bool | shouldCall (CallDoneIf callDoneIf, DoneWith result) |
static void | removeTimerId (int timerId) |
static void | handleTimeout (int timerId) |
static int | scheduleTimeout (milliseconds timeout, QObject *context, const TimeoutCallback &callback) |
ExecutableItem | timeoutTask (const std::chrono::milliseconds &timeout, DoneResult result) |
template<typename Handler> | |
static GroupItem | onGroupSetup (Handler &&handler) |
\typealias Tasking::GroupItem::GroupSetupHandler | |
template<typename Handler> | |
static GroupItem | onGroupDone (Handler &&handler, CallDoneIf callDoneIf=CallDoneIf::SuccessOrError) |
Constructs a group's element holding the group done handler. |
\inmodule TaskingSolution
The Tasking namespace encloses all classes and global functions of the Tasking solution.
using Tasking::BarrierKickerGetter = std::function<ExecutableItem(const SingleBarrier &)> |
using Tasking::BarrierTask = SimpleCustomTask<Barrier> |
using Tasking::ConcurrentCallTask = CustomTask<ConcurrentCallTaskAdapter<T>> |
Definition at line 113 of file concurrentcall.h.
using Tasking::GroupItems = QList<GroupItem> |
Definition at line 36 of file tasktree.h.
using Tasking::MultiBarrier = Storage<SharedBarrier<Limit>> |
Definition at line 68 of file networkquery.h.
using Tasking::SimpleCustomTask = CustomTask<SimpleTaskAdapter<Task>> |
Definition at line 659 of file tasktree.h.
using Tasking::SingleBarrier = MultiBarrier<1> |
using Tasking::StoragePtr = void * |
Definition at line 1413 of file tasktree.cpp.
Definition at line 747 of file tasktree.h.
Definition at line 59 of file tcpsocket.h.
typedef std::function< void()> Tasking::TimeoutCallback = std::function<void()> |
Definition at line 3559 of file tasktree.cpp.
Definition at line 748 of file tasktree.h.
|
strong |
Enumerator | |
---|---|
SuccessOrError | |
Success | |
Error |
Definition at line 87 of file tasktree.h.
|
strong |
Enumerator | |
---|---|
Success | |
Error |
Definition at line 72 of file tasktree.h.
|
strong |
Enumerator | |
---|---|
Success | |
Error | |
Cancel |
Definition at line 79 of file tasktree.h.
|
strong |
Enumerator | |
---|---|
Get | |
Put | |
Post | |
Delete |
Definition at line 37 of file networkquery.h.
|
strong |
Enumerator | |
---|---|
Continue | |
StopWithSuccess | |
StopWithError |
Definition at line 64 of file tasktree.h.
|
strong |
Enumerator | |
---|---|
StopOnError | |
ContinueOnError | |
StopOnSuccess | |
ContinueOnSuccess | |
StopOnSuccessOrError | |
FinishAllAndSuccess | |
FinishAllAndError |
Definition at line 52 of file tasktree.h.
|
static |
Definition at line 1319 of file tasktree.cpp.
Referenced by Tasking::StorageThreadData::activeStorage(), and Tasking::ExecutableItem::withLog().
|
static |
Definition at line 11 of file conditional.cpp.
|
static |
Definition at line 27 of file conditional.cpp.
References Tasking::StorageBase::Storage.
|
static |
Definition at line 2177 of file tasktree.cpp.
|
static |
Definition at line 1578 of file tasktree.cpp.
|
static |
Definition at line 3597 of file tasktree.cpp.
References s_threadTimerData.
|
static |
Definition at line 1946 of file tasktree.cpp.
References ContinueOnError, ContinueOnSuccess, FinishAllAndError, FinishAllAndSuccess, StopOnError, StopOnSuccess, and StopOnSuccessOrError.
|
static |
Definition at line 2056 of file tasktree.cpp.
References Tasking::RuntimeIteration::m_isProgressive, Tasking::RuntimeTask::m_parentIteration, and Tasking::RuntimeContainer::m_parentTask.
Referenced by Tasking::RuntimeIteration::RuntimeIteration(), Tasking::TaskTreePrivate::startChildren(), and Tasking::TaskTreePrivate::startTask().
Definition at line 1580 of file tasktree.cpp.
|
static |
Constructs a group's element holding the group done handler.
By default, the handler is invoked whenever the group finishes. Pass a non-default value for the callDoneIf argument when you want the handler to be called only on a successful or failed execution. Depending on the group's workflow policy, this handler may also be called when the running group is canceled (e.g. when stopOnError element was used).
The passed handler is of the std::function<DoneResult(DoneWith)>
type. Optionally, each of the return DoneResult type or the argument DoneWith type may be omitted (that is, its return type may be void
). For more information on a possible handler type, refer to \l {GroupItem::GroupDoneHandler}.
When the handler is invoked, all of the group's child tasks are already finished.
If a group contains the Storage elements, the handler is invoked before the storages are destructed, so that the handler may still perform a last read of the active storages' data.
Definition at line 447 of file tasktree.h.
\typealias Tasking::GroupItem::GroupSetupHandler
Type alias for std::function<SetupResult()>
.
The GroupSetupHandler
is an argument of the onGroupSetup() element. Any function with the above signature, when passed as a group setup handler, will be called by the running task tree when the group execution starts.
The return value of the handler instructs the running group on how to proceed after the handler's invocation is finished. The default return value of SetupResult::Continue instructs the group to continue running, that is, to start executing its child tasks. The return value of SetupResult::StopWithSuccess or SetupResult::StopWithError instructs the group to skip the child tasks' execution and finish immediately with success or an error, respectively.
When the return type is either SetupResult::StopWithSuccess or SetupResult::StopWithError, the group's done handler (if provided) is called synchronously immediately afterwards.
The onGroupSetup() element accepts also functions in the shortened form of std::function<void()>
, that is, the return value is void
. In this case, it's assumed that the return value is SetupResult::Continue.
\typealias Tasking::GroupItem::GroupDoneHandler
Type alias for std::function<DoneResult(DoneWith)>
or DoneResult.
The GroupDoneHandler
is an argument of the onGroupDone() element. Any function with the above signature, when passed as a group done handler, will be called by the running task tree when the group execution ends.
The DoneWith argument is optional and your done handler may omit it. When provided, it holds the info about the final result of a group that will be reported to its parent.
The returned DoneResult value is optional and your handler may return void
instead. In this case, the final result of the group will be equal to the value indicated by the DoneWith argument. When the handler returns the DoneResult value, the group's final result may be tweaked inside the done handler's body by the returned value.
For a GroupDoneHandler
of the DoneResult type, no additional handling is executed, and the group finishes unconditionally with the passed value of DoneResult, ignoring the group's workflow policy.
Constructs a group's element holding the group setup handler. The handler is invoked whenever the group starts.
The passed handler is either of the std::function<SetupResult()>
or the std::function<void()>
type. For more information on a possible handler type, refer to \l {GroupItem::GroupSetupHandler}.
When the handler is invoked, none of the group's child tasks are running yet.
If a group contains the Storage elements, the handler is invoked after the storages are constructed, so that the handler may already perform some initial modifications to the active storages.
Definition at line 441 of file tasktree.h.
Group Tasking::operator! | ( | const ExecutableItem & | item | ) |
Definition at line 1644 of file tasktree.cpp.
Group Tasking::operator&& | ( | const ExecutableItem & | first, |
const ExecutableItem & | second ) |
Definition at line 1678 of file tasktree.cpp.
Group Tasking::operator&& | ( | const ExecutableItem & | item, |
DoneResult | result ) |
Definition at line 1724 of file tasktree.cpp.
ThenItem Tasking::operator>> | ( | const ElseIfItem & | elseIfItem, |
const Then & | thenItem ) |
Definition at line 74 of file conditional.cpp.
Definition at line 1294 of file tasktree.cpp.
Definition at line 69 of file conditional.cpp.
Definition at line 84 of file conditional.cpp.
ElseIfItem Tasking::operator>> | ( | const ThenItem & | thenItem, |
const ElseIf & | elseIfItem ) |
Definition at line 79 of file conditional.cpp.
Definition at line 1299 of file tasktree.cpp.
Group Tasking::operator|| | ( | const ExecutableItem & | first, |
const ExecutableItem & | second ) |
Definition at line 1709 of file tasktree.cpp.
Group Tasking::operator|| | ( | const ExecutableItem & | item, |
DoneResult | result ) |
Definition at line 1739 of file tasktree.cpp.
GroupItem Tasking::parallelLimit | ( | int | limit | ) |
Constructs a group's element describing the \l{Execution Mode}{execution mode}.
The execution mode element in a Group specifies how the direct child tasks of the Group are started.
For convenience, when appropriate, the \l sequential or \l parallel global elements may be used instead.
The limit defines the maximum number of direct child tasks running in parallel:
\list
In all execution modes, a group starts tasks in the oder in which they appear.
If a child of a group is also a group, the child group runs its tasks according to its own execution mode.
Definition at line 1253 of file tasktree.cpp.
|
static |
Definition at line 3581 of file tasktree.cpp.
References s_threadTimerData.
|
static |
Definition at line 3636 of file tasktree.cpp.
References Tasking::TimerThreadData::m_timerIdCounter, and s_threadTimerData.
|
static |
Definition at line 2367 of file tasktree.cpp.
References Error, and Success.
Referenced by Tasking::TaskTreePrivate::invokeDoneHandler(), and Tasking::TaskTreePrivate::invokeTaskDoneHandler().
ExecutableItem Tasking::signalAwaiter | ( | const typename QtPrivate::FunctionPointer< Signal >::Object * | sender, |
Signal | signal ) |
Definition at line 102 of file barrier.h.
References Tasking::Barrier::setLimit().
ExecutableItem Tasking::timeoutTask | ( | const std::chrono::milliseconds & | timeout, |
DoneResult | result = DoneResult::Error ) |
Definition at line 3665 of file tasktree.cpp.
DoneResult Tasking::toDoneResult | ( | bool | success | ) |
Definition at line 1325 of file tasktree.cpp.
References Error, and Success.
Referenced by Tasking::ExecutableItem::operator!.
|
static |
Definition at line 1335 of file tasktree.cpp.
References Error, and Success.
Referenced by Tasking::TaskTreeTaskAdapter::TaskTreeTaskAdapter(), Tasking::TaskTreePrivate::invokeDoneHandler(), and Tasking::TaskTreePrivate::invokeTaskDoneHandler().
|
static |
Definition at line 1340 of file tasktree.cpp.
|
static |
Definition at line 1330 of file tasktree.cpp.
References StopWithError, and StopWithSuccess.
Referenced by Tasking::TaskTreePrivate::childDone(), Tasking::TaskTreePrivate::continueContainer(), and Tasking::TaskTreePrivate::startChildren().
ExecutableItem Tasking::waitForBarrierTask | ( | const MultiBarrier< Limit > & | sharedBarrier | ) |
Definition at line 78 of file barrier.h.
References Continue, Tasking::Barrier::setLimit(), StopWithError, StopWithSuccess, and Success.
GroupItem Tasking::workflowPolicy | ( | WorkflowPolicy | policy | ) |
Constructs a group's \l {Workflow Policy} {workflow policy} element for a given policy.
For convenience, global elements may be used instead.
Definition at line 1269 of file tasktree.cpp.
const GroupItem Tasking::continueOnError = workflowPolicy(WorkflowPolicy::ContinueOnError) |
Definition at line 1282 of file tasktree.cpp.
const GroupItem Tasking::continueOnSuccess = workflowPolicy(WorkflowPolicy::ContinueOnSuccess) |
Definition at line 1284 of file tasktree.cpp.
const ExecutableItem Tasking::errorItem = Group { finishAllAndError } |
Definition at line 1292 of file tasktree.cpp.
const GroupItem Tasking::finishAllAndError = workflowPolicy(WorkflowPolicy::FinishAllAndError) |
Definition at line 1287 of file tasktree.cpp.
Referenced by Tasking::ExecutableItem::operator&&, and Tasking::ExecutableItem::withTimeout().
const GroupItem Tasking::finishAllAndSuccess = workflowPolicy(WorkflowPolicy::FinishAllAndSuccess) |
Definition at line 1286 of file tasktree.cpp.
Referenced by Tasking::ExecutableItem::operator||.
Definition at line 1290 of file tasktree.cpp.
const GroupItem Tasking::parallel = parallelLimit(0) |
Definition at line 1278 of file tasktree.cpp.
Referenced by Tasking::When::operator>>, and Tasking::ExecutableItem::withTimeout().
const GroupItem Tasking::parallelIdealThreadCountLimit = parallelLimit(qMax(QThread::idealThreadCount() - 1, 1)) |
Definition at line 1279 of file tasktree.cpp.
|
staticconstexpr |
Definition at line 1415 of file tasktree.cpp.
|
static |
Definition at line 1317 of file tasktree.cpp.
Referenced by Tasking::ExecutionContextActivator::~ExecutionContextActivator().
|
static |
Definition at line 3579 of file tasktree.cpp.
Referenced by handleTimeout(), removeTimerId(), and scheduleTimeout().
const GroupItem Tasking::sequential = parallelLimit(1) |
Definition at line 1277 of file tasktree.cpp.
const GroupItem Tasking::stopOnError = workflowPolicy(WorkflowPolicy::StopOnError) |
Definition at line 1281 of file tasktree.cpp.
Referenced by Tasking::ExecutableItem::operator&&, Tasking::ExecutableItem::operator&&, and Tasking::ExecutableItem::operator||.
const GroupItem Tasking::stopOnSuccess = workflowPolicy(WorkflowPolicy::StopOnSuccess) |
Definition at line 1283 of file tasktree.cpp.
Referenced by Tasking::ExecutableItem::operator||.
const GroupItem Tasking::stopOnSuccessOrError = workflowPolicy(WorkflowPolicy::StopOnSuccessOrError) |
Definition at line 1285 of file tasktree.cpp.
Referenced by Tasking::ExecutableItem::withTimeout().
const ExecutableItem Tasking::successItem = Group { finishAllAndSuccess } |
Definition at line 1291 of file tasktree.cpp.