* Checks that adding these new dependencies to the configuration does not introduce any cycles. * * This is done as an optimization: cycles are checked once for all dependencies in a batch of config objects instead * of individually per dependency in Dependency::OnAllConfigLoaded(). For runtime updates, this function may still be * called for single objects. * * @param items Config items con
| 151 | * @param items Config items containing Dependency objects added to the running configuration. |
| 152 | */ |
| 153 | void Dependency::BeforeOnAllConfigLoadedHandler(const ConfigItems& items) |
| 154 | { |
| 155 | DependencyCycleChecker checker; |
| 156 | |
| 157 | // Resolve parent/child names to Checkable::Ptr and temporarily add the edges to the checker. |
| 158 | // The dependencies are later registered to the checkables by Dependency::OnAllConfigLoaded(). |
| 159 | items.ForEachObject<Dependency>([&checker](Dependency::Ptr dependency) { |
| 160 | dependency->InitChildParentReferences(); |
| 161 | checker.AddExtraDependency(std::move(dependency)); |
| 162 | }); |
| 163 | |
| 164 | // It's sufficient to search for cycles starting from newly added dependencies only: if a newly added dependency is |
| 165 | // part of a cycle, that cycle is reachable from both the child and the parent of that dependency. The cycle search |
| 166 | // is started from the parent as a slight optimization as that will traverse fewer edges if there is no cycle. |
| 167 | items.ForEachObject<Dependency>([&checker](const Dependency::Ptr& dependency) { |
| 168 | checker.AssertNoCycle(dependency->GetParent()); |
| 169 | }); |
| 170 | } |
| 171 | |
| 172 | String DependencyNameComposer::MakeName(const String& shortName, const Object::Ptr& context) const |
| 173 | { |
nothing calls this directly
no test coverage detected