MCPcopy Create free account
hub / github.com/Icinga/icinga2 / GetAllChildrenInternal

Method GetAllChildrenInternal

lib/icinga/checkable-dependency.cpp:280–294  ·  view source on GitHub ↗

* 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

Source from the content-addressed store, hash-verified

278 * @param level - The current level of recursion.
279 */
280void 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}

Callers

nothing calls this directly

Calls 2

LogClass · 0.85
insertMethod · 0.45

Tested by

no test coverage detected