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

Method checkSerializable

src/GraphCtrl/GraphElement/GElementManager.cpp:139–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137
138
139CBool GElementManager::checkSerializable() {
140 if (engine_type_ != GEngineType::DYNAMIC) {
141 return false; // 目前仅支持动态引擎的执行方式
142 }
143
144 /**
145 * 判定思路:
146 * 1. 内部的element,均为可串行执行的
147 * 2. 当前element,不超过1个前驱或者后继
148 * 3. 有且仅有一个起点,一个终点
149 * 4. 有超时逻辑
150 */
151 int frontSize = 0, tailSize = 0;
152 for (auto& cur : manager_elements_) {
153 if (!cur->isSerializable()
154 || cur->run_before_.size() > 1
155 || cur->dependence_.size() > 1
156 || cur->isAsync()) {
157 return false;
158 }
159
160 if (cur->dependence_.empty()) {
161 frontSize++;
162 }
163 if (cur->run_before_.empty()) {
164 tailSize++;
165 }
166 }
167
168 return (1 == frontSize) && (1 == tailSize);
169}
170
171
172CSize GElementManager::trim() {

Callers 2

makeSerialMethod · 0.80
isSerializableMethod · 0.80

Calls 2

isAsyncMethod · 0.80
isSerializableMethod · 0.45

Tested by

no test coverage detected