| 2203 | } |
| 2204 | |
| 2205 | void Storage::GetGroupNodePathToRoot(CountryId const & groupNode, CountriesVec & path) const |
| 2206 | { |
| 2207 | path.clear(); |
| 2208 | |
| 2209 | CountryTree::NodesBufferT nodes; |
| 2210 | m_countries.Find(groupNode, nodes); |
| 2211 | if (nodes.empty()) |
| 2212 | { |
| 2213 | LOG(LWARNING, ("CountryId =", groupNode, "not found in m_countries.")); |
| 2214 | return; |
| 2215 | } |
| 2216 | |
| 2217 | if (nodes.size() != 1) |
| 2218 | { |
| 2219 | LOG(LWARNING, (groupNode, "Group node can't have more than one parent.")); |
| 2220 | return; |
| 2221 | } |
| 2222 | |
| 2223 | if (nodes[0]->ChildrenCount() == 0) |
| 2224 | { |
| 2225 | LOG(LWARNING, (nodes[0]->Value().Name(), "is a leaf node.")); |
| 2226 | return; |
| 2227 | } |
| 2228 | |
| 2229 | ForEachAncestorExceptForTheRoot(nodes, |
| 2230 | [&path](CountryId const & id, CountryTree::Node const &) { path.push_back(id); }); |
| 2231 | path.push_back(m_countries.GetRoot().Value().Name()); |
| 2232 | } |
| 2233 | |
| 2234 | void Storage::GetTopmostNodesFor(CountryId const & countryId, CountriesVec & nodes, size_t level) const |
| 2235 | { |