diff --git a/src/GraphCtrl/GraphElement/_GEngine/GDynamicEngine/GDynamicEngine.cpp b/src/GraphCtrl/GraphElement/_GEngine/GDynamicEngine/GDynamicEngine.cpp index 32747f40..3154070f 100644 --- a/src/GraphCtrl/GraphElement/_GEngine/GDynamicEngine/GDynamicEngine.cpp +++ b/src/GraphCtrl/GraphElement/_GEngine/GDynamicEngine/GDynamicEngine.cpp @@ -111,11 +111,11 @@ CVoid GDynamicEngine::mark(const GSortedGElementPtrSet& elements) { CVoid GDynamicEngine::analysisDagType(const GSortedGElementPtrSet& elements) { - if (front_element_arr_.size() == 1 && total_element_arr_.size() - 1 == linked_size_) { + if (total_element_arr_.empty() || front_element_arr_.size() == 1 && total_element_arr_.size() - 1 == linked_size_) { /** * 如果所有的信息中,只有一个是非linkable。则说明只有开头的那个是的,且只有一个开头 * 故,这里将其认定为一条 lineal 的情况 - * ps: 只有一element的情况,也会被算到 ALL_SERIAL 中去 + * ps: 只有一个或者没有 element的情况,也会被算到 ALL_SERIAL 中去 */ dag_type_ = internal::GEngineDagType::ALL_SERIAL; } else if (total_element_arr_.size() == total_end_size_ && front_element_arr_.size() == total_end_size_) { diff --git a/src/GraphCtrl/GraphPipeline/GPipeline.h b/src/GraphCtrl/GraphPipeline/GPipeline.h index ef348da9..876a0ffe 100644 --- a/src/GraphCtrl/GraphPipeline/GPipeline.h +++ b/src/GraphCtrl/GraphPipeline/GPipeline.h @@ -218,16 +218,11 @@ class GPipeline : public GPipelineObject, * @param elementRef * @param dependElements * @return - * @notice Android平台NDK R16B 环境不支持 std::initializer_list<> 和 Args... 混用。参考链接:https://github.com/ChunelFeng/CGraph/pull/116 */ template, TNode>::value, int> = 0> CStatus registerGElement(GTemplateNodePtr *elementRef, - #if defined(__ANDROID__) const GElementPtrSet &dependElements, - #else - const GElementPtrSet &dependElements = std::initializer_list(), - #endif Args... args); /** diff --git a/src/UtilsCtrl/Trie/UTrieV2.cpp b/src/UtilsCtrl/Trie/UTrieV2.cpp index c9cdbd41..62e0d0ef 100644 --- a/src/UtilsCtrl/Trie/UTrieV2.cpp +++ b/src/UtilsCtrl/Trie/UTrieV2.cpp @@ -6,10 +6,10 @@ @Desc: ***************************/ +#include + #include "UTrieV2.h" #include "UTrieNode.h" -#include -#include CGRAPH_NAMESPACE_BEGIN @@ -17,6 +17,7 @@ UTrieV2::UTrieV2() { head_ = CGRAPH_SAFE_MALLOC_COBJECT(UTrieNode) } + UTrieV2::~UTrieV2() { clear(); CGRAPH_DELETE_PTR(head_) @@ -86,7 +87,7 @@ void UTrieV2::clear() { void UTrieV2::eraser(const std::string& path) { - if(head_ == nullptr || path.empty()) return; + if (head_ == nullptr || path.empty()) return; auto *node = head_; for(const auto &c : path) { int i = (int)c; diff --git a/tutorial/CMakeLists.txt b/tutorial/CMakeLists.txt index b9b5964f..94d14ff4 100644 --- a/tutorial/CMakeLists.txt +++ b/tutorial/CMakeLists.txt @@ -1,34 +1,33 @@ # 对应tutorial中的内容 set(CGRAPH_TUTORIAL_LIST - # T00-HelloCGraph - # T01-Simple - # T02-Cluster - # T03-Region - # T04-Complex - # T05-Param - # T06-Condition - # T07-MultiPipeline - # T08-Template - # T09-Aspect - # T10-AspectParam - # T11-Singleton - # T12-Function - # T13-Daemon - # T14-Hold - # T15-ElementParam - # T16-MessageSendRecv - # T17-MessagePubSub - # T18-Event - # T19-Cancel - # T20-YieldResume - # T21-MultiCondition - # T22-Timeout - # T23-Some - # T24-Fence - # T25-Coordinator - # T26-Mutable - TU03-TrieV2 + T00-HelloCGraph + T01-Simple + T02-Cluster + T03-Region + T04-Complex + T05-Param + T06-Condition + T07-MultiPipeline + T08-Template + T09-Aspect + T10-AspectParam + T11-Singleton + T12-Function + T13-Daemon + T14-Hold + T15-ElementParam + T16-MessageSendRecv + T17-MessagePubSub + T18-Event + T19-Cancel + T20-YieldResume + T21-MultiCondition + T22-Timeout + T23-Some + T24-Fence + T25-Coordinator + T26-Mutable ) diff --git a/tutorial/TU03-Trie.cpp b/tutorial/TU03-Trie.cpp index 193f7066..5cf6470d 100644 --- a/tutorial/TU03-Trie.cpp +++ b/tutorial/TU03-Trie.cpp @@ -27,7 +27,27 @@ void tutorial_trie() { } +void tutorial_trie_v2() { + UTrieV2 trieV2; + trieV2.insert("hello"); + trieV2.insert("help"); + trieV2.insert("cgraph"); // 插入几个单词 + + CGRAPH_ECHO("find [hello] result is : [%i]", trieV2.find("hello")); + CGRAPH_ECHO("find [cgraph] result is : [%i]", trieV2.find("cgraph")); + + trieV2.eraser("hello"); // 删去hello信息 + CGRAPH_ECHO("eraser [hello], then find it, result is : [%i]", trieV2.find("hello")); + + trieV2.insert("hello"); // 重新插入hello信息 + CGRAPH_ECHO("insert [hello] again, then find it, result is : [%i]", trieV2.find("hello")); +} + + int main() { + printf("----------------- trie -----------------\n"); tutorial_trie(); + printf("----------------- trie v2 -----------------\n"); + tutorial_trie_v2(); return 0; } diff --git a/tutorial/TU03-TrieV2.cpp b/tutorial/TU03-TrieV2.cpp deleted file mode 100644 index cbe42f64..00000000 --- a/tutorial/TU03-TrieV2.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/*************************** -@Author: Chunel -@Contact: chunel@foxmail.com -@File: T03-Trie.cpp -@Time: 2021/9/19 5:28 下午 -@Desc: 本例主要演示,Trie的使用方法 -***************************/ - -#include "../src/CGraph.h" - -using namespace CGraph; - -void tutorial_trie() { - UTrieV2 trie; - trie.insert("hello"); - trie.insert("help"); - trie.insert("cgraph"); // 插入几个单词 - - CGRAPH_ECHO("find [hello] result is : [%i]", trie.find("hello")); - CGRAPH_ECHO("find [cgraph] result is : [%i]", trie.find("cgraph")); - - trie.eraser("hello"); // 删去hello信息 - CGRAPH_ECHO("eraser [hello], then find it, result is : [%i]", trie.find("hello")); - - trie.insert("hello"); // 重新插入hello信息 - CGRAPH_ECHO("insert [hello] again, then find it, result is : [%i]", trie.find("hello")); -} - - -int main() { - tutorial_trie(); - return 0; -}