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::ExecutableItem Class Reference

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

#include <tasktree.h>

+ Inheritance diagram for Tasking::ExecutableItem:
+ Collaboration diagram for Tasking::ExecutableItem:

Public Member Functions

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.
 
ExecutableItem 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 >
ExecutableItem withCancel (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 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 Member Functions

 ExecutableItem ()=default
 
 ExecutableItem (const TaskHandler &handler)
 
- Protected Member Functions inherited from Tasking::GroupItem
 GroupItem ()=default
 
 GroupItem (Type type)
 
 GroupItem (const GroupData &data)
 
 GroupItem (const TaskHandler &handler)
 
void addChildren (const QList< GroupItem > &children)
 

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

Detailed Description

\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 299 of file tasktree.h.

Constructor & Destructor Documentation

◆ ExecutableItem() [1/2]

Tasking::ExecutableItem::ExecutableItem ( )
protecteddefault

◆ ExecutableItem() [2/2]

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

Definition at line 319 of file tasktree.h.

Member Function Documentation

◆ withCancel()

template<typename SenderSignalPairGetter >
ExecutableItem Tasking::ExecutableItem::withCancel ( SenderSignalPairGetter && getter) const
inline

Definition at line 306 of file tasktree.h.

References QObject::connect(), Qt::QueuedConnection, Qt::SingleShotConnection, and void.

+ Here is the call graph for this function:

◆ withLog()

ExecutableItem Tasking::ExecutableItem::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.

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 1476 of file tasktree.cpp.

References Tasking::activeTaskTree(), elapsed(), QString::fromLatin1(), Tasking::logHeader(), Tasking::onGroupDone(), Tasking::onGroupSetup(), qDebug, QT_CHECK, and storage.

+ Here is the call graph for this function:

◆ withTimeout()

ExecutableItem 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 1442 of file tasktree.cpp.

References Tasking::finishAllAndError, Tasking::parallel, Tasking::stopOnSuccessOrError, and Tasking::Success.


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