[core] Switch to ankerl::unordered_dense

Signed-off-by: x7z4w <x7z4w@noreply.codeberg.org>
This commit is contained in:
x7z4w
2025-11-24 17:34:56 +00:00
parent 03132c6877
commit ef6522ed28
282 changed files with 4386 additions and 1456 deletions

View File

@@ -1,7 +1,7 @@
#pragma once
#include "generator/collector_interface.hpp"
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
namespace generator
{
@@ -18,7 +18,7 @@ public:
};
private:
std::unordered_map<uint64_t, AddressInfo> m_addresses;
ankerl::unordered_dense::map<uint64_t, AddressInfo> m_addresses;
public:
void Add(feature::FeatureBuilder const & fb);
@@ -44,7 +44,7 @@ class AddressesCollector : public CollectorInterface
uint64_t m_beg, m_end;
};
// OSM Way ID is a key here.
std::unordered_map<uint64_t, WayInfo> m_interpolWays;
ankerl::unordered_dense::map<uint64_t, WayInfo> m_interpolWays;
public:
explicit AddressesCollector(std::string const & filename);

View File

@@ -133,7 +133,7 @@ template <typename T>
std::vector<std::string> GetHonestAffiliations(T && t, IndexSharedPtr const & index)
{
std::vector<std::string> affiliations;
std::unordered_set<borders::CountryPolygons const *> countires;
ankerl::unordered_dense::set<borders::CountryPolygons const *> countires;
ForEachPoint(t, [&](auto const & point)
{
std::vector<CountriesFilesIndexAffiliation::Value> values;
@@ -196,7 +196,7 @@ CountriesFilesIndexAffiliation::CountriesFilesIndexAffiliation(std::string const
: CountriesFilesAffiliation(borderPath, haveBordersForWholeWorld)
{
static std::mutex cacheMutex;
static std::unordered_map<std::string, std::shared_ptr<Tree>> cache;
static ankerl::unordered_dense::map<std::string, std::shared_ptr<Tree>> cache;
auto const key = borderPath + std::to_string(haveBordersForWholeWorld);
std::lock_guard<std::mutex> lock(cacheMutex);
@@ -228,7 +228,7 @@ std::vector<std::string> CountriesFilesIndexAffiliation::GetAffiliations(m2::Poi
std::shared_ptr<CountriesFilesIndexAffiliation::Tree> CountriesFilesIndexAffiliation::BuildIndex(
std::vector<m2::RectD> const & net)
{
std::unordered_map<borders::CountryPolygons const *, std::vector<m2::RectD>> countriesRects;
ankerl::unordered_dense::map<borders::CountryPolygons const *, std::vector<m2::RectD>> countriesRects;
std::mutex countriesRectsMutex;
std::vector<Value> treeCells;
std::mutex treeCellsMutex;

View File

@@ -262,7 +262,7 @@ CountryPolygonsCollection const & GetOrCreateCountryPolygonsTree(std::string con
{
/// @todo Are there many different paths with polygons, that we have to store map?
static std::mutex mutex;
static std::unordered_map<std::string, CountryPolygonsCollection> countriesMap;
static ankerl::unordered_dense::map<std::string, CountryPolygonsCollection> countriesMap;
std::lock_guard<std::mutex> lock(mutex);
auto const it = countriesMap.find(baseDir);

View File

@@ -10,10 +10,10 @@
#include "geometry/tree4d.hpp"
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
#define BORDERS_DIR "borders/"
#define BORDERS_EXTENSION ".poly"
@@ -112,7 +112,7 @@ public:
template <typename ToDo>
void ForEachCountryInRect(m2::RectD const & rect, ToDo && toDo) const
{
std::unordered_set<CountryPolygons const *> uniq;
ankerl::unordered_dense::set<CountryPolygons const *> uniq;
m_regionsTree.ForEachInRect(rect, [&](CountryPolygons const & cp)
{
if (uniq.insert(&cp).second)
@@ -131,7 +131,7 @@ public:
private:
m4::Tree<std::reference_wrapper<CountryPolygons const>> m_regionsTree;
std::unordered_map<std::string, CountryPolygons> m_countryPolygonsMap;
ankerl::unordered_dense::map<std::string, CountryPolygons> m_countryPolygonsMap;
};
using PolygonsList = std::vector<Polygon>;

View File

@@ -15,10 +15,12 @@
#include <utility>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace generator
{
using base::GeoObjectId;
using std::pair, std::string, std::unordered_map, std::vector;
using std::pair, std::string, ankerl::unordered_dense::map, std::vector;
DECLARE_EXCEPTION(ParsingError, RootException);
@@ -42,7 +44,7 @@ static void ParseFeatureToBrand(json_t * root, string const & field, GeoObjectId
}
}
void ParseTranslations(json_t * root, std::set<string> const & keys, unordered_map<uint32_t, string> & idToKey)
void ParseTranslations(json_t * root, std::set<string> const & keys, map<uint32_t, string> & idToKey)
{
string const empty;
auto getKey = [&](string & translation) -> string const &
@@ -81,8 +83,7 @@ void ParseTranslations(json_t * root, std::set<string> const & keys, unordered_m
}
}
bool LoadBrands(string const & brandsFilename, string const & translationsFilename,
unordered_map<GeoObjectId, string> & brands)
bool LoadBrands(string const & brandsFilename, string const & translationsFilename, map<GeoObjectId, string> & brands)
{
string jsonBuffer;
try
@@ -126,7 +127,7 @@ bool LoadBrands(string const & brandsFilename, string const & translationsFilena
return false;
}
unordered_map<uint32_t, string> idToKey;
map<uint32_t, string> idToKey;
try
{
base::Json root(jsonBuffer.c_str());

View File

@@ -3,7 +3,8 @@
#include "base/geo_object_id.hpp"
#include <string>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
namespace generator
{
@@ -52,5 +53,5 @@ namespace generator
// name is "Сабвей", then "Сабвэй".
bool LoadBrands(std::string const & brandsFilename, std::string const & translationsFilename,
std::unordered_map<base::GeoObjectId, std::string> & brands);
ankerl::unordered_dense::map<base::GeoObjectId, std::string> & brands);
} // namespace generator

View File

@@ -16,9 +16,10 @@
#include "base/logging.hpp"
#include <memory>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
#include "defines.hpp"
namespace generator
@@ -60,7 +61,7 @@ bool BuildCitiesBoundaries(string const & dataPath, BoundariesTable & table, Map
bool BuildCitiesBoundaries(string const & dataPath, OsmIdToBoundariesTable & table)
{
std::unordered_map<uint32_t, base::GeoObjectId> mapping;
ankerl::unordered_dense::map<uint32_t, base::GeoObjectId> mapping;
if (!ParseFeatureIdToOsmIdMapping(dataPath + OSM2FEATURE_FILE_EXTENSION, mapping))
{
LOG(LERROR, ("Can't parse feature id to osm id mapping."));
@@ -71,7 +72,7 @@ bool BuildCitiesBoundaries(string const & dataPath, OsmIdToBoundariesTable & tab
bool BuildCitiesBoundariesForTesting(string const & dataPath, TestIdToBoundariesTable & table)
{
std::unordered_map<uint32_t, uint64_t> mapping;
ankerl::unordered_dense::map<uint32_t, uint64_t> mapping;
if (!ParseFeatureIdToTestIdMapping(dataPath, mapping))
{
LOG(LERROR, ("Can't parse feature id to test id mapping."));

View File

@@ -6,21 +6,18 @@
#include "indexer/data_header.hpp"
#include "indexer/feature_to_osm.hpp"
#include "search/categories_cache.hpp"
#include "search/cbv.hpp"
#include "search/localities_source.hpp"
#include "search/mwm_context.hpp"
#include "coding/file_writer.hpp"
#include "coding/files_container.hpp"
#include "base/cancellable.hpp"
#include "base/checked_cast.hpp"
#include "base/geo_object_id.hpp"
#include "base/logging.hpp"
#include <cstdint>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
#include "defines.hpp"
@@ -40,7 +37,7 @@ bool IsWorldMwm(std::string const & path)
}
void WriteCitiesIdsSectionToFile(std::string const & dataPath,
std::unordered_map<uint32_t, base::GeoObjectId> const & mapping)
ankerl::unordered_dense::map<uint32_t, base::GeoObjectId> const & mapping)
{
indexer::FeatureIdToGeoObjectIdBimapMem map;
auto const localities = generator::GetLocalities(dataPath);
@@ -89,7 +86,7 @@ bool BuildCitiesIds(std::string const & dataPath, std::string const & osmToFeatu
classificator::Load();
std::unordered_map<uint32_t, base::GeoObjectId> mapping;
ankerl::unordered_dense::map<uint32_t, base::GeoObjectId> mapping;
if (!ParseFeatureIdToOsmIdMapping(osmToFeaturePath, mapping))
{
LOG(LERROR, ("Can't parse feature id to osm id mapping."));
@@ -104,11 +101,11 @@ bool BuildCitiesIdsForTesting(std::string const & dataPath)
{
CHECK(IsWorldMwm(dataPath), ());
std::unordered_map<uint32_t, uint64_t> mapping;
ankerl::unordered_dense::map<uint32_t, uint64_t> mapping;
if (!ParseFeatureIdToTestIdMapping(dataPath, mapping))
return false;
std::unordered_map<uint32_t, base::GeoObjectId> mappingToGeoObjects;
ankerl::unordered_dense::map<uint32_t, base::GeoObjectId> mappingToGeoObjects;
for (auto const & entry : mapping)
{
// todo(@m) Make test ids a new source in base::GeoObjectId?

View File

@@ -19,9 +19,10 @@
#include "base/stl_helpers.hpp"
#include <algorithm>
#include <unordered_map>
#include <utility>
#include "3party/ankerl/unordered_dense.h"
namespace
{
using IdRelationVec = std::vector<std::pair<uint64_t, RelationElement>>;

View File

@@ -6,9 +6,10 @@
#include <optional>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
template <typename T>
class ReaderSource;
@@ -82,6 +83,6 @@ private:
IDRInterfacePtr m_cache;
std::vector<uint64_t> m_roadOsmIDs;
std::unordered_map<uint64_t, CameraInfo> m_speedCameras;
ankerl::unordered_dense::map<uint64_t, CameraInfo> m_speedCameras;
};
} // namespace routing_builder

View File

@@ -4,8 +4,7 @@
#include "generator/mini_roundabout_info.hpp"
#include "generator/way_nodes_mapper.hpp"
#include <unordered_map>
#include <unordered_set>
#include "3party/ankerl/unordered_dense.h"
namespace generator
{
@@ -39,7 +38,7 @@ private:
IDRInterfacePtr m_cache;
WaysIDHolder m_roads;
std::unordered_map<uint64_t, MiniRoundaboutInfo> m_miniRoundabouts;
std::unordered_set<uint64_t> m_miniRoundaboutsExceptions;
ankerl::unordered_dense::map<uint64_t, MiniRoundaboutInfo> m_miniRoundabouts;
ankerl::unordered_dense::set<uint64_t> m_miniRoundaboutsExceptions;
};
} // namespace generator

View File

@@ -92,7 +92,7 @@ public:
private:
// Value is an index in m_data vector.
std::unordered_map<IDType, uint64_t> m_id2index;
ankerl::unordered_dense::map<IDType, uint64_t> m_id2index;
std::vector<Locality> m_data;
};
@@ -107,10 +107,10 @@ public:
void Save(std::string const & fileName);
private:
std::unordered_map<IDType, Locality> m_id2loc;
using IDsSetT = std::unordered_set<IDType>;
std::unordered_map<IDType, IDsSetT> m_node2rel;
std::unordered_map<std::string, IDsSetT> m_name2rel;
ankerl::unordered_dense::map<IDType, Locality> m_id2loc;
using IDsSetT = ankerl::unordered_dense::set<IDType>;
ankerl::unordered_dense::map<IDType, IDsSetT> m_node2rel;
ankerl::unordered_dense::map<std::string, IDsSetT> m_name2rel;
};
class RoutingCityBoundariesCollector : public CollectorInterface

View File

@@ -45,9 +45,9 @@ tree_node::Forest<HierarchyEntry> const & ComplexLoader::GetForest(storage::Coun
return it == std::cend(m_forests) ? kEmpty : it->second;
}
std::unordered_set<CompositeId> ComplexLoader::GetIdsSet() const
ankerl::unordered_dense::set<CompositeId> ComplexLoader::GetIdsSet() const
{
std::unordered_set<CompositeId> set;
ankerl::unordered_dense::set<CompositeId> set;
ForEach([&](auto const &, auto const & forest)
{
forest.ForEachTree([&](auto const & tree)
@@ -59,7 +59,7 @@ std::unordered_set<CompositeId> ComplexLoader::GetIdsSet() const
ComplexLoader const & GetOrCreateComplexLoader(std::string const & filename)
{
static std::mutex m;
static std::unordered_map<std::string, ComplexLoader> complexLoaders;
static ankerl::unordered_dense::map<std::string, ComplexLoader> complexLoaders;
std::lock_guard<std::mutex> lock(m);
auto const it = complexLoaders.find(filename);

View File

@@ -8,10 +8,10 @@
#include <functional>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace generator
{
namespace complex
@@ -36,10 +36,10 @@ public:
fn(pair.first, pair.second);
}
std::unordered_set<CompositeId> GetIdsSet() const;
ankerl::unordered_dense::set<CompositeId> GetIdsSet() const;
private:
std::unordered_map<storage::CountryId, tree_node::Forest<HierarchyEntry>> m_forests;
ankerl::unordered_dense::map<storage::CountryId, tree_node::Forest<HierarchyEntry>> m_forests;
};
// Returns true if hierarchy tree is complex; otherwise returns false.

View File

@@ -8,7 +8,8 @@
#include <array>
#include <string>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
class FeatureType;
@@ -22,8 +23,8 @@ public:
std::optional<std::string> GetWikidataId(uint32_t featureId) const;
private:
std::unordered_map<uint32_t, base::GeoObjectId> m_featureIdToOsmId;
std::unordered_map<base::GeoObjectId, std::string> m_osmIdToWikidataId;
ankerl::unordered_dense::map<uint32_t, base::GeoObjectId> m_featureIdToOsmId;
ankerl::unordered_dense::map<base::GeoObjectId, std::string> m_osmIdToWikidataId;
};
class DescriptionsCollectionBuilderStat
@@ -88,7 +89,7 @@ public:
descriptions::DescriptionsCollection m_collection;
private:
std::unordered_map<std::string, descriptions::StringIndex> m_path2Index;
ankerl::unordered_dense::map<std::string, descriptions::StringIndex> m_path2Index;
WikidataHelper m_wikidataHelper;
std::string m_wikipediaDir;

View File

@@ -220,9 +220,7 @@ bool FeatureBuilder::PreSerialize()
{
StringUtf8Multilang nameWithRef;
m_params.name.ForEach([&nameWithRef, this](int8_t code, std::string_view name)
{
nameWithRef.AddString(code, std::string(name) + " (" + m_params.ref + ")");
});
{ nameWithRef.AddString(code, std::string(name) + " (" + m_params.ref + ")"); });
m_params.name = std::move(nameWithRef);
}
else if (ftypes::IsEmergencyAccessPointChecker::Instance()(types))

View File

@@ -16,9 +16,10 @@
#include "base/stl_helpers.hpp"
#include <functional>
#include <unordered_map>
#include <utility>
#include "3party/ankerl/unordered_dense.h"
#include "std/target_os.hpp"
///////////////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -214,7 +214,7 @@ void PreserializeLayer::Handle(FeatureBuilder & fb)
LayerBase::Handle(fb);
}
ComplexFeaturesMixer::ComplexFeaturesMixer(std::unordered_set<CompositeId> const & hierarchyNodesSet)
ComplexFeaturesMixer::ComplexFeaturesMixer(ankerl::unordered_dense::set<CompositeId> const & hierarchyNodesSet)
: m_hierarchyNodesSet(hierarchyNodesSet)
, m_complexEntryType(classif().GetTypeByPath({"complex_entry"}))
{

View File

@@ -9,7 +9,8 @@
#include <functional>
#include <memory>
#include <string>
#include <unordered_set>
#include "3party/ankerl/unordered_dense.h"
namespace generator
{
@@ -151,7 +152,7 @@ private:
class ComplexFeaturesMixer
{
public:
explicit ComplexFeaturesMixer(std::unordered_set<CompositeId> const & hierarchyNodesSet);
explicit ComplexFeaturesMixer(ankerl::unordered_dense::set<CompositeId> const & hierarchyNodesSet);
void Process(std::function<void(feature::FeatureBuilder &)> next,
feature::FeatureBuilder const & fb);
@@ -162,7 +163,7 @@ private:
feature::FeatureBuilder MakeComplexLineFrom(feature::FeatureBuilder const & fb);
feature::FeatureBuilder MakeComplexAreaFrom(feature::FeatureBuilder const & fb);
std::unordered_set<CompositeId> const & m_hierarchyNodesSet;
ankerl::unordered_dense::set<CompositeId> const & m_hierarchyNodesSet;
uint32_t const m_complexEntryType;
};
*/

View File

@@ -39,10 +39,9 @@
#include <functional>
#include <list>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
#include "cppjansson/cppjansson.hpp"
namespace generator
@@ -62,7 +61,7 @@ public:
private:
static bool IsMatch(Tags const & elementTags, Tags const & tags);
std::unordered_set<uint64_t> m_skippedIds;
ankerl::unordered_dense::set<uint64_t> m_skippedIds;
std::unordered_multimap<std::string, std::reference_wrapper<Tags const>> m_skippedTags;
std::list<Tags> m_rulesStorage;
};

View File

@@ -42,6 +42,7 @@ void CoastlineFinalProcessor::Process()
totalPolygons += fb.GetPolygonsCount();
}
LOG(LINFO, ("Total coastline features:", totalFeatures, "total polygons:", totalPolygons, "total points:", totalPoints));
LOG(LINFO,
("Total coastline features:", totalFeatures, "total polygons:", totalPolygons, "total points:", totalPoints));
}
} // namespace generator

View File

@@ -77,7 +77,7 @@ void ComplexFinalProcessor::Process()
// is contained in an object with tag 'building'. We will split data and work with
// these cases separately. First of all let's remove objects with tag building:part is
// contained in relations. We will add them back after data processing.
std::unordered_map<base::GeoObjectId, FeatureBuilder> relationBuildingParts;
ankerl::unordered_dense::map<base::GeoObjectId, FeatureBuilder> relationBuildingParts;
auto fbs = ReadAllDatRawFormat<serialization_policy::MaxAccuracy>(path);
@@ -141,7 +141,7 @@ void ComplexFinalProcessor::Process()
WriteLines(allLines);
}
std::unordered_map<base::GeoObjectId, FeatureBuilder> ComplexFinalProcessor::RemoveRelationBuildingParts(
ankerl::unordered_dense::map<base::GeoObjectId, FeatureBuilder> ComplexFinalProcessor::RemoveRelationBuildingParts(
std::vector<FeatureBuilder> & fbs)
{
CHECK(m_buildingToParts, ());
@@ -149,7 +149,7 @@ std::unordered_map<base::GeoObjectId, FeatureBuilder> ComplexFinalProcessor::Rem
auto it = std::partition(std::begin(fbs), std::end(fbs), [&](auto const & fb)
{ return !m_buildingToParts->HasBuildingPart(fb.GetMostGenericOsmId()); });
std::unordered_map<base::GeoObjectId, FeatureBuilder> buildingParts;
ankerl::unordered_dense::map<base::GeoObjectId, FeatureBuilder> buildingParts;
buildingParts.reserve(static_cast<size_t>(std::distance(it, std::end(fbs))));
std::transform(it, std::end(fbs), std::inserter(buildingParts, std::begin(buildingParts)), [](auto && fb)

View File

@@ -10,9 +10,10 @@
#include <cstddef>
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace generator
{
// Class ComplexFinalProcessor generates hierarchies for each previously filtered mwm.tmp file.
@@ -37,7 +38,7 @@ public:
private:
std::unique_ptr<hierarchy::HierarchyEntryEnricher> CreateEnricher(std::string const & countryName) const;
void WriteLines(std::vector<HierarchyEntry> const & lines);
std::unordered_map<base::GeoObjectId, feature::FeatureBuilder> RemoveRelationBuildingParts(
ankerl::unordered_dense::map<base::GeoObjectId, feature::FeatureBuilder> RemoveRelationBuildingParts(
std::vector<feature::FeatureBuilder> & fbs);
hierarchy::GetMainTypeFn m_getMainType;

View File

@@ -13,9 +13,10 @@
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace generator
{
@@ -44,7 +45,7 @@ std::vector<std::vector<std::string>> AppendToMwmTmp(std::vector<feature::Featur
std::string const & temporaryMwmPath, size_t threadsCount = 1)
{
auto affiliations = GetAffiliations(fbs, affiliation, threadsCount);
std::unordered_map<std::string, std::vector<size_t>> countryToFbsIndexes;
ankerl::unordered_dense::map<std::string, std::vector<size_t>> countryToFbsIndexes;
for (size_t i = 0; i < fbs.size(); ++i)
for (auto const & country : affiliations[i])
countryToFbsIndexes[country].emplace_back(i);

View File

@@ -7,7 +7,8 @@
#include "base/geo_object_id.hpp"
#include <string>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
namespace brands_loader_test
{
@@ -50,7 +51,7 @@ UNIT_TEST(LoadBrands)
ScopedFile const brandsFile("brands.json", kBrandsJson);
ScopedFile const translationsFile("translations.json", kBrandTranslationsJson);
std::unordered_map<GeoObjectId, std::string> brands;
ankerl::unordered_dense::map<GeoObjectId, std::string> brands;
TEST(LoadBrands(brandsFile.GetFullPath(), translationsFile.GetFullPath(), brands), ());
TEST_EQUAL(brands[GeoObjectId(GeoObjectId::Type::ObsoleteOsmNode, 2132500347)], "mcdonalds", ());
TEST_EQUAL(brands[GeoObjectId(GeoObjectId::Type::ObsoleteOsmWay, 440527172)], "mcdonalds", ());

View File

@@ -57,7 +57,7 @@ UNIT_CLASS_TEST(CitiesIdsTest, BuildCitiesIds)
indexer::FeatureIdToGeoObjectIdTwoWay twoWayMap(GetDataSource());
TEST(twoWayMap.Load(), ());
std::unordered_map<uint32_t, uint64_t> originalMapping;
ankerl::unordered_dense::map<uint32_t, uint64_t> originalMapping;
CHECK(ParseFeatureIdToTestIdMapping(worldMwmPath, originalMapping), ());
{

View File

@@ -16,13 +16,14 @@
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace collector_boundary_postcode_tests
{
using generator::tests_support::TestWithClassificator;
using std::string, std::vector, std::unordered_map;
using std::string, std::vector;
static string const kDumpFileName = "dump.bin";
@@ -31,7 +32,7 @@ static string const kDumpFileName = "dump.bin";
// 3--4--5
// | | |
// 6--7--8
unordered_map<uint64_t, m2::PointD> const kNodes = {
ankerl::unordered_dense::map<uint64_t, m2::PointD> const kNodes = {
{0, m2::PointD{-1.0, 1.0}}, {1, m2::PointD{0.0, 1.0}}, {2, m2::PointD{1.0, 1.0}},
{3, m2::PointD{-1.0, 0.0}}, {4, m2::PointD{0.0, 0.0}}, {5, m2::PointD{1.0, 0.0}},
{6, m2::PointD{-1.0, -1.0}}, {7, m2::PointD{0.0, -1.0}}, {8, m2::PointD{1.0, -1.0}}};
@@ -41,10 +42,10 @@ vector<uint64_t> const kPolygon2 = {6, 3, 4, 7, 6};
vector<uint64_t> const kPolygon3 = {8, 7, 4, 5, 8};
vector<uint64_t> const kPolygon4 = {0, 1, 4, 4, 0};
unordered_map<uint64_t, WayElement> const kWays = {{1, WayElement{1, kPolygon1}},
{2, WayElement{2, kPolygon2}},
{3, WayElement{3, kPolygon3}},
{4, WayElement{4, kPolygon4}}};
ankerl::unordered_dense::map<uint64_t, WayElement> const kWays = {{1, WayElement{1, kPolygon1}},
{2, WayElement{2, kPolygon2}},
{3, WayElement{3, kPolygon3}},
{4, WayElement{4, kPolygon4}}};
class IntermediateDataReaderTest : public generator::cache::IntermediateDataReaderInterface
{
@@ -82,12 +83,12 @@ auto const postcodeAreaRelation2 = MakePostcodeAreaRelation(2 /* id */, "127002"
auto const postcodeAreaRelation3 = MakePostcodeAreaRelation(3 /* id */, "127003" /* postcode */, 3 /* wayId */);
auto const postcodeAreaRelation4 = MakePostcodeAreaRelation(4 /* id */, "127004" /* postcode */, 4 /* wayId */);
unordered_map<string, vector<m2::PointD>> Read(string const & dumpFilename)
ankerl::unordered_dense::map<string, vector<m2::PointD>> Read(string const & dumpFilename)
{
FileReader reader(dumpFilename);
ReaderSource<FileReader> src(reader);
unordered_map<string, vector<m2::PointD>> result;
ankerl::unordered_dense::map<string, vector<m2::PointD>> result;
while (src.Size() > 0)
{
string postcode;
@@ -100,7 +101,7 @@ unordered_map<string, vector<m2::PointD>> Read(string const & dumpFilename)
return result;
}
bool CheckPostcodeExists(unordered_map<string, vector<m2::PointD>> const & data, string const & postcode,
bool CheckPostcodeExists(ankerl::unordered_dense::map<string, vector<m2::PointD>> const & data, string const & postcode,
vector<m2::PointD> const & geometry)
{
auto const it = data.find(postcode);

View File

@@ -12,7 +12,8 @@
#include "platform/platform_tests_support/scoped_file.hpp"
#include <memory>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
namespace collector_building_parts_tests
{
@@ -21,7 +22,7 @@ using namespace generator::tests_support;
class TestOSMElementCacheReader : public generator::cache::OSMElementCacheReaderInterface
{
public:
TestOSMElementCacheReader(std::unordered_map<generator::cache::Key, RelationElement> & m) : m_mapping(m) {}
TestOSMElementCacheReader(ankerl::unordered_dense::map<generator::cache::Key, RelationElement> & m) : m_mapping(m) {}
// OSMElementCacheReaderInterface overrides:
bool Read(generator::cache::Key /* id */, WayElement & /* value */) override { UNREACHABLE(); }
@@ -37,13 +38,13 @@ public:
}
private:
std::unordered_map<generator::cache::Key, RelationElement> & m_mapping;
ankerl::unordered_dense::map<generator::cache::Key, RelationElement> & m_mapping;
};
class IntermediateDataReaderTest : public generator::cache::IntermediateDataReaderInterface
{
public:
using IdToIds = std::unordered_map<generator::cache::Key, std::vector<generator::cache::Key>>;
using IdToIds = ankerl::unordered_dense::map<generator::cache::Key, std::vector<generator::cache::Key>>;
static generator::cache::Key const kTopRelationId1;
static generator::cache::Key const kOutlineId1;
@@ -129,7 +130,7 @@ private:
toDo(id, reader);
}
std::unordered_map<generator::cache::Key, RelationElement> m_IdToRelation;
ankerl::unordered_dense::map<generator::cache::Key, RelationElement> m_IdToRelation;
IdToIds m_wayToRelations;
IdToIds m_relationToRelations;
};

View File

@@ -124,12 +124,12 @@ UNIT_CLASS_TEST(TestRawGenerator, HighwayLinks)
using namespace routing;
MaxspeedType from120 = 104; // like SpeedMacro::Speed104KmPH
std::unordered_map<uint64_t, uint16_t> osmID2Speed = {
ankerl::unordered_dense::map<uint64_t, uint16_t> osmID2Speed = {
{23011515, from120}, {23011492, from120}, {10689329, from120}, {371581901, from120}, {1017695671, from120},
{577365212, from120}, {23011612, from120}, {1017695670, from120}, {304871606, from120}, {1017695669, from120},
{577365213, from120}, {369541035, from120}, {1014336646, from120}, {466365947, from120}, {23011511, from120}};
/// @todo Actually, better to assign speed for this way too.
std::unordered_set<uint64_t> osmNoSpeed = {23691193, 1017695668};
ankerl::unordered_dense::set<uint64_t> osmNoSpeed = {23691193, 1017695668};
FrozenDataSource dataSource;
auto const res = dataSource.RegisterMap(platform::LocalCountryFile::MakeTemporary(GetMwmPath(mwmName)));

View File

@@ -18,7 +18,7 @@ using namespace generator_tests;
class TestOSMElementCacheReader : public OSMElementCacheReaderInterface
{
public:
TestOSMElementCacheReader(std::unordered_map<Key, RelationElement> & m) : m_mapping(m) {}
TestOSMElementCacheReader(ankerl::unordered_dense::map<Key, RelationElement> & m) : m_mapping(m) {}
// OSMElementCacheReaderInterface overrides:
bool Read(Key /* id */, WayElement & /* value */) override { UNREACHABLE(); }
@@ -34,7 +34,7 @@ public:
}
private:
std::unordered_map<Key, RelationElement> & m_mapping;
ankerl::unordered_dense::map<Key, RelationElement> & m_mapping;
};
UNIT_TEST(Process_route_with_ref)
@@ -62,7 +62,7 @@ UNIT_TEST(Process_route_with_ref)
e1.m_tags.emplace("route", "road");
e1.m_tags.emplace("ref", "E-99");
std::unordered_map<Key, RelationElement> m_IdToRelation = {{1, e1}};
ankerl::unordered_dense::map<Key, RelationElement> m_IdToRelation = {{1, e1}};
TestOSMElementCacheReader reader(m_IdToRelation);
// Create roads.
@@ -111,7 +111,7 @@ UNIT_TEST(Process_route_with_ref_network)
e1.m_tags.emplace("ref", "SP60");
e1.m_tags.emplace("network", "IT:RA");
std::unordered_map<Key, RelationElement> m_IdToRelation = {{1, e1}};
ankerl::unordered_dense::map<Key, RelationElement> m_IdToRelation = {{1, e1}};
TestOSMElementCacheReader reader(m_IdToRelation);
// Create roads.
@@ -160,7 +160,7 @@ UNIT_TEST(Process_associatedStreet)
e1.m_tags.emplace("name", "Main Street");
e1.m_tags.emplace("wikipedia", "en:Main Street");
std::unordered_map<Key, RelationElement> m_IdToRelation = {{1, e1}};
ankerl::unordered_dense::map<Key, RelationElement> m_IdToRelation = {{1, e1}};
TestOSMElementCacheReader reader(m_IdToRelation);
// Create buildings polygons.
@@ -219,7 +219,7 @@ UNIT_TEST(RelationTags_GoodBoundary)
e1.m_tags.emplace("name:be", "Лiхтэнштэйн");
e1.m_tags.emplace("wikidata", "Q347");
std::unordered_map<Key, RelationElement> m_IdToRelation = {{1, e1}};
ankerl::unordered_dense::map<Key, RelationElement> m_IdToRelation = {{1, e1}};
TestOSMElementCacheReader reader(m_IdToRelation);
// Process ways tags using relation tags.
@@ -267,7 +267,7 @@ UNIT_TEST(RelationTags_BadBoundary)
e1.m_tags.emplace("name:en", "Italian Peninsula");
e1.m_tags.emplace("wikidata", "Q145694");
std::unordered_map<Key, RelationElement> m_IdToRelation = {{1, e1}};
ankerl::unordered_dense::map<Key, RelationElement> m_IdToRelation = {{1, e1}};
TestOSMElementCacheReader reader(m_IdToRelation);
// Create ways.

View File

@@ -8,9 +8,10 @@
#include <cstdint>
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace generator
{
/// \brief Generates a binary file by |mappingContent| with mapping from osm ids to feature ids.
@@ -42,7 +43,7 @@ public:
void SetPassThroughAllowed(uint32_t featureId, bool passThroughAllowed);
private:
std::unordered_map<uint32_t, RoadGeometry> m_roads;
ankerl::unordered_dense::map<uint32_t, RoadGeometry> m_roads;
};
std::shared_ptr<EdgeEstimator> CreateEstimatorForCar(traffic::TrafficCache const & trafficCache);

View File

@@ -176,7 +176,7 @@ std::optional<m2::PointD> HierarchyEntryEnricher::GetFeatureCenter(CompositeId c
// because the centers are calculated differently. For example, for an object with a type area,
// the area will be computed using the triangles geometry, but for an object with a type line,
// the area will be computed using the outer geometry of a polygon.
std::unordered_map<std::underlying_type_t<feature::GeomType>, m2::PointD> m;
ankerl::unordered_dense::map<std::underlying_type_t<feature::GeomType>, m2::PointD> m;
for (auto optId : optIds)
{
auto const ftPtr = m_featureGetter.GetFeatureByIndex(optId);

View File

@@ -28,10 +28,11 @@
#include <memory>
#include <optional>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace generator::hierarchy
{
using GetMainTypeFn = std::function<uint32_t(FeatureParams::Types const &)>;

View File

@@ -12,7 +12,8 @@
#include <algorithm>
#include <sstream>
#include <tuple>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
#include "cppjansson/cppjansson.hpp"
@@ -140,7 +141,7 @@ HierarchyEntry HierarchyEntryFromCsvRow(coding::CSVReader::Row const & row)
tree_node::types::Ptrs<HierarchyEntry> LoadHierachy(std::string const & filename)
{
std::unordered_map<CompositeId, tree_node::types::Ptr<HierarchyEntry>> nodes;
ankerl::unordered_dense::map<CompositeId, tree_node::types::Ptr<HierarchyEntry>> nodes;
for (auto const & row : coding::CSVRunner(coding::CSVReader(filename, false /* hasHeader */, kCsvDelimiter)))
{
auto entry = HierarchyEntryFromCsvRow(row);

View File

@@ -260,7 +260,7 @@ public:
private:
FileReader m_fileReader;
std::unordered_map<uint64_t, LatLon> m_map;
ankerl::unordered_dense::map<uint64_t, LatLon> m_map;
};
class MapFilePointStorageWriter : public PointStorageWriterBase
@@ -390,7 +390,7 @@ IntermediateDataObjectsCache::AllocatedObjects & IntermediateDataObjectsCache::G
void IntermediateDataObjectsCache::Clear()
{
std::lock_guard lock(m_mutex);
std::unordered_map<string, AllocatedObjects>().swap(m_objects);
ankerl::unordered_dense::map<string, AllocatedObjects>().swap(m_objects);
}
IntermediateDataObjectsCache::AllocatedObjects::AllocatedObjects(feature::GenerateInfo::NodeStorageType type,

View File

@@ -19,9 +19,10 @@
#include <memory>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
// Classes for reading and writing any data in file with map of offsets for
// fast searching in memory by some key.
namespace generator
@@ -141,7 +142,7 @@ public:
private:
std::unique_ptr<PointStorageReaderInterface> m_storageReader;
std::unordered_map<std::string, IndexFileReader> m_fileReaders;
ankerl::unordered_dense::map<std::string, IndexFileReader> m_fileReaders;
};
// It's thread-safe method.
@@ -152,7 +153,7 @@ public:
private:
std::mutex m_mutex;
std::unordered_map<std::string, AllocatedObjects> m_objects;
ankerl::unordered_dense::map<std::string, AllocatedObjects> m_objects;
};
class OSMElementCacheReader : public OSMElementCacheReaderInterface

View File

@@ -4,7 +4,8 @@
#include <functional>
#include <string>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
namespace generator
{
@@ -21,6 +22,6 @@ private:
uint32_t GetIsolineType(int altitude) const;
std::string m_isolinesDir;
std::unordered_map<int, uint32_t> m_altClassToType;
ankerl::unordered_dense::map<int, uint32_t> m_altClassToType;
};
} // namespace generator

View File

@@ -89,7 +89,7 @@ class MaxspeedsMwmCollector
static int constexpr kSpeedsCount = MaxspeedsSerializer::DEFAULT_SPEEDS_COUNT;
static int constexpr kOutsideCityIdx = 0;
// 0 - outside a city; 1 - inside a city.
std::unordered_map<HighwayType, AvgInfo> m_avgSpeeds[kSpeedsCount];
ankerl::unordered_dense::map<HighwayType, AvgInfo> m_avgSpeeds[kSpeedsCount];
base::GeoObjectId GetOsmID(uint32_t fid) const
{
@@ -212,7 +212,7 @@ public:
if (direction)
seg = GetOpposite(seg);
std::unordered_set<uint32_t> reviewed;
ankerl::unordered_dense::set<uint32_t> reviewed;
do
{
LOG_MAX_SPEED(("Input seg =", seg));

View File

@@ -5,13 +5,14 @@
#include <cctype>
#include <limits>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
namespace generator
{
using measurement_utils::Units;
static std::unordered_map<std::string, routing::SpeedInUnits> const kRoadCategoryToSpeed = {
static ankerl::unordered_dense::map<std::string, routing::SpeedInUnits> const kRoadCategoryToSpeed = {
{"AR:motorway", {130, Units::Metric}},
{"AR:rural", {110, Units::Metric}},
{"AR:urban", {40, Units::Metric}},
@@ -108,8 +109,8 @@ static std::unordered_map<std::string, routing::SpeedInUnits> const kRoadCategor
{"FR:urban", {50, Units::Metric}},
{"FR:zone30", {30, Units::Metric}},
{"FR:living_street", {20, Units::Metric}},
{"GB:motorway", {70, Units::Imperial}}, // 70 mph = 112.65408 kmph
{"GB:nsl_dual", {70, Units::Imperial}}, // 70 mph = 112.65408 kmph
{"GB:motorway", {70, Units::Imperial}}, // 70 mph = 112.65408 kmph
{"GB:nsl_dual", {70, Units::Imperial}}, // 70 mph = 112.65408 kmph
{"GB:nsl_restricted", {30, Units::Imperial}},
{"GB:nsl_single", {60, Units::Imperial}}, // 60 mph = 96.56064 kmph
{"GB-WLS:nsl_restricted", {20, Units::Imperial}},
@@ -168,7 +169,7 @@ static std::unordered_map<std::string, routing::SpeedInUnits> const kRoadCategor
{"PH:rural", {80, Units::Metric}},
{"PH:urban", {40, Units::Metric}},
{"PL:motorway", {140, Units::Metric}},
{"PL:trunk", {100, Units::Metric}},
{"PL:trunk", {100, Units::Metric}},
{"PL:rural", {90, Units::Metric}},
{"PL:urban", {50, Units::Metric}},
{"PL:living_street", {20, Units::Metric}},

View File

@@ -89,7 +89,7 @@ LineStringMerger::OutputData LineStringMerger::Merge(InputData const & data)
for (auto & lineString : p.second)
TryMerge(lineString, buffer);
std::unordered_set<LinePtr> uniqLineStrings;
ankerl::unordered_dense::set<LinePtr> uniqLineStrings;
for (auto const & pb : buffer)
{
auto const & ways = pb.second->GetWays();

View File

@@ -11,9 +11,10 @@
#include <map>
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace feature
{
// A string of connected ways.
@@ -70,7 +71,7 @@ public:
static OutputData Merge(InputData const & data);
private:
using Buffer = std::unordered_map<uint64_t, LinePtr>;
using Buffer = ankerl::unordered_dense::map<uint64_t, LinePtr>;
static bool TryMerge(LinePtr const & lineString, Buffer & buffer);
static bool TryMergeOne(LinePtr const & lineString, Buffer & buffer);

View File

@@ -7,9 +7,10 @@
#include "geometry/point2d.hpp"
#include <string>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace generator
{
struct RoundaboutUnit
@@ -51,7 +52,7 @@ private:
std::vector<MiniRoundaboutInfo> const & m_roundabouts;
double const m_radiusMercator = 0.0;
feature::AffiliationInterface const * m_affiliation = nullptr;
std::unordered_map<base::GeoObjectId, feature::FeatureBuilder> m_roads;
ankerl::unordered_dense::map<base::GeoObjectId, feature::FeatureBuilder> m_roads;
// Skip 2 bytes to satisfy base::GeoObjectId constraints.
uint64_t m_newWayId = 1ULL << (63 - 16);
bool m_leftHandTraffic = false;

View File

@@ -18,9 +18,10 @@
#include <cstdlib>
#include <optional>
#include <regex>
#include <unordered_set>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace
{
using osm::EditableMapObject;
@@ -33,7 +34,7 @@ auto constexpr kMaxBuildingLevelsInTheWorld = 167;
template <class T>
void RemoveDuplicatesAndKeepOrder(std::vector<T> & vec)
{
std::unordered_set<T> seen;
ankerl::unordered_dense::set<T> seen;
auto const predicate = [&seen](T const & value)
{
if (seen.contains(value))

View File

@@ -1088,8 +1088,8 @@ void PostprocessElement(OsmElement * p, FeatureBuilderParams & params)
for (uint32_t type : params.m_types)
{
ftype::TruncValue(type, 1);
if (type != types.Get(CachedTypes::WheelchairAny) && type != types.Get(CachedTypes::InternetAny)
&& type != types.Get(CachedTypes::DisusedBusiness) && type != types.Get(CachedTypes::Building))
if (type != types.Get(CachedTypes::WheelchairAny) && type != types.Get(CachedTypes::InternetAny) &&
type != types.Get(CachedTypes::DisusedBusiness) && type != types.Get(CachedTypes::Building))
{
hasPoiType = true;
break;

View File

@@ -155,7 +155,7 @@ void BuildPopularPlacesFromWikiDump(std::string const & mwmFile, std::string con
PopularPlaces const & GetOrLoadPopularPlaces(std::string const & filename)
{
static std::mutex m;
static std::unordered_map<std::string, PopularPlaces> placesStorage;
static ankerl::unordered_dense::map<std::string, PopularPlaces> placesStorage;
std::lock_guard<std::mutex> lock(m);
auto const it = placesStorage.find(filename);

View File

@@ -3,12 +3,13 @@
#include "base/geo_object_id.hpp"
#include <string>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
namespace generator
{
using PopularityIndex = uint8_t;
using PopularPlaces = std::unordered_map<base::GeoObjectId, PopularityIndex>;
using PopularPlaces = ankerl::unordered_dense::map<base::GeoObjectId, PopularityIndex>;
void LoadPopularPlaces(std::string const & srcFilename, PopularPlaces & places);

View File

@@ -56,6 +56,6 @@ private:
std::shared_ptr<TranslatorCollection> m_translators;
std::priority_queue<FinalProcessorPtr, std::vector<FinalProcessorPtr>, FinalProcessorPtrCmp> m_finalProcessors;
std::vector<std::string> m_names;
// std::unordered_set<CompositeId> m_hierarchyNodesSet;
// ankerl::unordered_dense::set<CompositeId> m_hierarchyNodesSet;
};
} // namespace generator

View File

@@ -6,9 +6,10 @@
#include <memory>
#include <string>
#include <thread>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace generator
{
class RawGeneratorWriter
@@ -29,6 +30,6 @@ private:
std::thread m_thread;
std::shared_ptr<FeatureProcessorQueue> m_queue;
std::string m_path;
std::unordered_map<std::string, std::unique_ptr<FileWriter>> m_writers;
ankerl::unordered_dense::map<std::string, std::unique_ptr<FileWriter>> m_writers;
};
} // namespace generator

View File

@@ -66,7 +66,7 @@ class RelationTagsWay : public RelationTagsBase
{
private:
using Base = RelationTagsBase;
using NameKeys = std::unordered_set<std::string>;
using NameKeys = ankerl::unordered_dense::set<std::string>;
bool IsAcceptBoundary(RelationElement const & e) const;

View File

@@ -19,7 +19,8 @@
#include <algorithm>
#include <fstream>
#include <sstream>
#include <unordered_set>
#include "3party/ankerl/unordered_dense.h"
namespace routing_builder
{
@@ -127,7 +128,7 @@ Joint::Id RestrictionCollector::GetFirstCommonJoint(uint32_t firstFeatureId, uin
auto const firstRoad = m_indexGraph.GetRoad(firstFeatureId);
auto const secondRoad = m_indexGraph.GetRoad(secondFeatureId);
std::unordered_set<Joint::Id> used;
ankerl::unordered_dense::set<Joint::Id> used;
for (uint32_t i = 0; i < firstLen; ++i)
if (firstRoad.GetJointId(i) != Joint::kInvalidId)
used.emplace(firstRoad.GetJointId(i));

View File

@@ -13,9 +13,10 @@
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace routing
{
class OsmWay2FeaturePoint;

View File

@@ -43,9 +43,10 @@
#include <algorithm>
#include <map>
#include <memory>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace routing_builder
{
using namespace feature;
@@ -130,7 +131,7 @@ public:
graph.Import(joints);
}
std::unordered_map<uint32_t, VehicleMask> const & GetMasks() const { return m_masks; }
ankerl::unordered_dense::map<uint32_t, VehicleMask> const & GetMasks() const { return m_masks; }
private:
void ProcessFeature(FeatureType & f, uint32_t id)
@@ -150,8 +151,8 @@ private:
}
VehicleMaskBuilder const m_maskBuilder;
std::unordered_map<uint64_t, Joint> m_posToJoint;
std::unordered_map<uint32_t, VehicleMask> m_masks;
ankerl::unordered_dense::map<uint64_t, Joint> m_posToJoint;
ankerl::unordered_dense::map<uint32_t, VehicleMask> m_masks;
};
class IndexGraphWrapper final
@@ -494,7 +495,7 @@ void FillWeights(string const & path, string const & mwmFile, string const & cou
DijkstraWrapperJoints wrapper(indexGraphWrapper, enter);
Algorithm::Context context(wrapper);
std::unordered_map<uint32_t, vector<JointSegment>> visitedVertexes;
ankerl::unordered_dense::map<uint32_t, vector<JointSegment>> visitedVertexes;
astar.PropagateWave(wrapper, wrapper.GetStartJoint(), [&](JointSegment const & vertex)
{
if (vertex.IsFake())

View File

@@ -43,7 +43,6 @@
#include <fstream>
#include <memory>
#include <thread>
#include <unordered_map>
#include <vector>
namespace indexer
@@ -495,7 +494,8 @@ void BuildAddressTable(FilesContainerR & container, std::string const & addressD
if (!street.empty())
{
auto const streets = search::ReverseGeocoder::GetNearbyStreets(*contexts[threadIdx], center, kStreetRadiusM, true);
auto const streets =
search::ReverseGeocoder::GetNearbyStreets(*contexts[threadIdx], center, kStreetRadiusM, true);
streetId = MatchObjectByName(street, streets, [](std::string_view name)
{ return search::GetStreetNameAsKey(name, false /* ignoreStreetSynonyms */); });

View File

@@ -5,9 +5,10 @@
#include "indexer/ftypes_matcher.hpp"
#include <string>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace indexer
{
class SynonymsHolder
@@ -34,7 +35,7 @@ public:
}
private:
std::unordered_map<std::string, std::vector<std::string>> m_map;
ankerl::unordered_dense::map<std::string, std::vector<std::string>> m_map;
};
// Builds the latest version of the search index section and writes it to the mwm file.

View File

@@ -10,10 +10,11 @@
#include <cstdint>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace generator
{
class SrtmTile
@@ -91,7 +92,7 @@ private:
}
};
using MapT = std::unordered_map<SrtmTile::LatLonKey, SrtmTile, Hash>;
using MapT = ankerl::unordered_dense::map<SrtmTile::LatLonKey, SrtmTile, Hash>;
MapT m_tiles;
DISALLOW_COPY(SrtmTileManager);

View File

@@ -7,10 +7,11 @@
#include <functional>
#include <iterator>
#include <list>
#include <unordered_map>
#include <utility>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace tesselator
{
typedef std::vector<m2::PointD> PointsT;
@@ -71,7 +72,7 @@ class TrianglesInfo
size_t operator()(std::pair<T1, T2> const & p) const { return math::Hash(p.first, p.second); }
};
using TNeighbours = std::unordered_map<std::pair<int, int>, int, HashPair<int, int>>;
using TNeighbours = ankerl::unordered_dense::map<std::pair<int, int>, int, HashPair<int, int>>;
TNeighbours m_neighbors;
bool AddNeighbour(int p1, int p2, int trg);

View File

@@ -98,7 +98,8 @@ std::unique_ptr<FeatureType> FeatureGetter::GetFeatureByIndex(uint32_t index) co
return m_guard->GetFeatureByIndex(index);
}
bool ParseFeatureIdToOsmIdMapping(std::string const & path, std::unordered_map<uint32_t, base::GeoObjectId> & mapping)
bool ParseFeatureIdToOsmIdMapping(std::string const & path,
ankerl::unordered_dense::map<uint32_t, base::GeoObjectId> & mapping)
{
return ForEachOsmId2FeatureId(path, [&](auto const & compositeId, auto featureId)
{
@@ -107,7 +108,7 @@ bool ParseFeatureIdToOsmIdMapping(std::string const & path, std::unordered_map<u
});
}
bool ParseFeatureIdToTestIdMapping(std::string const & path, std::unordered_map<uint32_t, uint64_t> & mapping)
bool ParseFeatureIdToTestIdMapping(std::string const & path, ankerl::unordered_dense::map<uint32_t, uint64_t> & mapping)
{
bool success = true;
feature::ForEachFeature(path, [&](FeatureType & feature, uint32_t fid)

View File

@@ -21,9 +21,10 @@
#include <cstdint>
#include <fstream>
#include <string>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
#define MAIN_WITH_ERROR_HANDLING(func) \
int main(int argc, char ** argv) \
{ \
@@ -87,8 +88,10 @@ bool ForEachOsmId2FeatureId(std::string const & path, ToDo && toDo)
return true;
}
bool ParseFeatureIdToOsmIdMapping(std::string const & path, std::unordered_map<uint32_t, base::GeoObjectId> & mapping);
bool ParseFeatureIdToTestIdMapping(std::string const & path, std::unordered_map<uint32_t, uint64_t> & mapping);
bool ParseFeatureIdToOsmIdMapping(std::string const & path,
ankerl::unordered_dense::map<uint32_t, base::GeoObjectId> & mapping);
bool ParseFeatureIdToTestIdMapping(std::string const & path,
ankerl::unordered_dense::map<uint32_t, uint64_t> & mapping);
search::CBV GetLocalities(std::string const & dataPath);

View File

@@ -13,9 +13,10 @@
#include <array>
#include <cstdint>
#include <functional>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace generator
{
@@ -91,7 +92,7 @@ public:
};
private:
std::unordered_map<uint64_t, Entry> m_nodes;
ankerl::unordered_dense::map<uint64_t, Entry> m_nodes;
static m2::PointU EncodePoint(ms::LatLon ll)
{
@@ -133,7 +134,7 @@ public:
template <class T>
class WaysMapper
{
std::unordered_map<uint64_t, T> m_ways;
ankerl::unordered_dense::map<uint64_t, T> m_ways;
public:
void Add(uint64_t id, T t) { CHECK(m_ways.emplace(id, std::move(t)).second, ()); }

View File

@@ -118,9 +118,9 @@ using NodePoints = std::vector<NodePoint>;
using CrossBorderIndexes = std::vector<size_t>;
std::pair<NodePoints, CrossBorderIndexes> GetCrossBorderPoints(
std::vector<uint64_t> const & nodeIds, std::unordered_map<uint64_t, ms::LatLon> const & nodes,
std::vector<uint64_t> const & nodeIds, ankerl::unordered_dense::map<uint64_t, ms::LatLon> const & nodes,
feature::CountriesFilesAffiliation const & mwmMatcher,
std::unordered_map<std::string, NumMwmId> const & regionToIdMap)
ankerl::unordered_dense::map<std::string, NumMwmId> const & regionToIdMap)
{
NodePoints nodePoints;
CrossBorderIndexes crossBorderIndexes;
@@ -202,9 +202,10 @@ std::optional<std::pair<m2::PointD, double>> GetPointInMwm(NodePoints const & po
}
bool FillCrossBorderGraph(CrossBorderGraph & graph, RegionSegmentId & curSegmentId,
std::vector<uint64_t> const & nodeIds, std::unordered_map<uint64_t, ms::LatLon> const & nodes,
std::vector<uint64_t> const & nodeIds,
ankerl::unordered_dense::map<uint64_t, ms::LatLon> const & nodes,
feature::CountriesFilesAffiliation const & mwmMatcher,
std::unordered_map<std::string, NumMwmId> const & regionToIdMap)
ankerl::unordered_dense::map<std::string, NumMwmId> const & regionToIdMap)
{
auto const & [nodePoints, crossBorderIndexes] = GetCrossBorderPoints(nodeIds, nodes, mwmMatcher, regionToIdMap);

View File

@@ -16,10 +16,11 @@
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace routing
{
// Road way and regions through which it passes.
@@ -33,14 +34,14 @@ struct RoadData
OsmElement m_way;
};
using RoadsData = std::unordered_map<uint64_t, RoadData>;
using HighwayTypeToRoads = std::unordered_map<std::string, RoadsData>;
using RoadsData = ankerl::unordered_dense::map<uint64_t, RoadData>;
using HighwayTypeToRoads = ankerl::unordered_dense::map<std::string, RoadsData>;
// Ways and corresponding nodes of roads extracted from OSM file.
struct RoadsFromOsm
{
HighwayTypeToRoads m_ways;
std::unordered_map<uint64_t, ms::LatLon> m_nodes;
ankerl::unordered_dense::map<uint64_t, ms::LatLon> m_nodes;
};
// Reads roads from |reader| and finds its mwms with |mwmMatcher|.
@@ -50,9 +51,10 @@ RoadsFromOsm GetRoadsFromOsm(generator::SourceReader & reader, feature::Countrie
// Fills |graph| with new segments starting from |curSegmentId|. Segments are calculated from the
// road consisting of |nodeIds| from OSM.
bool FillCrossBorderGraph(CrossBorderGraph & graph, RegionSegmentId & curSegmentId,
std::vector<uint64_t> const & nodeIds, std::unordered_map<uint64_t, ms::LatLon> const & nodes,
std::vector<uint64_t> const & nodeIds,
ankerl::unordered_dense::map<uint64_t, ms::LatLon> const & nodes,
feature::CountriesFilesAffiliation const & mwmMatcher,
std::unordered_map<std::string, routing::NumMwmId> const & regionToIdMap);
ankerl::unordered_dense::map<std::string, routing::NumMwmId> const & regionToIdMap);
// Dumps |graph| to |path|.
bool WriteGraphToFile(CrossBorderGraph const & graph, std::string const & path, bool overwrite);

View File

@@ -17,9 +17,10 @@
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
#include <gflags/gflags.h>
DEFINE_string(path_resources, "", "CoMaps resources directory");
@@ -54,7 +55,7 @@ int main(int argc, char ** argv)
storage::Storage storage;
std::shared_ptr<NumMwmIds> numMwmIds = CreateNumMwmIds(storage);
std::unordered_map<std::string, NumMwmId> regionsToIds;
ankerl::unordered_dense::map<std::string, NumMwmId> regionsToIds;
numMwmIds->ForEachId([&regionsToIds, &numMwmIds](NumMwmId id)
{