| [ Web Proxy ] |
| Viewing: https://raw.githubusercontent.com/ModuleWorks/taskflow/task_isolation/docs/classtf_1_1Task.html | [Back] [Original] |
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.
assigns a name to the task
| Parameters | |
|---|---|
| name | a std::string acceptable string |
| Returns | *this |
assigns a callable
| Template parameters | |
|---|---|
| C | callable type |
| Parameters | |
| callable | callable to construct a task |
| Returns | *this |
creates a module task from a taskflow
| Template parameters | |
|---|---|
| T | object type |
| Parameters | |
| object | a custom object that defines T::graph() method |
| Returns | *this |
adds precedence links from this to other tasks
| Template parameters | |
|---|---|
| Ts | parameter pack |
| Parameters | |
| tasks | one or multiple tasks |
| Returns | *this |
adds precedence links from other tasks to this
| Template parameters | |
|---|---|
| Ts | parameter pack |
| Parameters | |
| tasks | one or multiple tasks |
| Returns | *this |
assigns pointer to user data
| Parameters | |
|---|---|
| data | pointer to user data |
| Returns | *this |
The following example shows how to attach user data to a task and run the task iteratively while changing the data value:
tf::Executor executor; tf::Taskflow taskflow("attach data to a task"); int data; // create a task and attach it the data auto A = taskflow.placeholder(); A.data(&data).work([A](){ auto d = *static_cast<int*>(A.data()); std::cout << "data is " << d << std::endl; }); // run the taskflow iteratively with changing data for(data = 0; data<10; data++){ executor.run(taskflow).wait(); }
Search for symbols, directories, files, pages or
modules. You can omit any prefix from the symbol or file path; adding a
: or / suffix lists all members of given symbol or
directory.
Use ↓ / ↑ to navigate through the list, Enter to go. Tab autocompletes common prefix, you can copy a link to the result using L while M produces a Markdown link.
Taskflow handbook is part of the Taskflow project, copyright Dr. Tsung-Wei Huang, 2018–2025.
Generated by Doxygen 1.12.0 and m.css.
| Web Proxy Viewer | New URL | Original Page |