| 14 | using namespace CGraph; |
| 15 | |
| 16 | void tutorial_event() { |
| 17 | GPipelinePtr pipeline = GPipelineFactory::create(); |
| 18 | GElementPtr a, b, c, d = nullptr; |
| 19 | |
| 20 | CStatus status = pipeline->registerGElement<MyWriteParamNode>(&a, {}, "nodeA"); |
| 21 | status += pipeline->registerGElement<MyEventNode>(&b, {a}, "nodeB"); |
| 22 | status += pipeline->registerGElement<MyNode1>(&c, {b}, "nodeC"); |
| 23 | status += pipeline->registerGElement<MyEventNode>(&d, {b}, "nodeD"); |
| 24 | |
| 25 | // 在pipeline中添加一个事件信息,通过 notify("my-print-event")触发 |
| 26 | pipeline->addGEvent<MyPrintEvent>("my-print-event"); |
| 27 | pipeline->process(); |
| 28 | |
| 29 | GPipelineFactory::clear(); |
| 30 | } |
| 31 | |
| 32 | |
| 33 | int main() { |