MCPcopy Create free account
hub / github.com/AdaptiveCpp/AdaptiveCpp / recursive_find

Function recursive_find

src/runtime/dag_node.cpp:153–171  ·  view source on GitHub ↗

Looks recursively in the requirement graph of current for x. Descends no more than current_level levels and does not descend into requirements that are known to be complete.

Source from the content-addressed store, hash-verified

151// Descends no more than current_level levels and does not
152// descend into requirements that are known to be complete.
153bool recursive_find(const dag_node_ptr &current, int current_level,
154 const dag_node_ptr &x) {
155 if(!current)
156 return false;
157 if(current == x)
158 return true;
159 if(current_level <= 0)
160 return false;
161
162 for(const auto& req : current->get_requirements()) {
163 if(auto r = req.lock()) {
164 if(!r->is_known_complete()) {
165 if(recursive_find(r, current_level - 1, x))
166 return true;
167 }
168 }
169 }
170 return false;
171}
172
173
174

Callers 1

add_requirementMethod · 0.85

Calls 2

is_known_completeMethod · 0.80
lockMethod · 0.45

Tested by

no test coverage detected