MCPcopy Create free account
hub / github.com/chrxh/alien / getMatchingRawTOs

Method getMatchingRawTOs

source/Network/NetworkResourceService.cpp:260–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258}
259
260std::vector<NetworkResourceRawTO> NetworkResourceService::getMatchingRawTOs(NetworkResourceTreeTO const& treeTO, std::vector<NetworkResourceRawTO> const& rawTOs)
261{
262 if (treeTO->isLeaf()) {
263 return {treeTO->getLeaf().rawTO};
264 } else {
265 auto findResult = _treeTOtoRawTOcache.find(treeTO);
266 if (findResult != _treeTOtoRawTOcache.end()) {
267 return findResult->second;
268 }
269 std::vector<NetworkResourceRawTO> result;
270 for (auto const& [index, rawTO] : rawTOs | boost::adaptors::indexed(0)) {
271 auto folderNames = getFolderNames(rawTO->resourceName);
272 if (contains(folderNames, treeTO->folderNames)) {
273 result.emplace_back(rawTO);
274 }
275 }
276 _treeTOtoRawTOcache.emplace(treeTO, result);
277 return result;
278 }
279}
280
281void NetworkResourceService::invalidateCache()
282{

Callers 4

onEditResourceMethod · 0.80
onMoveResourceMethod · 0.80
onDeleteResourceMethod · 0.80
isOwnerMethod · 0.80

Calls 4

isLeafMethod · 0.80
findMethod · 0.80
endMethod · 0.80
containsFunction · 0.70

Tested by

no test coverage detected