MCPcopy Create free account
hub / github.com/ChunelFeng/CGraph / tutorial_storage_load

Function tutorial_storage_load

tutorial/T29-Storage.cpp:36–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36void 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
56void tutorial_storage() {
57 const std::string& path = "storage.cgraph";

Callers 1

tutorial_storageFunction · 0.85

Calls 5

createFunction · 0.85
removeFunction · 0.85
loadMethod · 0.80
isErrMethod · 0.80
processMethod · 0.45

Tested by

no test coverage detected