forked from taskflow/taskflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple_dsl.cpp
More file actions
28 lines (25 loc) · 1.06 KB
/
Copy pathsimple_dsl.cpp
File metadata and controls
28 lines (25 loc) · 1.06 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
// 2020/08/28 - Created by netcan: https://github.com/netcan
// A simple example to capture the following task dependencies.
// using Task DSL to describe
// TaskA -> fork(TaskB, TaskC) -> TaskD
#include <taskflow/taskflow.hpp> // the only include you need
#include <taskflow/dsl.hpp> // for support dsl
int main() {
tf::Executor executor;
tf::Taskflow taskflow("simple");
make_task((A), { std::cout << "TaskA\n"; });
make_task((B), { std::cout << "TaskB\n"; });
make_task((C), { std::cout << "TaskC\n"; });
make_task((D), { std::cout << "TaskD\n"; });
build_taskflow( // +---+
task(A) // +---->| B |-----+
->fork_tasks(B, C) // | +---+ |
->task(D) // +---+ +-v-+
)(taskflow); // | A | | D |
// +---+ +-^-+
// | +---+ |
// +---->| C |-----+
// +---+
executor.run(taskflow).wait();
return 0;
}