| 81 | |
| 82 | |
| 83 | void example_map_reduce() { |
| 84 | auto pipeline = GPipelineFactory::create(); |
| 85 | GElementPtr a, b0, b1, b2, b3, c = nullptr; |
| 86 | |
| 87 | CStatus status; |
| 88 | status += pipeline->registerGElement<GenerateGNode>(&a, {}); |
| 89 | status += pipeline->registerGElement<MapGNode<0>>(&b0, {a}); |
| 90 | status += pipeline->registerGElement<MapGNode<1>>(&b1, {a}); |
| 91 | status += pipeline->registerGElement<MapGNode<2>>(&b2, {a}); |
| 92 | status += pipeline->registerGElement<MapGNode<3>>(&b3, {a}); |
| 93 | status += pipeline->registerGElement<ReduceGNode>(&c, {b0, b1, b2, b3}); |
| 94 | |
| 95 | status += pipeline->process(); |
| 96 | if (status.isErr()) { |
| 97 | CGRAPH_ECHO("example_map_reduce error info is : %s", status.getInfo().c_str()); |
| 98 | } |
| 99 | |
| 100 | GPipelineFactory::clear(); |
| 101 | } |
| 102 | |
| 103 | |
| 104 | int main() { |