* Retrieve all direct and indirect children of the current Checkable. * * Note, this function performs a recursive call chain traversing all the children of the current Checkable * up to a certain limit (256). When that limit is reached, it will log a warning message and abort the operation. * * @param seenChildren - A container to store all the traversed children into. * @param level - The
| 278 | * @param level - The current level of recursion. |
| 279 | */ |
| 280 | void Checkable::GetAllChildrenInternal(std::set<Checkable::Ptr>& seenChildren, int level) const |
| 281 | { |
| 282 | if (level > Dependency::MaxDependencyRecursionLevel) { |
| 283 | Log(LogWarning, "Checkable") |
| 284 | << "Too many nested dependencies (>" << Dependency::MaxDependencyRecursionLevel << ") for checkable '" |
| 285 | << GetName() << "': aborting traversal."; |
| 286 | return; |
| 287 | } |
| 288 | |
| 289 | for (const Checkable::Ptr& checkable : GetChildren()) { |
| 290 | if (auto [_, inserted] = seenChildren.insert(checkable); inserted) { |
| 291 | checkable->GetAllChildrenInternal(seenChildren, level + 1); |
| 292 | } |
| 293 | } |
| 294 | } |