diff --git a/src/GraphCtrl/GraphAspect/GAspectManager.cpp b/src/GraphCtrl/GraphAspect/GAspectManager.cpp index 7e0fe9fa..7096bb07 100644 --- a/src/GraphCtrl/GraphAspect/GAspectManager.cpp +++ b/src/GraphCtrl/GraphAspect/GAspectManager.cpp @@ -69,7 +69,7 @@ CStatus GAspectManager::add(GAspectPtr aspect) { } -GAspectManager *GAspectManager::setName(const std::string &name) { +GAspectManagerPtr GAspectManager::setName(const std::string &name) { for (GAspectPtr aspect : aspect_arr_) { CGRAPH_ASSERT_NOT_NULL_THROW_ERROR(aspect) aspect->setName(name); diff --git a/src/GraphCtrl/GraphElement/_GEngine/GEngineDefine.h b/src/GraphCtrl/GraphElement/_GEngine/GEngineDefine.h index 6a8a1b6f..5ee4640f 100644 --- a/src/GraphCtrl/GraphElement/_GEngine/GEngineDefine.h +++ b/src/GraphCtrl/GraphElement/_GEngine/GEngineDefine.h @@ -14,7 +14,7 @@ CGRAPH_NAMESPACE_BEGIN enum class GEngineType { STATIC = 1, /** 静态图运行 */ DYNAMIC = 2, /** 动态图运行 */ - TOPO = 3, /** 拓扑运行(针对仅包含node的情况) */ + TOPO = 3, /** 拓扑运行 */ }; CGRAPH_NAMESPACE_END diff --git a/tutorial/MyGNode/MyTemplateV2Node.h b/tutorial/MyGNode/MyTemplateV2Node.h new file mode 100644 index 00000000..08b27392 --- /dev/null +++ b/tutorial/MyGNode/MyTemplateV2Node.h @@ -0,0 +1,23 @@ +/*************************** +@Author: Chunel +@Contact: chunel@foxmail.com +@File: MyTemplateV2Node.h +@Time: 2024/2/1 21:51 +@Desc: +***************************/ + +#ifndef CGRAPH_MYTEMPLATEV2NODE_H +#define CGRAPH_MYTEMPLATEV2NODE_H + +#include "CGraph.h" + +template +class MyTemplateV2Node : public CGraph::GNode { +public: + CStatus run() override { + CGraph::CGRAPH_ECHO("[MyTemplateV2Node] template id = [%d] ", TID); + return CStatus(); + } +}; + +#endif //CGRAPH_MYTEMPLATEV2NODE_H diff --git a/tutorial/T08-Template.cpp b/tutorial/T08-Template.cpp index 34a84f5a..6b113baa 100644 --- a/tutorial/T08-Template.cpp +++ b/tutorial/T08-Template.cpp @@ -7,6 +7,7 @@ ***************************/ #include "MyGNode/MyTemplateNode.h" +#include "MyGNode/MyTemplateV2Node.h" using namespace CGraph; @@ -15,14 +16,17 @@ void tutorial_template() { GTemplateNodePtr a = nullptr; GTemplateNodePtr b = nullptr; GTemplateNodePtr c = nullptr; + GElementPtr d = nullptr; /** * 注册几个模板节点 - * 可以根据 MyTemplateNode构造函数的不同,而实现不同的构造方式 + * 可以根据 MyTemplateNode 构造函数的不同,而实现不同的构造方式 + * 也可以参考 MyTemplateV2Node 的方式进行构造 */ pipeline->registerGElement>(&a, {}, 3, 3.5f); pipeline->registerGElement>(&b, {a},5, 3.75f); pipeline->registerGElement>(&c, {b}, 8); + pipeline->registerGElement>(&d, {c}); // 也可以通过模板,传递参数数据 pipeline->process(); // 运行pipeline GPipelineFactory::remove(pipeline);