Cpp-Taskflow  2.2.0
tf::Task Class Reference

Handle to modify and access a task. More...

#include <task.hpp>

Public Member Functions

 Task ()=default
 constructs an empty task
 
 Task (const Task &other)
 constructs the task with the copy of the other task
 
Taskoperator= (const Task &)
 replaces the contents with a copy of the other task
 
Taskoperator= (std::nullptr_t)
 replaces the contents with a null pointer
 
const std::stringname () const
 queries the name of the task
 
size_t num_successors () const
 queries the number of successors of the task
 
size_t num_dependents () const
 queries the number of predecessors of the task
 
Taskname (const std::string &name)
 assigns a name to the task More...
 
template<typename C >
Taskwork (C &&callable)
 assigns a new callable object to the task More...
 
template<typename... Ts>
Taskprecede (Ts &&... tasks)
 adds precedence links from this to other tasks More...
 
Taskprecede (std::vector< Task > &tasks)
 adds precedence links from this to others More...
 
Taskprecede (std::initializer_list< Task > tasks)
 adds precedence links from this to others More...
 
template<typename... Ts>
Taskgather (Ts &&... tasks)
 adds precedence links from other tasks to this More...
 
Taskgather (std::vector< Task > &tasks)
 adds precedence links from other tasks to this More...
 
Taskgather (std::initializer_list< Task > tasks)
 adds precedence links from other tasks to this More...
 
Taskreset ()
 resets the task handle to point to nothing More...
 
bool empty () const
 queries if the task handle points to a task node
 

Friends

class FlowBuilder
 
class Taskflow
 
class TaskView
 

Detailed Description

Handle to modify and access a task.

A Task is a wrapper of a node in a dependency graph. It provides a set of methods for users to access and modify the attributes of the task node, preventing direct access to the internal data storage.

Member Function Documentation

◆ gather() [1/3]

template<typename... Bs>
Task & tf::Task::gather ( Bs &&...  tasks)

adds precedence links from other tasks to this

Template Parameters
Tsparameter pack
Parameters
tasksone or multiple tasks
Returns
*this

◆ gather() [2/3]

Task & tf::Task::gather ( std::vector< Task > &  tasks)
inline

adds precedence links from other tasks to this

Parameters
tasksa vector of tasks
Returns
*this

◆ gather() [3/3]

Task & tf::Task::gather ( std::initializer_list< Task tasks)
inline

adds precedence links from other tasks to this

Parameters
tasksan initializer list of tasks
Returns
*this

◆ name()

Task & tf::Task::name ( const std::string name)
inline

assigns a name to the task

Parameters
namea std::string acceptable string
Returns
*this

◆ precede() [1/3]

template<typename... Ts>
Task & tf::Task::precede ( Ts &&...  tasks)

adds precedence links from this to other tasks

Template Parameters
Ts...parameter pack
Parameters
tasksone or multiple tasks
Returns
*this

◆ precede() [2/3]

Task & tf::Task::precede ( std::vector< Task > &  tasks)
inline

adds precedence links from this to others

Parameters
tasksa vector of tasks to precede
Returns
*this

◆ precede() [3/3]

Task & tf::Task::precede ( std::initializer_list< Task tasks)
inline

adds precedence links from this to others

Parameters
tasksan initializer list of tasks to precede
Returns
*this

◆ reset()

Task & tf::Task::reset ( )
inline

resets the task handle to point to nothing

Returns
*this

◆ work()

template<typename C >
Task & tf::Task::work ( C &&  callable)
inline

assigns a new callable object to the task

Template Parameters
Ccallable object type
Parameters
callablea callable object acceptable to std::function
Returns
*this

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