GroupItem Classclass Tasking::GroupItem
GroupItem is a basic element that may be a part of any Group. It encapsulates the functionality provided by any GroupItem's subclass. It is a value type and it is safe to copy the GroupItem instance, even when it is originally created via the subclass' constructor.
There are four main kinds of GroupItem:
|GroupItem Kind||Brief Description|
|CustomTask||Defines asynchronous task type and task's start, done, and error handlers. Aliased with a unique task name, such as, |
|Group||A container for other group items. Since the group is of the GroupItem type, it's possible to nest it inside another group. The group is seen by its parent as a single asynchronous task.|
|Storage||Enables the child tasks of a group to exchange data. When Storage is placed inside a group, the task tree instantiates the storage object just before the group is entered, and destroys it just after the group is finished.|
|Other group control items||The items returned by parallelLimit() or workflowPolicy() influence the group's behavior. The items returned by onGroupSetup(), onGroupDone() or onGroupError() define custom handlers called when the group starts or ends execution.|
Member Type Documentation
Type alias for
The GroupEndHandler is used when constructing the onGroupDone() and onGroupError() elements. Any function with the above signature, when passed as a group done or error handler, will be called by the running task tree when the group ends with success or an error, respectively.
Type alias for
The GroupSetupHandler is used when constructing 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, i.e. to start executing its child tasks. The return value of SetupResult::StopWithDone or SetupResult::StopWithError instructs the group to skip the child tasks' execution and finish immediately with success or an error, respectively.
Note: Even if the group setup handler returns StopWithDone or StopWithError, one of the group's done or error handlers is invoked. This behavior differs from that of task handlers and might change in the future.
The onGroupSetup() accepts also functions in the shortened form of
std::function<void()>, i.e. the return value is void. In this case it's assumed that the return value is SetupResult::Continue by default.
See also onGroupSetup().
© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.