-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathvisualization.cpp
More file actions
42 lines (30 loc) · 1.09 KB
/
visualization.cpp
File metadata and controls
42 lines (30 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// This example demonstrates how to use 'dump' method to inspect
// a taskflow graph.
#include <taskflow/taskflow.hpp>
int main(){
tf::Taskflow tf("Visualization Demo");
// ------------------------------------------------------
// Static Tasking
// ------------------------------------------------------
auto A = tf.emplace([] () { std::cout << "Task A" << std::endl; });
auto B = tf.emplace([] () { std::cout << "Task B" << std::endl; });
auto C = tf.emplace([] () { std::cout << "Task C" << std::endl; });
auto D = tf.emplace([] () { std::cout << "Task D" << std::endl; });
auto E = tf.emplace([] () { std::cout << "Task E" << std::endl; });
A.precede(B, C, E);
C.precede(D);
B.precede(D, E);
std::cout << "[dump without name assignment]\n";
tf.dump(std::cout);
std::cout << "[dump with name assignment]\n";
A.name("A");
B.name("B");
C.name("C");
D.name("D");
E.name("E");
tf.dump(std::cout);
// ------------------------------------------------------
// Dynamic Tasking
// ------------------------------------------------------
return 0;
}