Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
Tasking::GroupItem Class Reference

\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution More...

#include <tasktree.h>

+ Inheritance diagram for Tasking::GroupItem:
+ Collaboration diagram for Tasking::GroupItem:

Classes

struct  GroupData
 
struct  GroupHandler
 
struct  TaskHandler
 

Public Types

using GroupSetupHandler = std::function<SetupResult()>
 
using GroupDoneHandler = std::function<DoneResult(DoneWith)>
 

Public Member Functions

template<typename StorageStruct >
 GroupItem (const Storage< StorageStruct > &storage)
 Constructs a GroupItem element holding the storage object.
 
 GroupItem (const Loop &loop)
 
 GroupItem (const QList< GroupItem > &children)
 Constructs a GroupItem element with a given list of items.
 
 GroupItem (std::initializer_list< GroupItem > children)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 

Protected Types

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)>
 

Protected Member Functions

 GroupItem ()=default
 
 GroupItem (Type type)
 
 GroupItem (const GroupData &data)
 
 GroupItem (const TaskHandler &handler)
 
void addChildren (const QList< GroupItem > &children)
 

Static Protected Member Functions

static GroupItem groupHandler (const GroupHandler &handler)
 
static GroupItem parallelLimit (int limit)
 
static GroupItem workflowPolicy (WorkflowPolicy policy)
 
template<typename Result , typename Function , typename ... Args, typename DecayedFunction = std::decay_t<Function>>
static constexpr bool isInvocable ()
 

Friends

class ContainerNode
 
class TaskNode
 
class TaskTreePrivate
 

Detailed Description

\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution

GroupItem represents the basic element that may be a part of any Group. \reentrant

GroupItem is a basic element that may be a part of any \l {Tasking::Group} {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: \table \header

Definition at line 208 of file tasktree.h.

Member Typedef Documentation

◆ GroupDoneHandler

Definition at line 214 of file tasktree.h.

◆ GroupSetupHandler

Definition at line 212 of file tasktree.h.

◆ InterfaceCreateHandler

using Tasking::GroupItem::InterfaceCreateHandler = std::function<TaskInterface *(void)>
protected

Definition at line 229 of file tasktree.h.

◆ InterfaceDoneHandler

using Tasking::GroupItem::InterfaceDoneHandler = std::function<DoneResult(const TaskInterface &, DoneWith)>
protected

Definition at line 233 of file tasktree.h.

◆ InterfaceSetupHandler

Definition at line 231 of file tasktree.h.

Member Enumeration Documentation

◆ Type

enum class Tasking::GroupItem::Type
strongprotected
Enumerator
List 
Group 
GroupData 
Storage 
TaskHandler 

Definition at line 255 of file tasktree.h.

Constructor & Destructor Documentation

◆ GroupItem() [1/8]

template<typename StorageStruct >
template< typename StorageStruct > Tasking::GroupItem::GroupItem ( const Storage< StorageStruct > & storage)
inline

Constructs a GroupItem element holding the storage object.

When the \l {Tasking::Group} {Group} element containing this GroupItem is entered by the running task tree, an instance of the StorageStruct is created dynamically.

When that group is about to be left after its execution, the previously instantiated StorageStruct is deleted.

The dynamically created instance of StorageStruct is accessible from inside any handler body of the parent \l {Tasking::Group} {Group} element, including nested groups and its tasks, via the \l {Tasking::Storage::operator->()} {Storage::operator->()}, \l {Tasking::Storage::operator*()} {Storage::operator*()}, or Storage::activeStorage() method.

See also
{Tasking::Storage} {Storage}

Definition at line 217 of file tasktree.h.

◆ GroupItem() [2/8]

Tasking::GroupItem::GroupItem ( const Loop & loop)
inline

Definition at line 221 of file tasktree.h.

◆ GroupItem() [3/8]

Tasking::GroupItem::GroupItem ( const QList< GroupItem > & items)
inline

Constructs a GroupItem element with a given list of items.

When this GroupItem element is parsed by the TaskTree, it is simply replaced with its items.

This constructor is useful when constructing a \l {Tasking::Group} {Group} element with lists of GroupItem elements:

static QList<GroupItems> getItems();
...
const Group root {
getItems(), // OK, getItems() list is wrapped into a single GroupItem element
};
\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution
Definition tasktree.h:327
static GroupItem onGroupSetup(Handler &&handler)
\typealias GroupItem::GroupSetupHandler
Definition tasktree.h:387
const GroupItem finishAllAndSuccess
static GroupItem onGroupDone(Handler &&handler, CallDoneIf callDoneIf=CallDoneIf::SuccessOrError)
Constructs a group's element holding the group done handler.
Definition tasktree.h:393
const GroupItem parallel

If you want to create a subtree, use \l {Tasking::Group} {Group} instead.

Note
Don't confuse this GroupItem with the \l {Tasking::Group} {Group} element, as \l {Tasking::Group} {Group} keeps its children nested after being parsed by the task tree, while this GroupItem does not.
See also
{Tasking::Group} {Group}

Definition at line 224 of file tasktree.h.

◆ GroupItem() [4/8]

Tasking::GroupItem::GroupItem ( std::initializer_list< GroupItem > items)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

See also
GroupItem(const QList<Tasking::GroupItem> &items)

Definition at line 225 of file tasktree.h.

◆ GroupItem() [5/8]

Tasking::GroupItem::GroupItem ( )
protecteddefault

◆ GroupItem() [6/8]

Tasking::GroupItem::GroupItem ( Type type)
inlineprotected

Definition at line 264 of file tasktree.h.

◆ GroupItem() [7/8]

Tasking::GroupItem::GroupItem ( const GroupData & data)
inlineprotected

Definition at line 265 of file tasktree.h.

◆ GroupItem() [8/8]

Tasking::GroupItem::GroupItem ( const TaskHandler & handler)
inlineprotected

Definition at line 268 of file tasktree.h.

Member Function Documentation

◆ addChildren()

void Tasking::GroupItem::addChildren ( const QList< GroupItem > & children)
protected

Definition at line 1355 of file tasktree.cpp.

References addChildren(), child, Tasking::GroupItem::GroupHandler::m_callDoneIf, Tasking::GroupItem::GroupHandler::m_doneHandler, Tasking::GroupItem::GroupData::m_groupHandler, Tasking::GroupItem::GroupData::m_loop, Tasking::GroupItem::GroupData::m_parallelLimit, Tasking::GroupItem::GroupHandler::m_setupHandler, Tasking::GroupItem::GroupData::m_workflowPolicy, QT_ASSERT, qWarning, and storage.

Referenced by addChildren().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ groupHandler()

static GroupItem Tasking::GroupItem::groupHandler ( const GroupHandler & handler)
inlinestaticprotected

Definition at line 273 of file tasktree.h.

◆ isInvocable()

template<typename Result , typename Function , typename ... Args, typename DecayedFunction = std::decay_t<Function>>
static constexpr bool Tasking::GroupItem::isInvocable ( )
inlinestaticconstexprprotected

Definition at line 280 of file tasktree.h.

◆ parallelLimit()

static GroupItem Tasking::GroupItem::parallelLimit ( int limit)
inlinestaticprotected

Definition at line 274 of file tasktree.h.

◆ workflowPolicy()

static GroupItem Tasking::GroupItem::workflowPolicy ( WorkflowPolicy policy)
inlinestaticprotected

Definition at line 275 of file tasktree.h.

References policy.

Friends And Related Symbol Documentation

◆ ContainerNode

friend class ContainerNode
friend

Definition at line 289 of file tasktree.h.

◆ TaskNode

friend class TaskNode
friend

Definition at line 290 of file tasktree.h.

◆ TaskTreePrivate

friend class TaskTreePrivate
friend

Definition at line 291 of file tasktree.h.


The documentation for this class was generated from the following files: