forked from ChunelFeng/CGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathT08-Template.cpp
More file actions
34 lines (27 loc) · 950 Bytes
/
T08-Template.cpp
File metadata and controls
34 lines (27 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/***************************
@Author: Chunel
@Contact: chunel@foxmail.com
@File: T08-Template.cpp
@Time: 2021/9/18 9:52 下午
@Desc: 本例主要演示,注册节点的时候,传入模板类型的情况
***************************/
#include "MyGNode/MyTemplateNode.h"
using namespace CGraph;
void tutorial_template() {
GPipelinePtr pipeline = GPipelineFactory::create();
GElementPtr a, b, c, d = nullptr;
/**
* 依次注册 int/char/float/string 类型的模板节点 a/b/c/d
* 然后依次执行,查看效果
*/
pipeline->registerGElement<MyTemplateNode<int>>(&a);
pipeline->registerGElement<MyTemplateNode<char>>(&b, {a});
pipeline->registerGElement<MyTemplateNode<float>>(&c, {b});
pipeline->registerGElement<MyTemplateNode<std::string>>(&d, {c});
pipeline->process(); // 运行pipeline
GPipelineFactory::destroy(pipeline);
}
int main() {
tutorial_template();
return 0;
}