You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/annotated.html
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -103,7 +103,7 @@
103
103
<trid="row_0_2_"><tdclass="entry"><spanstyle="width:32px;display:inline-block;"> </span><spanclass="icona"><spanclass="icon">C</span></span><aclass="el" href="classtf_1_1ExecutorObserver.html" target="_self">ExecutorObserver</a></td><tdclass="desc">A default executor observer to dump the execution timelines </td></tr>
104
104
<trid="row_0_3_" class="even"><tdclass="entry"><spanstyle="width:32px;display:inline-block;"> </span><spanclass="icona"><spanclass="icon">C</span></span><aclass="el" href="classtf_1_1ExecutorObserverInterface.html" target="_self">ExecutorObserverInterface</a></td><tdclass="desc">The interface class for creating an executor observer </td></tr>
105
105
<trid="row_0_4_"><tdclass="entry"><spanstyle="width:32px;display:inline-block;"> </span><spanclass="icona"><spanclass="icon">C</span></span><aclass="el" href="classtf_1_1FlowBuilder.html" target="_self">FlowBuilder</a></td><tdclass="desc">Building blocks of a task dependency graph </td></tr>
106
-
<trid="row_0_5_" class="even"><tdclass="entry"><spanstyle="width:32px;display:inline-block;"> </span><spanclass="icona"><spanclass="icon">C</span></span><aclass="el" href="classtf_1_1SubflowBuilder.html" target="_self">SubflowBuilder</a></td><tdclass="desc">The building blocks of dynamic tasking </td></tr>
106
+
<trid="row_0_5_" class="even"><tdclass="entry"><spanstyle="width:32px;display:inline-block;"> </span><spanclass="icona"><spanclass="icon">C</span></span><aclass="el" href="classtf_1_1Subflow.html" target="_self">Subflow</a></td><tdclass="desc">The building blocks of dynamic tasking </td></tr>
107
107
<trid="row_0_6_"><tdclass="entry"><spanstyle="width:32px;display:inline-block;"> </span><spanclass="icona"><spanclass="icon">C</span></span><aclass="el" href="classtf_1_1Task.html" target="_self">Task</a></td><tdclass="desc">Handle to modify and access a task </td></tr>
108
108
<trid="row_0_7_" class="even"><tdclass="entry"><spanstyle="width:32px;display:inline-block;"> </span><spanclass="icona"><spanclass="icon">C</span></span><aclass="el" href="classtf_1_1Taskflow.html" target="_self">Taskflow</a></td><tdclass="desc">Class to create a task dependency graph </td></tr>
<p>Cpp-Taskflow uses the general-purpose polymorphic function wrapper <aclass="elRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">std::function</a> to store and invoke any callable target in a task. You need to follow its contract to create a task. For instance, the callable object must be copy constructible.</p>
<p>Cpp-Taskflow uses C++ structured binding coupled with tuple to make the creation of tasks simple. The method <aclass="el" href="classtf_1_1FlowBuilder.html#a4d52a7fe2814b264846a2085e931652c" title="creates a task from a given callable object ">tf::Taskflow::emplace</a>accepts a arbitrary number of callable objects to create multiple tasks at one time.</p>
118
+
<p>Cpp-Taskflow uses C++ structured binding coupled with <aclass="elRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/utility/tuple.html">std::tuple</a>to make it simple to create multiple tasks at one time.</p>
<p>A task lives with its graph and belongs to only a graph at a time, and is not destroyed until the graph gets cleaned up. The lifetime of a task refers to the user-given callable object, including captured values. As long as the graph is alive, all the associated tasks exist. It is your responsibility to keep tasks and graph alive during their execution.</p>
122
-
<h1><aclass="anchor" id="C1Example1"></a>
123
-
Example 1: Create a Task Dependency Graph</h1>
124
-
<p>The example below demonstrates how to create a simple task dependency graph of four dependent tasks.</p>
<p>This example demonstrates how to modify a task's attributes using methods defined in the task handler.</p>
133
133
<divclass="fragment"><divclass="line"> 1: #include <taskflow/taskflow.hpp></div><divclass="line"> 2:</div><divclass="line"> 3: <spanclass="keywordtype">int</span> main() {</div><divclass="line"> 4:</div><divclass="line"> 5: <aclass="code" href="classtf_1_1Taskflow.html">tf::Taskflow</a> taskflow;</div><divclass="line"> 6:</div><divclass="line"> 7: <aclass="codeRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<tf::Task></a> tasks = { </div><divclass="line"> 8: taskflow.<aclass="code" href="classtf_1_1FlowBuilder.html#acab0b4ac82260f47fdb36a3244ee3aaf">placeholder</a>(), <spanclass="comment">// create a task with no work</span></div><divclass="line"> 9: taskflow.<aclass="code" href="classtf_1_1FlowBuilder.html#acab0b4ac82260f47fdb36a3244ee3aaf">placeholder</a>() <spanclass="comment">// create a task with no work</span></div><divclass="line">10: };</div><divclass="line">11:</div><divclass="line">12: tasks[0].name(<spanclass="stringliteral">"This is Task 0"</span>);</div><divclass="line">13: tasks[1].name(<spanclass="stringliteral">"This is Task 1"</span>);</div><divclass="line">14: tasks[0].precede(tasks[1]);</div><divclass="line">15:</div><divclass="line">16: <spanclass="keywordflow">for</span>(<spanclass="keyword">auto</span> task : tasks) { <spanclass="comment">// print out each task's attributes</span></div><divclass="line">17: <aclass="codeRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << task.name() << <spanclass="stringliteral">": "</span></div><divclass="line">18: << <spanclass="stringliteral">"num_dependents="</span> << task.num_dependents() << <spanclass="stringliteral">", "</span></div><divclass="line">19: << <spanclass="stringliteral">"num_successors="</span> << task.num_successors() << <spanclass="charliteral">'\n'</span>;</div><divclass="line">20: }</div><divclass="line">21:</div><divclass="line">22: taskflow.<aclass="code" href="classtf_1_1Taskflow.html#ac433018262e44b12c4cc9f0c4748d758">dump</a>(<aclass="codeRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a>); <spanclass="comment">// dump the taskflow graph</span></div><divclass="line">23:</div><divclass="line">24: tasks[0].work([](){ <aclass="codeRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <spanclass="stringliteral">"got a new work!\n"</span>; });</div><divclass="line">25: tasks[1].work([](){ <aclass="codeRef" doxygen="/home/twhuang/PhD/Code/cpp-taskflow/doxygen/cppreference-doxygen-web.tag.xml:http://en.cppreference.com/w/" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <spanclass="stringliteral">"got a new work!\n"</span>; });</div><divclass="line">26:</div><divclass="line">27: <spanclass="keywordflow">return</span> 0;</div><divclass="line">28: }</div></div><!-- fragment --><p>The output of this program looks like the following:</p>
134
134
<divclass="fragment"><divclass="line">This is Task 0: num_dependents=0, num_successors=1</div><divclass="line">This is Task 1: num_dependents=1, num_successors=0</div><divclass="line">digraph Taskflow {</div><divclass="line">"This is Task 1";</div><divclass="line">"This is Task 0";</div><divclass="line">"This is Task 0" -> "This is Task 1";</div><divclass="line">}</div></div><!-- fragment --><p>Debrief: </p><ul>
0 commit comments