| 2447 | } |
| 2448 | |
| 2449 | std::vector<TxGraph::Ref*> TxGraphImpl::GetDescendants(const Ref& arg, Level level_select) noexcept |
| 2450 | { |
| 2451 | // Return the empty vector if the Ref is empty. |
| 2452 | if (GetRefGraph(arg) == nullptr) return {}; |
| 2453 | Assume(GetRefGraph(arg) == this); |
| 2454 | // Apply all removals and dependencies, as the result might be incorrect otherwise. |
| 2455 | size_t level = GetSpecifiedLevel(level_select); |
| 2456 | ApplyDependencies(level); |
| 2457 | // Ancestry cannot be known if unapplied dependencies remain. |
| 2458 | Assume(GetClusterSet(level).m_deps_to_add.empty()); |
| 2459 | // Find the Cluster the argument is in, and return the empty vector if it isn't in any. |
| 2460 | auto [cluster, cluster_level] = FindClusterAndLevel(GetRefIndex(arg), level); |
| 2461 | if (cluster == nullptr) return {}; |
| 2462 | // Dispatch to the Cluster. |
| 2463 | std::pair<Cluster*, DepGraphIndex> match = {cluster, m_entries[GetRefIndex(arg)].m_locator[cluster_level].index}; |
| 2464 | auto matches = std::span(&match, 1); |
| 2465 | std::vector<TxGraph::Ref*> ret; |
| 2466 | cluster->GetDescendantRefs(*this, matches, ret); |
| 2467 | return ret; |
| 2468 | } |
| 2469 | |
| 2470 | std::vector<TxGraph::Ref*> TxGraphImpl::GetAncestorsUnion(std::span<const Ref* const> args, Level level_select) noexcept |
| 2471 | { |