| 79 | //=== Helper methods for analysing the structures. |
| 80 | |
| 81 | std::vector<string> DumpLinkMap(const GenNode::LinkMap& link_map) { |
| 82 | // This will order the entries first. |
| 83 | std::map<string, string> ordered; |
| 84 | for (const auto& link : link_map) { |
| 85 | string key = string(link.first); |
| 86 | |
| 87 | // Order the other sides too. They may be repeating, so store them |
| 88 | // in a multiset. |
| 89 | std::multiset<string> others; |
| 90 | for (const auto& other : link.second) { |
| 91 | others.emplace( |
| 92 | absl::StrFormat("%s[%s]", other.node->name(), string(other.port))); |
| 93 | } |
| 94 | ordered[key] = absl::StrJoin(others, ", "); |
| 95 | } |
| 96 | // Now dump the result in a predictable order. |
| 97 | std::vector<string> result; |
| 98 | result.reserve(ordered.size()); |
| 99 | for (const auto& link : ordered) { |
| 100 | result.emplace_back(link.first + ": " + link.second); |
| 101 | } |
| 102 | return result; |
| 103 | } |
| 104 | |
| 105 | std::vector<string> DumpLinkHashMap(const SigNode::LinkHashMap& link_hash_map) { |
| 106 | // The entries in this map are ordered by hash value which might change |