* Detach the provided child Checkable from the specified dependency group. * * Unregisters all the dependency objects the child Checkable depends on from the provided dependency group and * removes the dependency group from the global registry if it becomes empty afterward. * * @param dependencyGroup The dependency group to unregister the child Checkable from. * @param child The child Checka
| 44 | * and a boolean indicating whether the dependency group has been erased from the global registry. |
| 45 | */ |
| 46 | std::pair<std::set<Dependency::Ptr>, bool> DependencyGroup::Unregister(const DependencyGroup::Ptr& dependencyGroup, const Checkable::Ptr& child) |
| 47 | { |
| 48 | std::lock_guard lock(m_RegistryMutex); |
| 49 | if (auto it(m_Registry.find(dependencyGroup)); it != m_Registry.end()) { |
| 50 | auto& existingGroup(*it); |
| 51 | auto dependencies(existingGroup->GetDependenciesForChild(child.get())); |
| 52 | |
| 53 | for (const auto& dependency : dependencies) { |
| 54 | existingGroup->RemoveDependency(dependency); |
| 55 | } |
| 56 | |
| 57 | bool remove = !existingGroup->HasChildren(); |
| 58 | if (remove) { |
| 59 | m_Registry.erase(it); |
| 60 | } |
| 61 | return {{dependencies.begin(), dependencies.end()}, remove}; |
| 62 | } |
| 63 | return {{}, false}; |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Retrieve the size of the global dependency group registry. |
nothing calls this directly
no test coverage detected