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

Function tutorial_storage_save

tutorial/T29-Storage.cpp:18–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16
17 #if __cplusplus >= 201703L
18void 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
36void tutorial_storage_load(const std::string& path) {
37 // 需要通过如下方式,提前注册所有的使用到的 meta 信息

Callers 1

tutorial_storageFunction · 0.85

Calls 4

createFunction · 0.85
removeFunction · 0.85
isOKMethod · 0.80
saveMethod · 0.45

Tested by

no test coverage detected