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

Function tutorial_template

tutorial/T08-Template.cpp:14–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12using namespace CGraph;
13
14void tutorial_template() {
15 GPipelinePtr pipeline = GPipelineFactory::create();
16 GTemplateNodePtr<int, float> a = nullptr;
17 GTemplateNodePtr<int, float> b = nullptr;
18 GTemplateNodePtr<int> c = nullptr;
19 GElementPtr d = nullptr;
20
21 /**
22 * 注册几个模板节点
23 * 可以根据 MyTemplateNode 构造函数的不同,而实现不同的构造方式
24 * 也可以参考 MyTemplateV2Node 的方式进行构造
25 */
26 pipeline->registerGElement<MyTemplateNode<int, float>>(&a, {}, 3, 3.5f);
27 pipeline->registerGElement<MyTemplateNode<int, float>>(&b, {a}, 5, 3.75f);
28 pipeline->registerGElement<MyTemplateNode<int>>(&c, {b}, 8);
29 pipeline->registerGElement<MyTemplateV2Node<4>>(&d, {c}); // 也可以通过模板,传递参数数据
30
31 pipeline->process(); // 运行pipeline
32 GPipelineFactory::remove(pipeline);
33}
34
35
36int main() {

Callers 1

mainFunction · 0.70

Calls 3

createFunction · 0.85
removeFunction · 0.85
processMethod · 0.45

Tested by

no test coverage detected