| 16 | |
| 17 | #if __cplusplus >= 201703L |
| 18 | void tutorial_storage_save(const std::string& path) { |
| 19 | GPipelinePtr pipeline = GPipelineFactory::create(); |
| 20 | GElementPtr a, b, c, d = nullptr; |
| 21 | |
| 22 | CStatus status = pipeline->registerGElement<MyNode1>(&a, {}, "nodeA"); |
| 23 | status += pipeline->registerGElement<MyNode2>(&b, {a}, "nodeB"); |
| 24 | status += pipeline->registerGElement<MyNode1>(&c, {a}, "nodeC"); |
| 25 | status += pipeline->registerGElement<MyNode2>(&d, {b, c}, "nodeD"); |
| 26 | status += pipeline->save(path); |
| 27 | if (status.isOK()) { |
| 28 | std::cout << "pipline have been save to " << path << std::endl; |
| 29 | } else { |
| 30 | std::cout << " save pipeline failed ...\n"; |
| 31 | } |
| 32 | |
| 33 | GPipelineFactory::remove(pipeline); // 析构当前pipeline即可 |
| 34 | } |
| 35 | |
| 36 | void tutorial_storage_load(const std::string& path) { |
| 37 | // 需要通过如下方式,提前注册所有的使用到的 meta 信息 |
no test coverage detected