| 34 | } |
| 35 | |
| 36 | void tutorial_storage_load(const std::string& path) { |
| 37 | // 需要通过如下方式,提前注册所有的使用到的 meta 信息 |
| 38 | CGRAPH_REGISTER_META_TYPE(MyNode1); |
| 39 | CGRAPH_REGISTER_META_TYPE(MyNode2); |
| 40 | |
| 41 | GPipelinePtr pipeline = GPipelineFactory::create(); // 创建一个新的pipeline,用于加载 |
| 42 | std::cout << "create another pipeline, and load pipeline for path : " << path << std::endl; |
| 43 | CStatus status = pipeline->load(path); |
| 44 | if (status.isErr()) { |
| 45 | std::cout << status.getInfo() << std::endl; |
| 46 | return; |
| 47 | } |
| 48 | |
| 49 | pipeline->process(); |
| 50 | GPipelineFactory::remove(pipeline); |
| 51 | |
| 52 | // 删除存储文件 |
| 53 | std::remove(path.c_str()); |
| 54 | } |
| 55 | |
| 56 | void tutorial_storage() { |
| 57 | const std::string& path = "storage.cgraph"; |