Taskflow  2.7.0
tf::Task Class Reference

handle to a node in a task dependency graph 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
 
bool operator== (const Task &rhs) const
 compares if two tasks are associated with the same graph node
 
bool operator!= (const Task &rhs) const
 compares if two tasks are not associated with the same graph node
 
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
 
size_t num_strong_dependents () const
 queries the number of strong dependents of the task
 
size_t num_weak_dependents () const
 queries the number of weak dependents of the task
 
Taskname (const std::string &name)
 assigns a name to the task More...
 
template<typename C >
std::enable_if_t< is_static_task_v< C >, Task > & work (C &&callable)
 assigns a static task More...
 
template<typename C >
std::enable_if_t< is_dynamic_task_v< C >, Task > & work (C &&callable)
 assigns a dynamic task More...
 
template<typename C >
std::enable_if_t< is_condition_task_v< C >, Task > & work (C &&callable)
 assigns a condition task More...
 
template<typename C >
std::enable_if_t< is_cudaflow_task_v< C >, Task > & work (C &&callable)
 assigns a cudaFlow task More...
 
Taskcomposed_of (Taskflow &taskflow)
 creates a module task from a taskflow More...
 
template<typename... Ts>
Taskprecede (Ts &&... tasks)
 adds precedence links from this to other tasks More...
 
template<typename... Ts>
Tasksucceed (Ts &&... tasks)
 adds precedence links from other tasks to this More...
 
void reset ()
 resets the task handle to null
 
void reset_work ()
 resets the associated work to a placeholder
 
bool empty () const
 queries if the task handle points to a task node
 
bool has_work () const
 queries if the task has a work assigned
 
template<typename V >
void for_each_successor (V &&visitor) const
 applies an visitor callable to each successor of the task
 
template<typename V >
void for_each_dependent (V &&visitor) const
 applies an visitor callable to each dependents of the task
 
size_t hash_value () const
 obtains a hash value of the underlying node
 
TaskType type () const
 returns the task type
 

Friends

class FlowBuilder
 
class Taskflow
 
class TaskView
 

Detailed Description

handle to a node in a task dependency graph

A Task is handle object of a node in a dependency graph. It provides a set of methods for users to access and modify the attributes of the associated graph node.

Member Function Documentation

◆ composed_of()

Task & tf::Task::composed_of ( Taskflow taskflow)
inline

creates a module task from a taskflow

Parameters
taskflowa taskflow object for the module
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()

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

◆ succeed()

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

adds precedence links from other tasks to this

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

◆ work() [1/4]

template<typename C >
std::enable_if_t< is_static_task_v< C >, Task > & tf::Task::work ( C &&  callable)

assigns a static task

Template Parameters
Ccallable object type
Parameters
callablea callable object constructible from std::function<void()>
Returns
*this

◆ work() [2/4]

template<typename C >
std::enable_if_t< is_dynamic_task_v< C >, Task > & tf::Task::work ( C &&  callable)

assigns a dynamic task

Template Parameters
Ccallable object type
Parameters
callablea callable object constructible from std::function<void(Subflow&)>
Returns
*this

◆ work() [3/4]

template<typename C >
std::enable_if_t< is_condition_task_v< C >, Task > & tf::Task::work ( C &&  callable)

assigns a condition task

Template Parameters
Ccallable object type
Parameters
callablea callable object constructible from std::function<int()>
Returns
*this

◆ work() [4/4]

template<typename C >
std::enable_if_t< is_cudaflow_task_v< C >, Task > & tf::Task::work ( C &&  callable)

assigns a cudaFlow task

Template Parameters
Ccallable object type
Parameters
callablea callable object constructible from std::function<void(cudaFlow&)>
Returns
*this

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