tf::Task taskflow/core/task.hpp class friend class FlowBuilder FlowBuilder FlowBuilder class friend class Runtime Runtime Runtime class friend class Taskflow Taskflow Taskflow class friend class TaskView TaskView TaskView class friend class Executor Executor Executor Node * Node* tf::Task::_node _node {nullptr} tf::Task::Task ()=default Task constructs an empty task tf::Task::Task (const Task &other) Task const Task & other constructs the task with the copy of the other task Task & Task & tf::Task::operator= (const Task &) operator= const Task & rhs replaces the contents with a copy of the other task Task & Task & tf::Task::operator= (std::nullptr_t) operator= std::nullptr_t ptr replaces the contents with a null pointer bool bool tf::Task::operator== (const Task &rhs) const operator== const Task & rhs compares if two tasks are associated with the same graph node bool bool tf::Task::operator!= (const Task &rhs) const operator!= const Task & rhs compares if two tasks are not associated with the same graph node const std::string & const std::string & tf::Task::name () const name queries the name of the task size_t size_t tf::Task::num_successors () const num_successors queries the number of successors of the task size_t size_t tf::Task::num_dependents () const num_dependents queries the number of predecessors of the task size_t size_t tf::Task::num_strong_dependents () const num_strong_dependents queries the number of strong dependents of the task size_t size_t tf::Task::num_weak_dependents () const num_weak_dependents queries the number of weak dependents of the task Task & Task & tf::Task::name (const std::string &name) name const std::string & name assigns a name to the task name a std::string acceptable string *this typename C Task & Task & tf::Task::work (C &&callable) work C && callable assigns a callable C callable type callable callable to construct a task *this typename T Task & Task & tf::Task::composed_of (T &object) composed_of T & object creates a module task from a taskflow T object type object a custom object that defines T::graph() method *this typename... Ts Ts Task & Task & tf::Task::precede (Ts &&... tasks) precede Ts &&... tasks adds precedence links from this to other tasks Ts parameter pack tasks one or multiple tasks *this typename... Ts Ts Task & Task & tf::Task::succeed (Ts &&... tasks) succeed Ts &&... tasks adds precedence links from other tasks to this Ts parameter pack tasks one or multiple tasks *this Task & Task & tf::Task::data (void *data) data void * data assigns pointer to user data data pointer to user data The following example shows how to attach user data to a task and run the task iteratively while changing the data value: tf::Executorexecutor; tf::Taskflowtaskflow("attachdatatoatask"); intdata; //createataskandattachitthedata autoA=taskflow.placeholder(); A.data(&data).work([A](){ autod=*static_cast<int*>(A.data()); std::cout<<"datais"<<d<<std::endl; }); //runthetaskflowiterativelywithchangingdata for(data=0;data<10;data++){ executor.run(taskflow).wait(); } *this void void tf::Task::reset () reset resets the task handle to null void void tf::Task::reset_work () reset_work resets the associated work to a placeholder bool bool tf::Task::empty () const empty queries if the task handle points to a task node bool bool tf::Task::has_work () const has_work queries if the task has a work assigned typename V void void tf::Task::for_each_successor (V &&visitor) const for_each_successor V && visitor applies an visitor callable to each successor of the task typename V void void tf::Task::for_each_dependent (V &&visitor) const for_each_dependent V && visitor applies an visitor callable to each dependents of the task size_t size_t tf::Task::hash_value () const hash_value obtains a hash value of the underlying node TaskType TaskType tf::Task::type () const type returns the task type void void tf::Task::dump (std::ostream &ostream) const dump std::ostream & ostream dumps the task through an output stream void * void * tf::Task::data () const data queries pointer to user data tf::Task::Task (Node *) Task Node * node class to create a task handle over a node in a taskflow graph A task is a wrapper over a node in a taskflow graph. It provides a set of methods for users to access and modify the attributes of the associated node in the taskflow graph. A task is very lightweight object (i.e., only storing a node pointer) that can be trivially copied around, and it does not own the lifetime of the associated node. tf::Task_node tf::Taskcomposed_of tf::Taskdata tf::Taskdata tf::Taskdump tf::Taskempty tf::TaskExecutor tf::TaskFlowBuilder tf::Taskfor_each_dependent tf::Taskfor_each_successor tf::Taskhas_work tf::Taskhash_value tf::Taskname tf::Taskname tf::Tasknum_dependents tf::Tasknum_strong_dependents tf::Tasknum_successors tf::Tasknum_weak_dependents tf::Taskoperator!= tf::Taskoperator= tf::Taskoperator= tf::Taskoperator== tf::Taskprecede tf::Taskreset tf::Taskreset_work tf::TaskRuntime tf::Tasksucceed tf::TaskTask tf::TaskTask tf::TaskTask tf::TaskTaskflow tf::TaskTaskView tf::Tasktype tf::Taskwork