[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

@@ -5,7 +5,8 @@
#include <map>
#include <string>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
using namespace base;
using namespace std;

View File

@@ -4,7 +4,8 @@
#include <list>
#include <set>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
#ifdef __clang__
#pragma clang diagnostic push
@@ -24,7 +25,7 @@ public:
FifoCacheTest(size_t capacity, typename FifoCache<Key, Value>::Loader const & loader) : m_cache(capacity, loader) {}
Value const & GetValue(Key const & key) { return m_cache.GetValue(key); }
unordered_map<Key, Value> const & GetMap() const { return m_cache.m_map; }
ankerl::unordered_dense::map<Key, Value> const & GetMap() const { return m_cache.m_map; }
boost::circular_buffer<Key> const & GetFifo() const { return m_cache.m_fifo; }
bool IsValid() const
@@ -67,7 +68,7 @@ UNIT_TEST(FifoCache)
TEST_EQUAL(cache.GetValue(2), 2, ());
TEST(cache.IsValid(), ());
{
unordered_map<Key, Value> expectedMap({{1 /* key */, 1 /* value */}, {2, 2}, {3, 3}});
ankerl::unordered_dense::map<Key, Value> expectedMap({{1 /* key */, 1 /* value */}, {2, 2}, {3, 3}});
TEST_EQUAL(cache.GetMap(), expectedMap, ());
list<Key> expectedList({2, 3, 1});
boost::circular_buffer<Key> expectedCB(expectedList.cbegin(), expectedList.cend());
@@ -77,7 +78,7 @@ UNIT_TEST(FifoCache)
TEST_EQUAL(cache.GetValue(7), 7, ());
TEST(cache.IsValid(), ());
{
unordered_map<Key, Value> expectedMap({{7 /* key */, 7 /* value */}, {2, 2}, {3, 3}});
ankerl::unordered_dense::map<Key, Value> expectedMap({{7 /* key */, 7 /* value */}, {2, 2}, {3, 3}});
TEST_EQUAL(cache.GetMap(), expectedMap, ());
list<Key> expectedList({7, 2, 3});
boost::circular_buffer<Key> expectedCB(expectedList.cbegin(), expectedList.cend());

View File

@@ -41,7 +41,7 @@ public:
size_t GetAge() const { return m_keyAge.m_age; }
std::map<size_t, Key> const & GetAgeToKey() const { return m_keyAge.m_ageToKey; }
std::unordered_map<Key, size_t> const & GetKeyToAge() const { return m_keyAge.m_keyToAge; }
ankerl::unordered_dense::map<Key, size_t> const & GetKeyToAge() const { return m_keyAge.m_keyToAge; }
private:
typename LruCache<Key, Value>::KeyAge m_keyAge;
@@ -49,7 +49,8 @@ private:
template <typename Key, typename Value>
void TestAge(LruCacheKeyAgeTest<Key, Value> const & keyAge, size_t expectedAge,
std::map<size_t, Key> const & expectedAgeToKey, std::unordered_map<Key, size_t> const & expectedKeyToAge)
std::map<size_t, Key> const & expectedAgeToKey,
ankerl::unordered_dense::map<Key, size_t> const & expectedKeyToAge)
{
TEST(keyAge.IsValid(), ());
TEST_EQUAL(keyAge.GetAge(), expectedAge, ());
@@ -70,49 +71,49 @@ UNIT_TEST(LruCacheAgeTest)
age.InsertKey(10);
{
std::map<size_t, Key> const expectedAgeToKey({{1 /* age */, 10 /* key */}});
std::unordered_map<Key, size_t> const expectedKeyToAge({{10 /* key */, 1 /* age */}});
ankerl::unordered_dense::map<Key, size_t> const expectedKeyToAge({{10 /* key */, 1 /* age */}});
TestAge(age, 1 /* cache age */, expectedAgeToKey, expectedKeyToAge);
}
age.InsertKey(9);
{
std::map<size_t, Key> const expectedAgeToKey({{1, 10}, {2, 9}});
std::unordered_map<Key, size_t> const expectedKeyToAge({{10, 1}, {9, 2}});
ankerl::unordered_dense::map<Key, size_t> const expectedKeyToAge({{10, 1}, {9, 2}});
TestAge(age, 2 /* cache age */, expectedAgeToKey, expectedKeyToAge);
}
age.RemoveLru();
{
std::map<size_t, Key> const expectedAgeToKey({{2, 9}});
std::unordered_map<Key, size_t> const expectedKeyToAge({{9, 2}});
ankerl::unordered_dense::map<Key, size_t> const expectedKeyToAge({{9, 2}});
TestAge(age, 2 /* cache age */, expectedAgeToKey, expectedKeyToAge);
}
age.InsertKey(11);
{
std::map<size_t, Key> const expectedAgeToKey({{2, 9}, {3, 11}});
std::unordered_map<Key, size_t> const expectedKeyToAge({{9, 2}, {11, 3}});
ankerl::unordered_dense::map<Key, size_t> const expectedKeyToAge({{9, 2}, {11, 3}});
TestAge(age, 3 /* cache age */, expectedAgeToKey, expectedKeyToAge);
}
age.UpdateAge(9);
{
std::map<size_t, Key> const expectedAgeToKey({{4, 9}, {3, 11}});
std::unordered_map<Key, size_t> const expectedKeyToAge({{9, 4}, {11, 3}});
ankerl::unordered_dense::map<Key, size_t> const expectedKeyToAge({{9, 4}, {11, 3}});
TestAge(age, 4 /* cache age */, expectedAgeToKey, expectedKeyToAge);
}
age.RemoveLru();
{
std::map<size_t, Key> const expectedAgeToKey({{4, 9}});
std::unordered_map<Key, size_t> const expectedKeyToAge({{9, 4}});
ankerl::unordered_dense::map<Key, size_t> const expectedKeyToAge({{9, 4}});
TestAge(age, 4 /* cache age */, expectedAgeToKey, expectedKeyToAge);
}
age.InsertKey(12);
{
std::map<size_t, Key> const expectedAgeToKey({{4, 9}, {5, 12}});
std::unordered_map<Key, size_t> const expectedKeyToAge({{9, 4}, {12, 5}});
ankerl::unordered_dense::map<Key, size_t> const expectedKeyToAge({{9, 4}, {12, 5}});
TestAge(age, 5 /* cache age */, expectedAgeToKey, expectedKeyToAge);
}
}

View File

@@ -7,9 +7,10 @@
#include <algorithm>
#include <iterator>
#include <random>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace small_set_test
{
using namespace base;
@@ -96,7 +97,7 @@ UNIT_TEST(SmallMap_Benchmark1)
{
// 1. Init maps.
// Dataset is similar to routing::VehicleModel.
std::unordered_map<uint32_t, bool> uMap = {
ankerl::unordered_dense::map<uint32_t, bool> uMap = {
{1, true}, {2, false}, {4, false}, {6, true}, {7, true}, {8, true}, {12, false},
{15, false}, {26, true}, {30, false}, {36, false}, {43, false}, {54, false}, {57, true},
{58, true}, {65, true}, {69, true}, {90, true}, {95, false}, {119, false}, {167, true},
@@ -138,7 +139,7 @@ UNIT_TEST(SmallMap_Benchmark2)
uint32_t i = 0;
// Dataset is similar to routing::VehicleModelFactory.
unordered_map<string, shared_ptr<int>> uMap = {
ankerl::unordered_dense::map<string, shared_ptr<int>> uMap = {
{"", make_shared<int>(i++)},
{"Australia", make_shared<int>(i++)},
{"Austria", make_shared<int>(i++)},
@@ -217,7 +218,7 @@ UNIT_TEST(SmallMap_Benchmark2)
UNIT_TEST(SmallMap_Benchmark3)
{
// Dataset is similar to routing::VehicleModel.m_surfaceFactors.
std::unordered_map<int, int> uMap = {
ankerl::unordered_dense::map<int, int> uMap = {
{1, 0}, {10, 1}, {100, 2}, {1000, 3},
};

View File

@@ -7,11 +7,11 @@
#include <cmath>
#include <fstream>
#include <limits>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>
#include <sstream>
#include "3party/ankerl/unordered_dense.h"
/// internal function in base
namespace strings
@@ -28,7 +28,7 @@ UNIT_TEST(LowerUniChar)
TEST(file.is_open(), (kFile));
size_t fCount = 0, cCount = 0;
std::unordered_map<strings::UniChar, strings::UniString> m;
ankerl::unordered_dense::map<strings::UniChar, strings::UniString> m;
std::string line;
while (file.good())
{

View File

@@ -1,14 +1,16 @@
#pragma once
#include <cstddef>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
namespace base
{
// A bidirectional map to store a one-to-one correspondence between
// keys and values.
template <typename K, typename V, template <typename...> typename KToVMap = std::unordered_map,
typename KToVHashOrComparator = std::hash<K>, template <typename...> typename VToKMap = std::unordered_map,
template <typename K, typename V, template <typename...> typename KToVMap = ankerl::unordered_dense::map,
typename KToVHashOrComparator = std::hash<K>,
template <typename...> typename VToKMap = ankerl::unordered_dense::map,
typename VToKHashOrComparator = std::hash<V>>
class BidirectionalMap
{

View File

@@ -4,10 +4,11 @@
#include <cstddef>
#include <iterator>
#include <unordered_map>
#include <utility>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace base
{
// Maps keys to lists of values, but allows to combine keys into
@@ -155,6 +156,6 @@ private:
cv.shrink_to_fit();
}
std::unordered_map<Key, Entry, Hash> m_table;
ankerl::unordered_dense::map<Key, Entry, Hash> m_table;
};
} // namespace base

View File

@@ -4,7 +4,8 @@
#include <cstddef>
#include <functional>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
#ifdef __clang__
#pragma clang diagnostic push
@@ -15,7 +16,7 @@
#pragma clang diagnostic pop
#endif
template <class Key, class Value, class HashContainer = std::unordered_map<Key, Value>>
template <class Key, class Value, class HashContainer = ankerl::unordered_dense::map<Key, Value>>
class FifoCache
{
template <typename K, typename V>

View File

@@ -15,11 +15,11 @@
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
/// @name Declarations.
//@{
template <typename T>
@@ -65,9 +65,9 @@ template <typename T>
inline std::string DebugPrint(std::unique_ptr<T> const & v);
template <class Key, class Hash = std::hash<Key>, class Pred = std::equal_to<Key>>
inline std::string DebugPrint(std::unordered_set<Key, Hash, Pred> const & v);
inline std::string DebugPrint(ankerl::unordered_dense::set<Key, Hash, Pred> const & v);
template <class Key, class T, class Hash = std::hash<Key>, class Pred = std::equal_to<Key>>
inline std::string DebugPrint(std::unordered_map<Key, T, Hash, Pred> const & v);
inline std::string DebugPrint(ankerl::unordered_dense::map<Key, T, Hash, Pred> const & v);
//@}
template <typename T>
@@ -234,13 +234,13 @@ inline std::string DebugPrint(std::initializer_list<T> const & v)
}
template <class Key, class Hash, class Pred>
inline std::string DebugPrint(std::unordered_set<Key, Hash, Pred> const & v)
inline std::string DebugPrint(ankerl::unordered_dense::set<Key, Hash, Pred> const & v)
{
return DebugPrintSequence(v.begin(), v.end());
}
template <class Key, class T, class Hash, class Pred>
inline std::string DebugPrint(std::unordered_map<Key, T, Hash, Pred> const & v)
inline std::string DebugPrint(ankerl::unordered_dense::map<Key, T, Hash, Pred> const & v)
{
return DebugPrintSequence(v.begin(), v.end());
}

View File

@@ -190,8 +190,8 @@ void LevenshteinDFA::State::Normalize()
// LevenshteinDFA ----------------------------------------------------------------------------------
// static
LevenshteinDFA::LevenshteinDFA(UniString const & s, size_t prefixSize, std::array<UniString, 11> const & prefixMisprints,
size_t maxErrors)
LevenshteinDFA::LevenshteinDFA(UniString const & s, size_t prefixSize,
std::array<UniString, 11> const & prefixMisprints, size_t maxErrors)
: m_size(s.size())
, m_maxErrors(maxErrors)
{

View File

@@ -3,11 +3,12 @@
#include "base/assert.hpp"
#include <list>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
namespace base
{
template <typename Key, typename Value, template <typename...> typename Map = std::unordered_map>
template <typename Key, typename Value, template <typename...> typename Map = ankerl::unordered_dense::map>
class LinkedMap
{
public:

View File

@@ -5,7 +5,8 @@
#include <cstddef>
#include <functional>
#include <map>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
/// \brief Implementation of cache with least recently used replacement policy.
template <typename Key, typename Value>
@@ -164,10 +165,10 @@ private:
private:
size_t m_age = 0;
std::map<size_t, Key> m_ageToKey;
std::unordered_map<Key, size_t> m_keyToAge;
ankerl::unordered_dense::map<Key, size_t> m_keyToAge;
};
size_t const m_maxCacheSize;
std::unordered_map<Key, Value> m_cache;
ankerl::unordered_dense::map<Key, Value> m_cache;
KeyAge m_keyAge;
};

View File

@@ -5,9 +5,10 @@
#include <queue>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace base
{
@@ -79,7 +80,7 @@ public:
template <class Key>
class TopStatsCounter
{
std::unordered_map<Key, size_t> m_data;
ankerl::unordered_dense::map<Key, size_t> m_data;
public:
void Add(Key const & key) { ++m_data[key]; }
@@ -88,7 +89,7 @@ public:
{
ASSERT(count > 0, ());
using PtrT = std::pair<Key const, size_t> const *;
using PtrT = typename ankerl::unordered_dense::map<Key, size_t>::value_type const *;
struct GreaterNumber
{
bool operator()(PtrT l, PtrT r) const { return l->second > r->second; }

View File

@@ -2,9 +2,10 @@
#include <array>
#include <map>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
/// @name std containers serialization
/// TArchive should be an archive class in global namespace.
//@{
@@ -130,14 +131,14 @@ TArchive & operator>>(TArchive & ar, std::multimap<T1, T2> & rMap)
}
template <class TArchive, class T1, class T2>
TArchive & operator<<(TArchive & ar, std::unordered_map<T1, T2> const & rMap)
TArchive & operator<<(TArchive & ar, ankerl::unordered_dense::map<T1, T2> const & rMap)
{
save_like_map(ar, rMap);
return ar;
}
template <class TArchive, class T1, class T2>
TArchive & operator>>(TArchive & ar, std::unordered_map<T1, T2> & rMap)
TArchive & operator>>(TArchive & ar, ankerl::unordered_dense::map<T1, T2> & rMap)
{
load_like_map(ar, rMap);
return ar;

View File

@@ -118,10 +118,8 @@ size_t CountChar(Utf8 const & utf8)
size_t codePoints = 0;
for (auto const c : utf8)
{
if ((c & 0xC0) != 0x80)
++codePoints;
}
return codePoints;
}
@@ -175,7 +173,7 @@ bool IsASCIILatin(UniChar c);
/// Escape characters not allowed in XML
template <typename T>
std::string EscapeForXML(const T & in)
std::string EscapeForXML(T const & in)
{
std::string result;
result.reserve(in.size());
@@ -184,12 +182,12 @@ std::string EscapeForXML(const T & in)
{
switch (c)
{
case '&': result.append("&amp;"); break;
case '<': result.append("&lt;"); break;
case '>': result.append("&gt;"); break;
case '"': result.append("&quot;"); break;
case '\'': result.append("&apos;"); break;
default: result.append(1, c); break;
case '&': result.append("&amp;"); break;
case '<': result.append("&lt;"); break;
case '>': result.append("&gt;"); break;
case '"': result.append("&quot;"); break;
case '\'': result.append("&apos;"); break;
default: result.append(1, c); break;
}
}

View File

@@ -10,9 +10,10 @@
#include <condition_variable>
#include <map>
#include <memory>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace base
{
// This class represents a simple thread pool with a queue of tasks.
@@ -119,7 +120,7 @@ private:
using DelayedValue = std::shared_ptr<DelayedTask>;
class DelayedQueue
: public BidirectionalMap<TaskId, DelayedValue, std::unordered_map, std::hash<TaskId>, std::multimap,
: public BidirectionalMap<TaskId, DelayedValue, ankerl::unordered_dense::map, std::hash<TaskId>, std::multimap,
DeRef<DelayedValue>>
{
public:

View File

@@ -12,9 +12,10 @@
#include <limits>
#include <map>
#include <memory>
#include <unordered_set>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
using namespace std;
namespace
@@ -171,7 +172,7 @@ struct ArrayTypes
deque<uint32_t> m_dequeValue;
vector<uint32_t> m_vectorValue;
map<uint32_t, uint32_t> m_mapValue;
unordered_set<uint32_t> m_unorderedSetValue;
ankerl::unordered_dense::set<uint32_t> m_unorderedSetValue;
};
} // namespace
@@ -224,7 +225,7 @@ UNIT_TEST(SerdesJsonTest)
hash<string> m_hasher;
};
unordered_set<pair<string, string>, Hasher> testValue = {{"ab", "ab"}, {"ef", "ef"}, {"cd", "cd"}};
ankerl::unordered_dense::set<pair<string, string>, Hasher> testValue = {{"ab", "ab"}, {"ef", "ef"}, {"cd", "cd"}};
TEST(TestSerDes(testValue), ());
}

View File

@@ -6,10 +6,11 @@
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <unordered_map>
#include <utility>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace diff
{
enum Operation

View File

@@ -16,6 +16,7 @@
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif
#include "3party/ankerl/unordered_dense.h"
#include "3party/succinct/elias_fano.hpp"
#include "3party/succinct/rs_bit_vector.hpp"
@@ -28,7 +29,6 @@
#include <functional>
#include <memory>
#include <type_traits>
#include <unordered_map>
#include <vector>
// A data structure that allows storing a map from small 32-bit integers (the main use
@@ -227,7 +227,7 @@ private:
ReadBlockCallback m_readBlockCallback;
std::unordered_map<uint32_t, std::vector<Value>> m_cache;
ankerl::unordered_dense::map<uint32_t, std::vector<Value>> m_cache;
};
template <typename Value>

View File

@@ -17,10 +17,11 @@
#include <map>
#include <memory>
#include <type_traits>
#include <unordered_set>
#include <utility>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace coding
{
namespace traits
@@ -280,7 +281,7 @@ public:
}
template <typename T, class H = std::hash<T>>
void operator()(std::unordered_set<T, H> & dest, char const * name = nullptr)
void operator()(ankerl::unordered_dense::set<T, H> & dest, char const * name = nullptr)
{
json_t * outerContext = SaveContext(name);

View File

@@ -10,8 +10,8 @@
#include <boost/uuid/detail/sha1.hpp>
#include <algorithm>
#include <vector>
#include <bit>
#include <vector>
namespace coding
{

View File

@@ -8,9 +8,10 @@
#include <condition_variable>
#include <memory>
#include <mutex>
#include <unordered_set>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace dp
{
// This class MUST NOT run OpenGL-related tasks (which invoke OpenGL or contain any
@@ -147,7 +148,7 @@ private:
m_condition.notify_all();
}
std::unordered_set<uint64_t> m_finishedIds;
ankerl::unordered_dense::set<uint64_t> m_finishedIds;
uint64_t m_counter = 0;
bool m_finished = false;
std::condition_variable m_condition;

View File

@@ -5,9 +5,10 @@
#include "drape/pointers.hpp"
#include "drape/shader.hpp"
#include <unordered_map>
#include <string>
#include "3party/ankerl/unordered_dense.h"
namespace dp
{
class GLGpuProgram : public GpuProgram
@@ -29,7 +30,7 @@ public:
glConst m_type = gl_const::GLFloatType;
};
using UniformsInfo = std::unordered_map<std::string, UniformInfo>;
using UniformsInfo = ankerl::unordered_dense::map<std::string, UniformInfo>;
UniformsInfo const & GetUniformsInfo() const;
uint32_t GetNumericUniformsCount() const { return m_numericUniformsCount; }

View File

@@ -257,7 +257,7 @@ FreetypeError constexpr g_FT_Errors[] =
FT_StreamRec_ m_stream;
FT_Face m_fontFace;
std::unordered_set<uint16_t> m_readyGlyphs;
ankerl::unordered_dense::set<uint16_t> m_readyGlyphs;
hb_font_t * m_harfbuzzFont{nullptr};
};
@@ -328,13 +328,13 @@ FreetypeError constexpr g_FT_Errors[] =
TUniBlockIter m_lastUsedBlock;
std::vector<std::unique_ptr<Font>> m_fonts;
// Required to use std::string_view as a search key for std::unordered_map::find().
// Required to use std::string_view as a search key for ankerl::unordered_dense::map::find().
struct StringHash : public std::hash<std::string_view>
{
using is_transparent = void;
};
std::unordered_map<std::string, text::TextMetrics, StringHash, std::equal_to<>> m_textMetricsCache;
ankerl::unordered_dense::map<std::string, text::TextMetrics, StringHash, std::equal_to<>> m_textMetricsCache;
hb_buffer_t * m_harfbuzzBuffer;
};

View File

@@ -10,9 +10,10 @@
#include <array>
#include <memory>
#include <unordered_set>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace dp
{
namespace detail
@@ -52,7 +53,7 @@ class OverlayTree : public m4::Tree<ref_ptr<OverlayHandle>, detail::OverlayTrait
using TBase = m4::Tree<ref_ptr<OverlayHandle>, detail::OverlayTraits>;
public:
using HandlesCache = std::unordered_set<ref_ptr<OverlayHandle>, detail::OverlayHasher>;
using HandlesCache = ankerl::unordered_dense::set<ref_ptr<OverlayHandle>, detail::OverlayHasher>;
explicit OverlayTree(double visualScale);

View File

@@ -57,10 +57,8 @@ void RenderBucket::Update(ScreenBase const & modelView)
{
BeforeUpdate();
for (auto & overlayHandle : m_overlay)
{
if (overlayHandle->IsVisible())
overlayHandle->Update(modelView);
}
}
void RenderBucket::CollectOverlayHandles(ref_ptr<OverlayTree> tree)

View File

@@ -109,7 +109,7 @@ public:
void UploadResources(ref_ptr<dp::GraphicsContext> context, ref_ptr<Texture> texture);
private:
// std::unordered_map can be better here
// ankerl::unordered_dense::map can be better here
typedef std::map<StipplePenKey, StipplePenResourceInfo> TResourceMapping;
typedef std::pair<m2::RectU, StipplePenRasterizator> TPendingNode;
typedef std::vector<TPendingNode> TPendingNodes;

View File

@@ -2,10 +2,11 @@
#include "drape/texture.hpp"
#include <unordered_map>
#include <string>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace dp
{
class SymbolsTexture : public Texture
@@ -50,6 +51,6 @@ private:
ref_ptr<HWTextureAllocator> allocator);
std::string m_name;
mutable std::unordered_map<std::string, SymbolInfo> m_definition;
mutable ankerl::unordered_dense::map<std::string, SymbolInfo> m_definition;
};
} // namespace dp

View File

@@ -9,7 +9,8 @@
#include <mutex>
#include <set>
#include <string>
#include <unordered_set>
#include "3party/ankerl/unordered_dense.h"
namespace dp
{
@@ -48,7 +49,7 @@ private:
private:
GlyphUsageStatistic m_glyphStat;
std::unordered_set<std::string> m_processedStrings;
ankerl::unordered_dense::set<std::string> m_processedStrings;
std::mutex m_mutex;
};

View File

@@ -8,9 +8,10 @@
#include <map>
#include <mutex>
#include <string>
#include <unordered_map>
#include <utility>
#include "3party/ankerl/unordered_dense.h"
namespace dp
{
class GPUMemTracker
@@ -38,7 +39,7 @@ public:
uint32_t m_summaryAllocatedInMb = 0;
uint32_t m_summaryUsedInMb = 0;
std::map<std::string, TagMemorySnapshot> m_tagStats;
std::unordered_map<uint64_t, AverageAllocation> m_averageAllocations;
ankerl::unordered_dense::map<uint64_t, AverageAllocation> m_averageAllocations;
};
static GPUMemTracker & Inst();
@@ -57,7 +58,7 @@ private:
using TAlocUsedMem = std::pair<uint32_t, uint32_t>;
using TMemTag = std::pair<std::string, uint32_t>;
std::map<TMemTag, TAlocUsedMem> m_memTracker;
std::unordered_map<uint64_t, AverageAllocation> m_averageAllocations;
ankerl::unordered_dense::map<uint64_t, AverageAllocation> m_averageAllocations;
std::mutex m_mutex;

View File

@@ -16,7 +16,7 @@ namespace vulkan
class VulkanGpuProgram : public GpuProgram
{
public:
using TextureBindings = std::unordered_map<std::string, int8_t>;
using TextureBindings = ankerl::unordered_dense::map<std::string, int8_t>;
VulkanGpuProgram(std::string const & programName, VkPipelineShaderStageCreateInfo const & vertexShader,
VkPipelineShaderStageCreateInfo const & fragmentShader, VkDescriptorSetLayout descriptorSetLayout,

View File

@@ -9,9 +9,10 @@
#include <memory>
#include <mutex>
#include <optional>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace dp
{
namespace vulkan
@@ -89,7 +90,7 @@ private:
uint32_t m_totalAllocationCounter = 0;
using MemoryBlocks = std::vector<drape_ptr<MemoryBlock>>;
std::array<std::unordered_map<uint64_t, MemoryBlocks>, kResourcesCount> m_memory;
std::array<ankerl::unordered_dense::map<uint64_t, MemoryBlocks>, kResourcesCount> m_memory;
std::array<MemoryBlocks, kResourcesCount> m_freeBlocks;
std::array<uint32_t, kResourcesCount> m_sizes = {};
};

View File

@@ -196,7 +196,15 @@ m2::PointF GetOffset(int offsetX, int offsetY)
bool IsSymbolRoadShield(ftypes::RoadShield const & shield)
{
return shield.m_type == ftypes::RoadShieldType::Highway_Hexagon_Green || shield.m_type == ftypes::RoadShieldType::Highway_Hexagon_Blue || shield.m_type == ftypes::RoadShieldType::Highway_Hexagon_Red || shield.m_type == ftypes::RoadShieldType::Highway_Hexagon_Turkey || shield.m_type == ftypes::RoadShieldType::US_Interstate || shield.m_type == ftypes::RoadShieldType::US_Highway || shield.m_type == ftypes::RoadShieldType::Italy_Autostrada || shield.m_type == ftypes::RoadShieldType::Hungary_Green || shield.m_type == ftypes::RoadShieldType::Hungary_Blue;
return shield.m_type == ftypes::RoadShieldType::Highway_Hexagon_Green ||
shield.m_type == ftypes::RoadShieldType::Highway_Hexagon_Blue ||
shield.m_type == ftypes::RoadShieldType::Highway_Hexagon_Red ||
shield.m_type == ftypes::RoadShieldType::Highway_Hexagon_Turkey ||
shield.m_type == ftypes::RoadShieldType::US_Interstate ||
shield.m_type == ftypes::RoadShieldType::US_Highway ||
shield.m_type == ftypes::RoadShieldType::Italy_Autostrada ||
shield.m_type == ftypes::RoadShieldType::Hungary_Green ||
shield.m_type == ftypes::RoadShieldType::Hungary_Blue;
}
std::string GetRoadShieldSymbolName(ftypes::RoadShield const & shield, double fontScale)
@@ -232,8 +240,7 @@ std::string GetRoadShieldSymbolName(ftypes::RoadShield const & shield, double fo
bool IsColoredRoadShield(ftypes::RoadShield const & shield)
{
return shield.m_type == ftypes::RoadShieldType::Default ||
shield.m_type == ftypes::RoadShieldType::Generic_White ||
return shield.m_type == ftypes::RoadShieldType::Default || shield.m_type == ftypes::RoadShieldType::Generic_White ||
shield.m_type == ftypes::RoadShieldType::Generic_Green ||
shield.m_type == ftypes::RoadShieldType::Generic_Blue ||
shield.m_type == ftypes::RoadShieldType::Generic_Red ||
@@ -337,11 +344,15 @@ dp::Color GetRoadShieldTextColor(dp::Color const & baseColor, ftypes::RoadShield
float GetRoadShieldOutlineWidth(float baseWidth, ftypes::RoadShield const & shield)
{
if (shield.m_type == ftypes::RoadShieldType::Generic_White || shield.m_type == ftypes::RoadShieldType::Generic_Green ||
shield.m_type == ftypes::RoadShieldType::Generic_Blue || shield.m_type == ftypes::RoadShieldType::Generic_Red ||
shield.m_type == ftypes::RoadShieldType::Generic_Orange || shield.m_type == ftypes::RoadShieldType::Generic_Pill_White || shield.m_type == ftypes::RoadShieldType::Generic_Pill_Green ||
shield.m_type == ftypes::RoadShieldType::Generic_Pill_Blue || shield.m_type == ftypes::RoadShieldType::Generic_Pill_Red ||
shield.m_type == ftypes::RoadShieldType::Generic_Pill_Orange || shield.m_type == ftypes::RoadShieldType::UK_Highway)
if (shield.m_type == ftypes::RoadShieldType::Generic_White ||
shield.m_type == ftypes::RoadShieldType::Generic_Green || shield.m_type == ftypes::RoadShieldType::Generic_Blue ||
shield.m_type == ftypes::RoadShieldType::Generic_Red || shield.m_type == ftypes::RoadShieldType::Generic_Orange ||
shield.m_type == ftypes::RoadShieldType::Generic_Pill_White ||
shield.m_type == ftypes::RoadShieldType::Generic_Pill_Green ||
shield.m_type == ftypes::RoadShieldType::Generic_Pill_Blue ||
shield.m_type == ftypes::RoadShieldType::Generic_Pill_Red ||
shield.m_type == ftypes::RoadShieldType::Generic_Pill_Orange ||
shield.m_type == ftypes::RoadShieldType::UK_Highway)
return 0.0f;
return baseWidth;

View File

@@ -9,9 +9,10 @@
#include <mutex>
#include <string>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace df
{
struct DrapeApiLineData
@@ -52,7 +53,7 @@ struct DrapeApiLineData
class DrapeApi
{
public:
using TLines = std::unordered_map<std::string, DrapeApiLineData>;
using TLines = ankerl::unordered_dense::map<std::string, DrapeApiLineData>;
DrapeApi() = default;

View File

@@ -10,7 +10,7 @@
#include "platform/settings.hpp"
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
namespace df
{
@@ -240,7 +240,7 @@ void DrapeEngine::UpdateUserMarks(UserMarksProvider * provider, bool firstTime)
auto justCreatedIdCollection = make_unique_dp<IDCollections>();
auto removedIdCollection = make_unique_dp<IDCollections>();
std::unordered_map<kml::MarkGroupId, drape_ptr<IDCollections>> groupsVisibleIds;
ankerl::unordered_dense::map<kml::MarkGroupId, drape_ptr<IDCollections>> groupsVisibleIds;
auto const groupFilter = [&](kml::MarkGroupId groupId)
{ return provider->IsGroupVisible(groupId) && (provider->GetBecameVisibleGroupIds().count(groupId) == 0); };

View File

@@ -15,9 +15,10 @@
#include <memory>
#include <mutex>
#include <numeric>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace df
{
class DrapeMeasurer
@@ -183,7 +184,7 @@ private:
uint32_t m_minFPS = std::numeric_limits<uint32_t>::max();
double m_totalFPS = 0.0;
uint32_t m_totalFPSCount = 0;
std::unordered_map<uint32_t, uint32_t> m_fpsDistribution;
ankerl::unordered_dense::map<uint32_t, uint32_t> m_fpsDistribution;
std::chrono::time_point<std::chrono::steady_clock> m_startImmediateRenderingTime;
uint32_t m_immediateRenderingMinFps = std::numeric_limits<uint32_t>::max();

View File

@@ -1821,8 +1821,8 @@ void FrontendRenderer::BuildOverlayTree(ScreenBase const & modelView)
BeginUpdateOverlayTree(modelView);
for (auto const layerId :
{DepthLayer::OverlayUnderBuildingLayer, DepthLayer::OverlayLayer, DepthLayer::RoutingBottomMarkLayer, DepthLayer::RoutingMarkLayer})
for (auto const layerId : {DepthLayer::OverlayUnderBuildingLayer, DepthLayer::OverlayLayer,
DepthLayer::RoutingBottomMarkLayer, DepthLayer::RoutingMarkLayer})
{
RenderLayer & overlay = m_layers[static_cast<size_t>(layerId)];
overlay.Sort(make_ref(m_overlayTree));
@@ -2512,7 +2512,9 @@ void FrontendRenderer::UpdateScene(ScreenBase const & modelView)
uint32_t constexpr kMaxGenerationRange = 5;
TileKey const & key = group->GetTileKey();
return ((GetDepthLayer(group->GetState()) == DepthLayer::OverlayLayer || GetDepthLayer(group->GetState()) == DepthLayer::OverlayUnderBuildingLayer) && key.m_zoomLevel > GetCurrentZoom()) ||
return ((GetDepthLayer(group->GetState()) == DepthLayer::OverlayLayer ||
GetDepthLayer(group->GetState()) == DepthLayer::OverlayUnderBuildingLayer) &&
key.m_zoomLevel > GetCurrentZoom()) ||
(m_maxGeneration - key.m_generation > kMaxGenerationRange) ||
(group->IsUserMark() && (m_maxUserMarksGeneration - key.m_userMarksGeneration > kMaxGenerationRange));
};

View File

@@ -11,11 +11,12 @@
#include <functional>
#include <string>
#include <unordered_set>
#include "3party/ankerl/unordered_dense.h"
namespace gui
{
using TAlphabet = std::unordered_set<strings::UniChar>;
using TAlphabet = ankerl::unordered_dense::set<strings::UniChar>;
class StaticLabel
{

View File

@@ -16,12 +16,14 @@
#include <set>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace
{
struct MetalineData
{
std::vector<FeatureID> m_features;
std::set<FeatureID> m_reversed;
ankerl::unordered_dense::set<FeatureID> m_reversed;
};
std::vector<MetalineData> ReadMetalinesFromFile(MwmSet::MwmId const & mwmId)
@@ -58,12 +60,12 @@ std::vector<MetalineData> ReadMetalinesFromFile(MwmSet::MwmId const & mwmId)
}
}
std::map<FeatureID, std::vector<m2::PointD>> ReadPoints(df::MapDataProvider & model, MetalineData const & metaline)
ankerl::unordered_dense::map<FeatureID, std::vector<m2::PointD>> ReadPoints(df::MapDataProvider & model,
MetalineData const & metaline)
{
auto features = metaline.m_features;
std::sort(features.begin(), features.end());
std::map<FeatureID, std::vector<m2::PointD>> result;
ankerl::unordered_dense::map<FeatureID, std::vector<m2::PointD>> result;
model.ReadFeatures([&metaline, &result](FeatureType & ft)
{
ft.ParseGeometry(FeatureType::BEST_GEOMETRY);
@@ -89,7 +91,7 @@ std::map<FeatureID, std::vector<m2::PointD>> ReadPoints(df::MapDataProvider & mo
return result;
}
std::vector<m2::PointD> MergePoints(std::map<FeatureID, std::vector<m2::PointD>> && points,
std::vector<m2::PointD> MergePoints(ankerl::unordered_dense::map<FeatureID, std::vector<m2::PointD>> && points,
std::vector<FeatureID> const & featuresOrder)
{
if (points.size() == 1)
@@ -164,8 +166,10 @@ bool ReadMetalineTask::UpdateCache(MetalineCache & cache)
if (m_metalines.empty())
return false;
cache.merge(m_metalines);
m_metalines.clear();
// Merge maps
auto data = std::move(m_metalines).extract();
cache.insert(std::make_move_iterator(data.begin()), std::make_move_iterator(data.end()));
return true;
}

View File

@@ -5,13 +5,14 @@
#include "geometry/spline.hpp"
#include <atomic>
#include <map>
#include "3party/ankerl/unordered_dense.h"
namespace df
{
class MapDataProvider;
using MetalineCache = std::map<FeatureID, m2::SharedSpline>;
using MetalineCache = ankerl::unordered_dense::map<FeatureID, m2::SharedSpline>;
class ReadMetalineTask
{

View File

@@ -7,12 +7,17 @@ namespace
using namespace df;
std::array<RenderStateExtension, static_cast<size_t>(DepthLayer::LayersCount)> kStateExtensions = {
RenderStateExtension(DepthLayer::GeometryLayer), RenderStateExtension(DepthLayer::Geometry3dLayer),
RenderStateExtension(DepthLayer::UserLineLayer), RenderStateExtension(DepthLayer::OverlayLayer),
RenderStateExtension(DepthLayer::TransitSchemeLayer), RenderStateExtension(DepthLayer::UserMarkLayer),
RenderStateExtension(DepthLayer::RoutingBottomMarkLayer), RenderStateExtension(DepthLayer::RoutingMarkLayer),
RenderStateExtension(DepthLayer::SearchMarkLayer), RenderStateExtension(DepthLayer::GuiLayer),
RenderStateExtension(DepthLayer::OverlayUnderBuildingLayer)};
RenderStateExtension(DepthLayer::GeometryLayer),
RenderStateExtension(DepthLayer::Geometry3dLayer),
RenderStateExtension(DepthLayer::UserLineLayer),
RenderStateExtension(DepthLayer::OverlayLayer),
RenderStateExtension(DepthLayer::TransitSchemeLayer),
RenderStateExtension(DepthLayer::UserMarkLayer),
RenderStateExtension(DepthLayer::RoutingBottomMarkLayer),
RenderStateExtension(DepthLayer::RoutingMarkLayer),
RenderStateExtension(DepthLayer::SearchMarkLayer),
RenderStateExtension(DepthLayer::GuiLayer),
RenderStateExtension(DepthLayer::OverlayUnderBuildingLayer)};
struct RenderStateExtensionFactory
{

View File

@@ -10,9 +10,10 @@
#include "geometry/polyline2d.hpp"
#include <functional>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace dp
{
class TextureManager;
@@ -48,6 +49,6 @@ private:
m2::PolylineD m_polyline;
double m_baseDepthIndex = 0.0;
};
std::unordered_map<dp::DrapeID, RouteCacheData> m_routeCache;
ankerl::unordered_dense::map<dp::DrapeID, RouteCacheData> m_routeCache;
};
} // namespace df

View File

@@ -14,10 +14,10 @@
#include <chrono>
#include <functional>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace df
{
extern std::string const kRouteColor;
@@ -119,13 +119,13 @@ private:
double m_distanceFromBegin;
bool m_followingEnabled;
Subroutes m_subroutes;
std::unordered_set<dp::DrapeID> m_hiddenSubroutes;
ankerl::unordered_dense::set<dp::DrapeID> m_hiddenSubroutes;
PreviewPointsRequestCallback m_previewPointsRequest;
std::vector<drape_ptr<CirclesPackRenderData>> m_previewRenderData;
std::vector<std::pair<CirclesPackHandle *, size_t>> m_previewHandlesCache;
bool m_waitForPreviewRenderData;
std::unordered_map<dp::DrapeID, PreviewInfo> m_previewSegments;
ankerl::unordered_dense::map<dp::DrapeID, PreviewInfo> m_previewSegments;
m2::PointD m_previewPivot = m2::PointD::Zero();
};
} // namespace df

View File

@@ -363,7 +363,9 @@ void RuleDrawer::ProcessLineStyle(FeatureType & f, Stylist const & s, TInsertSha
df::RoadClass m_roadClass;
};
static Checker const checkers[] = {
{{HighwayClass::Motorway, HighwayClass::Trunk, HighwayClass::Primary}, kRoadClass0ZoomLevel, df::RoadClass::Class0},
{{HighwayClass::Motorway, HighwayClass::Trunk, HighwayClass::Primary},
kRoadClass0ZoomLevel,
df::RoadClass::Class0},
{{HighwayClass::Secondary, HighwayClass::Tertiary}, kRoadClass1ZoomLevel, df::RoadClass::Class1},
{{HighwayClass::LivingStreet, HighwayClass::Service, HighwayClass::ServiceMinor},
kRoadClass2ZoomLevel,

View File

@@ -17,7 +17,8 @@
#include <functional>
#include <map>
#include <string>
#include <unordered_set>
#include "3party/ankerl/unordered_dense.h"
class FeatureType;
@@ -69,7 +70,7 @@ private:
ref_ptr<EngineContext> m_context;
CustomFeaturesContextPtr m_customFeaturesContext;
int8_t m_deviceLang;
std::unordered_set<m2::Spline const *> m_usedMetalines;
ankerl::unordered_dense::set<m2::Spline const *> m_usedMetalines;
m2::RectD m_globalRect;
double m_currentScaleGtoP;

View File

@@ -60,15 +60,17 @@ void CaptionDescription::Init(FeatureType & f, int8_t deviceLang, int zoomLevel,
f.GetReadableName(true /* allowTranslit */, deviceLang, out);
}
m_mainText = out.GetPrimary();
if (ftypes::IsPublicTransportStopChecker::Instance()(feature::TypesHolder(f))) {
if (ftypes::IsPublicTransportStopChecker::Instance()(feature::TypesHolder(f)))
{
auto const lRef = f.GetMetadata(feature::Metadata::FMD_LOCAL_REF);
if (!m_mainText.empty() && !lRef.empty()) {
//m_mainText.append(" (").append(lRef).append(")");
if (!m_mainText.empty() && !lRef.empty())
{
// m_mainText.append(" (").append(lRef).append(")");
m_auxText = lRef;
}
}
ASSERT(m_auxText.empty() || !m_mainText.empty(), ("auxText without mainText"));
uint8_t constexpr kLongCaptionsMaxZoom = 4;

View File

@@ -19,9 +19,10 @@
#include <array>
#include <functional>
#include <map>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace dp
{
class GraphicsContext;
@@ -150,7 +151,7 @@ struct TrafficCircleStaticVertex
TTexCoord m_colorTexCoord;
};
using TrafficTexCoords = std::unordered_map<size_t, glsl::vec2>;
using TrafficTexCoords = ankerl::unordered_dense::map<size_t, glsl::vec2>;
class TrafficGenerator final
{

View File

@@ -654,7 +654,7 @@ void TransitSchemeBuilder::CollectShapesPT(TransitDisplayInfo const & transitDis
CHECK_EQUAL(transitDisplayInfo.m_transitVersion, ::transit::TransitVersion::AllPublicTransport, ());
float curDepth = kBaseLineDepth;
std::unordered_map<std::string, float> routeColorToDepth;
ankerl::unordered_dense::map<std::string, float> routeColorToDepth;
for (auto const & [lineId, metaData] : transitDisplayInfo.m_linesMetadataPT)
{

View File

@@ -112,7 +112,7 @@ struct StopNodeParamsPT
std::map<::transit::TransitId, StopInfo> m_stopsInfo;
};
using IdToIdSet = std::unordered_map<::transit::TransitId, ::transit::IdSet>;
using IdToIdSet = ankerl::unordered_dense::map<::transit::TransitId, ::transit::IdSet>;
struct RouteSegment
{

View File

@@ -53,7 +53,7 @@ private:
MarksIDGroups const & indexesGroups, ref_ptr<dp::TextureManager> textures,
dp::Batcher & batcher) const;
std::unordered_set<kml::MarkGroupId> m_groupsVisibility;
ankerl::unordered_dense::set<kml::MarkGroupId> m_groupsVisibility;
MarksIDGroups m_groups;
UserMarksRenderCollection m_marks;

View File

@@ -10,7 +10,8 @@
#include <limits>
#include <memory>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
namespace df
{
@@ -65,8 +66,8 @@ struct UserLineRenderParams
std::vector<m2::SharedSpline> m_splines;
};
using UserMarksRenderCollection = std::unordered_map<kml::MarkId, drape_ptr<UserMarkRenderParams>>;
using UserLinesRenderCollection = std::unordered_map<kml::MarkId, drape_ptr<UserLineRenderParams>>;
using UserMarksRenderCollection = ankerl::unordered_dense::map<kml::MarkId, drape_ptr<UserMarkRenderParams>>;
using UserLinesRenderCollection = ankerl::unordered_dense::map<kml::MarkId, drape_ptr<UserLineRenderParams>>;
struct UserMarkRenderData
{

View File

@@ -245,7 +245,7 @@ void ChangesetWrapper::AddChangesetTag(std::string key, std::string value)
{
value = strings::EscapeForXML(value);
//OSM has a length limit of 255 characters
// OSM has a length limit of 255 characters
if (value.length() > kMaximumOsmChars)
{
LOG(LWARNING, ("value is too long for OSM 255 char limit: ", value));

View File

@@ -5,7 +5,8 @@
#include <algorithm>
#include <cstring>
#include <string>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
namespace editor
{
@@ -14,7 +15,7 @@ namespace
using EType = feature::Metadata::EType;
// TODO(mgsergio): It would be nice to have this map generated from editor.config.
static std::unordered_map<std::string, EType> const kNamesToFMD = {
static ankerl::unordered_dense::map<std::string, EType> const kNamesToFMD = {
{"opening_hours", EType::FMD_OPEN_HOURS},
{"phone", EType::FMD_PHONE_NUMBER},
{"fax", EType::FMD_FAX_NUMBER},
@@ -55,7 +56,7 @@ static std::unordered_map<std::string, EType> const kNamesToFMD = {
/// @todo Add description?
};
std::unordered_map<std::string, int> const kPriorityWeights = {{"high", 0}, {"", 1}, {"low", 2}};
ankerl::unordered_dense::map<std::string, int> const kPriorityWeights = {{"high", 0}, {"", 1}, {"low", 2}};
bool TypeDescriptionFromXml(pugi::xml_node const & root, pugi::xml_node const & node,
editor::TypeAggregatedDescription & outDesc)

View File

@@ -156,7 +156,8 @@ void Notes::CreateNote(ms::LatLon const & latLon, std::string const & text)
void Notes::Upload(osm::OsmOAuth const & auth)
{
std::unique_lock<std::mutex> uploadingNotesLock(m_uploadingNotesMutex, std::defer_lock);
if (!uploadingNotesLock.try_lock()) {
if (!uploadingNotesLock.try_lock())
{
// Do not run more than one uploading task at a time.
LOG(LDEBUG, ("OSM notes upload is already running"));
return;

View File

@@ -8,128 +8,621 @@
// Changes to the list: don't remove 'wheelchair' and addresses in the 'contact:' style
inline constexpr std::string_view kKeysToRemove[] = {
"shop_?[1-9]?(:.*)?", "craft_?[1-9]?", "amenity_?[1-9]?", "club_?[1-9]?", "old_amenity",
"old_shop", "information", "leisure", "office_?[1-9]?", "tourism",
"shop_?[1-9]?(:.*)?",
"craft_?[1-9]?",
"amenity_?[1-9]?",
"club_?[1-9]?",
"old_amenity",
"old_shop",
"information",
"leisure",
"office_?[1-9]?",
"tourism",
// popular shop=* / craft=* subkeys
"marketplace", "household", "swimming_pool", "laundry", "golf", "sports", "ice_cream",
"scooter", "music", "retail", "yes", "ticket", "newsagent", "lighting", "truck", "car_repair",
"car_parts", "video", "fuel", "farm", "car", "tractor", "hgv", "ski", "sculptor",
"hearing_aids", "surf", "photo", "boat", "gas", "kitchen", "anime", "builder", "hairdresser",
"security", "bakery", "bakehouse", "fishing", "doors", "kiosk", "market", "bathroom", "lamps",
"vacant", "insurance(:.*)?", "caravan", "gift", "bicycle", "bicycle_rental", "insulation",
"communication", "mall", "model", "empty", "wood", "hunting", "motorcycle", "trailer",
"camera", "water", "fireplace", "outdoor", "blacksmith", "electronics", "fan", "piercing",
"stationery", "sensory_friendly(:.*)?", "street_vendor", "sells(:.*)?", "safety_equipment",
"marketplace",
"household",
"swimming_pool",
"laundry",
"golf",
"sports",
"ice_cream",
"scooter",
"music",
"retail",
"yes",
"ticket",
"newsagent",
"lighting",
"truck",
"car_repair",
"car_parts",
"video",
"fuel",
"farm",
"car",
"tractor",
"hgv",
"ski",
"sculptor",
"hearing_aids",
"surf",
"photo",
"boat",
"gas",
"kitchen",
"anime",
"builder",
"hairdresser",
"security",
"bakery",
"bakehouse",
"fishing",
"doors",
"kiosk",
"market",
"bathroom",
"lamps",
"vacant",
"insurance(:.*)?",
"caravan",
"gift",
"bicycle",
"bicycle_rental",
"insulation",
"communication",
"mall",
"model",
"empty",
"wood",
"hunting",
"motorcycle",
"trailer",
"camera",
"water",
"fireplace",
"outdoor",
"blacksmith",
"electronics",
"fan",
"piercing",
"stationery",
"sensory_friendly(:.*)?",
"street_vendor",
"sells(:.*)?",
"safety_equipment",
// obsoleted information
"(demolished|abandoned|disused)(:(?!bui).+)?", "was:.*", "not:.*", "damage", "created_by",
"check_date", "opening_date", "last_checked", "checked_exists:date", "pharmacy_survey",
"old_ref", "update", "import_uuid", "review", "fixme:atp",
"(demolished|abandoned|disused)(:(?!bui).+)?",
"was:.*",
"not:.*",
"damage",
"created_by",
"check_date",
"opening_date",
"last_checked",
"checked_exists:date",
"pharmacy_survey",
"old_ref",
"update",
"import_uuid",
"review",
"fixme:atp",
// classifications / links to external databases
"fhrs:.*", "old_fhrs:.*", "fvst:.*", "ncat", "nat_ref", "gnis:.*", "winkelnummer",
"type:FR:FINESS", "type:FR:APE", "kvl_hro:amenity", "ref:DK:cvr(:.*)?", "certifications?",
"transiscope", "opendata:type", "local_ref", "official_ref",
"fhrs:.*",
"old_fhrs:.*",
"fvst:.*",
"ncat",
"nat_ref",
"gnis:.*",
"winkelnummer",
"type:FR:FINESS",
"type:FR:APE",
"kvl_hro:amenity",
"ref:DK:cvr(:.*)?",
"certifications?",
"transiscope",
"opendata:type",
"local_ref",
"official_ref",
// names and identifications
"name_?[1-9]?(:.*)?", ".*_name_?[1-9]?(:.*)?", "noname", "branch(:.*)?", "brand(:.*)?",
"not:brand(:.*)?", "network(:.*)?", "operator(:.*)?", "operator_type", "ref", "ref:vatin",
"designation", "SEP:CLAVEESC", "identifier", "ref:FR:SIRET", "ref:FR:SIREN", "ref:FR:NAF",
"name_?[1-9]?(:.*)?",
".*_name_?[1-9]?(:.*)?",
"noname",
"branch(:.*)?",
"brand(:.*)?",
"not:brand(:.*)?",
"network(:.*)?",
"operator(:.*)?",
"operator_type",
"ref",
"ref:vatin",
"designation",
"SEP:CLAVEESC",
"identifier",
"ref:FR:SIRET",
"ref:FR:SIREN",
"ref:FR:NAF",
"(old_)?ref:FR:prix-carburants",
// contacts
"contact_person", "phone(:.*)?", "phone_?[1-9]?", "emergency:phone", "emergency_telephone_code",
"contact_person",
"phone(:.*)?",
"phone_?[1-9]?",
"emergency:phone",
"emergency_telephone_code",
"contact:(?!housenumber$|street$|place$|postcode$|city$|country$|pobox$|unit$).*",
"mobile", "fax", "facebook", "instagram", "twitter", "youtube", "telegram", "tiktok", "email",
"website_?[1-9]?(:.*)?", "app:.*", "ownership",
"url", "url:official", "source_ref:url", "owner",
"mobile",
"fax",
"facebook",
"instagram",
"twitter",
"youtube",
"telegram",
"tiktok",
"email",
"website_?[1-9]?(:.*)?",
"app:.*",
"ownership",
"url",
"url:official",
"source_ref:url",
"owner",
// payments
"payment(:.*)?", "payment_multi_fee", "currency(:.*)?", "cash_withdrawal(:.*)?", "fee",
"charge", "charge_fee", "money_transfer", "donation:compensation", "paypoint",
"payment(:.*)?",
"payment_multi_fee",
"currency(:.*)?",
"cash_withdrawal(:.*)?",
"fee",
"charge",
"charge_fee",
"money_transfer",
"donation:compensation",
"paypoint",
// generic shop/craft attributes
"seasonal", "time", "opening_hours(:.*)?", "check_(in|out)", "wifi", "internet",
"internet_access(:.*)?", "second_hand", "self_service", "automated", "license:.*",
"bulk_purchase", ".*:covid19", "language:.*", "baby_feeding", "description(:.*)?",
"description[0-9]", "min_age", "max_age", "supermarket(:.*)?", "social_facility(:.*)?",
"functional", "trade", "wholesale", "sale", "smoking(:outside)?", "zero_waste", "origin",
"attraction", "strapline", "dog", "showroom", "toilets?(:.*)?", "sanitary_dump_station",
"changing_table(:.*)?", "blind", "company(:.*)?", "stroller", "walk-in",
"webshop", "operational_status.*", "status", "drive_through", "surveillance(:.*)?",
"outdoor_seating", "indoor_seating", "colour", "access_simple", "floor", "product_category",
"guide", "source_url", "category", "kids_area", "kids_area:indoor", "resort", "since", "state",
"temporary", "self_checkout", "audio_loop", "related_law(:.*)?", "official_status(:.*)?",
"seasonal",
"time",
"opening_hours(:.*)?",
"check_(in|out)",
"wifi",
"internet",
"internet_access(:.*)?",
"second_hand",
"self_service",
"automated",
"license:.*",
"bulk_purchase",
".*:covid19",
"language:.*",
"baby_feeding",
"description(:.*)?",
"description[0-9]",
"min_age",
"max_age",
"supermarket(:.*)?",
"social_facility(:.*)?",
"functional",
"trade",
"wholesale",
"sale",
"smoking(:outside)?",
"zero_waste",
"origin",
"attraction",
"strapline",
"dog",
"showroom",
"toilets?(:.*)?",
"sanitary_dump_station",
"changing_table(:.*)?",
"blind",
"company(:.*)?",
"stroller",
"walk-in",
"webshop",
"operational_status.*",
"status",
"drive_through",
"surveillance(:.*)?",
"outdoor_seating",
"indoor_seating",
"colour",
"access_simple",
"floor",
"product_category",
"guide",
"source_url",
"category",
"kids_area",
"kids_area:indoor",
"resort",
"since",
"state",
"temporary",
"self_checkout",
"audio_loop",
"related_law(:.*)?",
"official_status(:.*)?",
// food and drink details
"bar", "cafe", "coffee", "microroasting", "microbrewery", "brewery", "real_ale", "taproom",
"training", "distillery", "drink(:.*)?", "cocktails", "alcohol", "wine([:_].*)?",
"happy_hours", "diet:.*", "cuisine", "ethnic", "tasting", "breakfast", "lunch", "organic",
"produced_on_site", "restaurant", "food", "pastry", "pastry_shop", "product", "produce",
"chocolate", "fair_trade", "butcher", "reservation(:.*)?", "takeaway(:.*)?", "delivery(:.*)?",
"caterer", "real_fire", "flour_fortified", "highchair", "fast_food", "pub", "snack",
"confectionery", "drinking_water:refill",
"bar",
"cafe",
"coffee",
"microroasting",
"microbrewery",
"brewery",
"real_ale",
"taproom",
"training",
"distillery",
"drink(:.*)?",
"cocktails",
"alcohol",
"wine([:_].*)?",
"happy_hours",
"diet:.*",
"cuisine",
"ethnic",
"tasting",
"breakfast",
"lunch",
"organic",
"produced_on_site",
"restaurant",
"food",
"pastry",
"pastry_shop",
"product",
"produce",
"chocolate",
"fair_trade",
"butcher",
"reservation(:.*)?",
"takeaway(:.*)?",
"delivery(:.*)?",
"caterer",
"real_fire",
"flour_fortified",
"highchair",
"fast_food",
"pub",
"snack",
"confectionery",
"drinking_water:refill",
// related to repair shops/crafts
"service(:.*)?", "motorcycle:.*", "repair", ".*:repair", "electronics_repair(:.*)?",
"service(:.*)?",
"motorcycle:.*",
"repair",
".*:repair",
"electronics_repair(:.*)?",
"workshop",
// shop=hairdresser, shop=clothes
"unisex", "male", "female", "gender", "gender_simple", "lgbtq(:.*)?", "gay", "female:signed",
"unisex",
"male",
"female",
"gender",
"gender_simple",
"lgbtq(:.*)?",
"gay",
"female:signed",
"male:signed",
// healthcare
"healthcare(:.*)?", "healthcare_.*", "health", "health_.*", "speciality", "medical_.*",
"emergency_ward", "facility(:.*)?", "activities", "healthcare_facility(:.*)?",
"laboratory(:.*)?", "blood(:.*)?", "blood_components", "infection(:.*)?", "disease(:.*)?",
"covid19(:.*)?", "COVID_.*", "CovidVaccineCenterId", "coronaquarantine", "hospital(:.*)?",
"hospital_type_id", "emergency_room", "sample_collection(:.*)?", "bed_count", "capacity:beds",
"part_time_beds", "personnel:count", "staff_count(:.*)?", "admin_staff", "doctors",
"doctors_num", "nurses_num", "counselling_type", "testing_centres", "toilets_number",
"urgent_care", "vaccination", "clinic", "hospital", "pharmacy", "alternative", "laboratory",
"sample_collection", "provided_for(:.*)?", "social_facility_for", "ambulance", "ward",
"HSE_(code|hgid|hgroup|region)", "collection_centre", "design", "AUTORIZATIE", "reg_id",
"post_addr", "scope", "ESTADO", "NIVSOCIO", "NO", "EMP_EST", "COD_HAB", "CLA_PERS", "CLA_PRES",
"snis_code:.*", "hfac_bed", "hfac_type", "nature", "moph_code", "IJSN:.*", "massgis:id",
"OGD-Stmk:.*", "paho:.*", "panchayath", "pbf_contract", "pcode", "pe:minsa:.*", "who:.*",
"pharmacy:category", "tactile_paving", "HF_(ID|TYPE|N_EN)", "RoadConn", "bin", "hiv(:.*)?",
"healthcare(:.*)?",
"healthcare_.*",
"health",
"health_.*",
"speciality",
"medical_.*",
"emergency_ward",
"facility(:.*)?",
"activities",
"healthcare_facility(:.*)?",
"laboratory(:.*)?",
"blood(:.*)?",
"blood_components",
"infection(:.*)?",
"disease(:.*)?",
"covid19(:.*)?",
"COVID_.*",
"CovidVaccineCenterId",
"coronaquarantine",
"hospital(:.*)?",
"hospital_type_id",
"emergency_room",
"sample_collection(:.*)?",
"bed_count",
"capacity:beds",
"part_time_beds",
"personnel:count",
"staff_count(:.*)?",
"admin_staff",
"doctors",
"doctors_num",
"nurses_num",
"counselling_type",
"testing_centres",
"toilets_number",
"urgent_care",
"vaccination",
"clinic",
"hospital",
"pharmacy",
"alternative",
"laboratory",
"sample_collection",
"provided_for(:.*)?",
"social_facility_for",
"ambulance",
"ward",
"HSE_(code|hgid|hgroup|region)",
"collection_centre",
"design",
"AUTORIZATIE",
"reg_id",
"post_addr",
"scope",
"ESTADO",
"NIVSOCIO",
"NO",
"EMP_EST",
"COD_HAB",
"CLA_PERS",
"CLA_PRES",
"snis_code:.*",
"hfac_bed",
"hfac_type",
"nature",
"moph_code",
"IJSN:.*",
"massgis:id",
"OGD-Stmk:.*",
"paho:.*",
"panchayath",
"pbf_contract",
"pcode",
"pe:minsa:.*",
"who:.*",
"pharmacy:category",
"tactile_paving",
"HF_(ID|TYPE|N_EN)",
"RoadConn",
"bin",
"hiv(:.*)?",
// accommodation & layout
"rooms", "stars", "accommodation", "beds", "capacity(:persons)?", "laundry_service",
"rooms",
"stars",
"accommodation",
"beds",
"capacity(:persons)?",
"laundry_service",
"guest_house",
// amenity=place_of_worship
"deanery", "subject:(wikidata|wikipedia|wikimedia_commons)", "church", "church:type",
"deanery",
"subject:(wikidata|wikipedia|wikimedia_commons)",
"church",
"church:type",
// schools
"capacity:(pupils|teachers)", "grades", "population:pupils(:.*)?",
"school:(FR|gender|trust|type|type_idn|group:type)", "primary",
"capacity:(pupils|teachers)",
"grades",
"population:pupils(:.*)?",
"school:(FR|gender|trust|type|type_idn|group:type)",
"primary",
// clubs
"animal(_breeding|_training)?", "billiards(:.*)?", "board_game", "sport_1", "sport:boating",
"boat:type", "canoe(_rental|:service)?", "kayak(_rental|:service)?",
"sailboat(_rental|:service)?", "horse_riding", "rugby", "boules", "callsign", "card_games",
"car_service", "catastro:ref", "chess(:.*)?", "children", "climbing(:.*)?", "club(:.*)?",
"communication(:amateur_radio.*)", "community_centre:for", "dffr:network", "dormitory",
"education_for:ages", "electrified", "esperanto", "events_venue", "family", "federation",
"free_flying(:.*)?", "freemasonry(:.*)?", "free_refill", "gaelic_games(:.*)?", "membership",
"military_service", "model_aerodrome(:.*)?", "mode_of_organisation(:.*)?", "snowmobile",
"social_centre(:for)?", "source_dat", "tennis", "old_website", "organisation", "school_type",
"scout(:type)?", "fraternity", "live_music", "lockable", "playground(:theme)?", "nudism",
"music_genre", "length", "fire_station:type:FR", "cadet", "observatory:type", "tower:type",
"zoo", "shooting", "commons", "groomer", "group_only", "hazard", "identity", "interaction",
"logo", "maxheight", "provides", "regional", "scale", "site", "plots", "allotments",
"local_food", "monitoring:pedestrian", "recording:automated", "yacht", "background_music",
"url:spaceapi", "openfire", "fraternity(:.*)?",
"animal(_breeding|_training)?",
"billiards(:.*)?",
"board_game",
"sport_1",
"sport:boating",
"boat:type",
"canoe(_rental|:service)?",
"kayak(_rental|:service)?",
"sailboat(_rental|:service)?",
"horse_riding",
"rugby",
"boules",
"callsign",
"card_games",
"car_service",
"catastro:ref",
"chess(:.*)?",
"children",
"climbing(:.*)?",
"club(:.*)?",
"communication(:amateur_radio.*)",
"community_centre:for",
"dffr:network",
"dormitory",
"education_for:ages",
"electrified",
"esperanto",
"events_venue",
"family",
"federation",
"free_flying(:.*)?",
"freemasonry(:.*)?",
"free_refill",
"gaelic_games(:.*)?",
"membership",
"military_service",
"model_aerodrome(:.*)?",
"mode_of_organisation(:.*)?",
"snowmobile",
"social_centre(:for)?",
"source_dat",
"tennis",
"old_website",
"organisation",
"school_type",
"scout(:type)?",
"fraternity",
"live_music",
"lockable",
"playground(:theme)?",
"nudism",
"music_genre",
"length",
"fire_station:type:FR",
"cadet",
"observatory:type",
"tower:type",
"zoo",
"shooting",
"commons",
"groomer",
"group_only",
"hazard",
"identity",
"interaction",
"logo",
"maxheight",
"provides",
"regional",
"scale",
"site",
"plots",
"allotments",
"local_food",
"monitoring:pedestrian",
"recording:automated",
"yacht",
"background_music",
"url:spaceapi",
"openfire",
"fraternity(:.*)?",
// misc specific attributes
"clothes", "shoes", "tailor", "beauty", "tobacco", "carpenter", "furniture", "lottery",
"sport", "dispensing", "tailor:.*", "gambling", "material", "raw_material", "stonemason",
"studio", "scuba_diving(:.*)?", "polling_station", "collector", "books", "agrarian",
"musical_instrument", "massage", "parts", "post_office(:.*)?", "religion", "denomination",
"rental", ".*:rental", "tickets:.*", "public_transport", "goods_supply", "pet", "appliance",
"artwork_type", "charity", "company", "crop", "dry_cleaning", "factory", "feature",
"air_conditioning", "atm", "vending", "vending_machine", "recycling_type", "museum",
"license_classes", "dance:.*", "isced:level", "school", "preschool", "university",
"research_institution", "research", "member_of", "topic", "townhall:type", "parish", "police",
"government", "thw:(lv|rb|ltg)", "office", "administration", "administrative", "association",
"transport", "utility", "consulting", "Commercial", "commercial", "private", "taxi",
"admin_level", "official_status", "target", "liaison", "diplomatic(:.*)?", "embassy",
"consulate", "aeroway", "department", "faculty", "aerospace:product", "boundary", "population",
"diocese", "depot", "cargo", "function", "game", "party", "political_party.*",
"telecom(munication)?", "service_times", "kitchen:facilities", "it:(type|sales)",
"cannabis:cbd", "bath:type", "bath:(open_air|sand_bath)", "animal_boarding", "animal_shelter",
"mattress", "screen", "monitoring:weather", "public", "theatre", "culture", "library",
"cooperative(:.*)?", "winery", "curtain", "lawyer(:.*)?", "local_authority(:.*)?", "equipment",
"clothes",
"shoes",
"tailor",
"beauty",
"tobacco",
"carpenter",
"furniture",
"lottery",
"sport",
"dispensing",
"tailor:.*",
"gambling",
"material",
"raw_material",
"stonemason",
"studio",
"scuba_diving(:.*)?",
"polling_station",
"collector",
"books",
"agrarian",
"musical_instrument",
"massage",
"parts",
"post_office(:.*)?",
"religion",
"denomination",
"rental",
".*:rental",
"tickets:.*",
"public_transport",
"goods_supply",
"pet",
"appliance",
"artwork_type",
"charity",
"company",
"crop",
"dry_cleaning",
"factory",
"feature",
"air_conditioning",
"atm",
"vending",
"vending_machine",
"recycling_type",
"museum",
"license_classes",
"dance:.*",
"isced:level",
"school",
"preschool",
"university",
"research_institution",
"research",
"member_of",
"topic",
"townhall:type",
"parish",
"police",
"government",
"thw:(lv|rb|ltg)",
"office",
"administration",
"administrative",
"association",
"transport",
"utility",
"consulting",
"Commercial",
"commercial",
"private",
"taxi",
"admin_level",
"official_status",
"target",
"liaison",
"diplomatic(:.*)?",
"embassy",
"consulate",
"aeroway",
"department",
"faculty",
"aerospace:product",
"boundary",
"population",
"diocese",
"depot",
"cargo",
"function",
"game",
"party",
"political_party.*",
"telecom(munication)?",
"service_times",
"kitchen:facilities",
"it:(type|sales)",
"cannabis:cbd",
"bath:type",
"bath:(open_air|sand_bath)",
"animal_boarding",
"animal_shelter",
"mattress",
"screen",
"monitoring:weather",
"public",
"theatre",
"culture",
"library",
"cooperative(:.*)?",
"winery",
"curtain",
"lawyer(:.*)?",
"local_authority(:.*)?",
"equipment",
"hackerspace",
"camp_site", "camping", "bbq", "static_caravans", "emergency(:.*)?", "evacuation_cent(er|re)",
"education", "engineering", "forestry", "foundation", "lawyer", "logistics", "military",
"community_centre", "bank", "operational", "users_(PLWD|boy|elderly|female|girl|men)",
"Comments?", "comments?", "entrance:(width|step_count|kerb:height)", "fenced", "motor_vehicle",
"camp_site",
"camping",
"bbq",
"static_caravans",
"emergency(:.*)?",
"evacuation_cent(er|re)",
"education",
"engineering",
"forestry",
"foundation",
"lawyer",
"logistics",
"military",
"community_centre",
"bank",
"operational",
"users_(PLWD|boy|elderly|female|girl|men)",
"Comments?",
"comments?",
"entrance:(width|step_count|kerb:height)",
"fenced",
"motor_vehicle",
"shelter",
};

View File

@@ -583,7 +583,8 @@ void Editor::UploadChanges(string const & oauthToken, ChangesetTags tags, Finish
}
std::unique_lock<std::mutex> uploadingEditsLock(m_uploadingEditsMutex, std::defer_lock);
if (!uploadingEditsLock.try_lock()) {
if (!uploadingEditsLock.try_lock())
{
// Do not run more than one uploading task at a time.
LOG(LDEBUG, ("OSM edits upload is already running"));
return;

View File

@@ -120,9 +120,9 @@ void ServerApi06::CloseChangeSet(uint64_t changesetId) const
uint64_t ServerApi06::CreateNote(ms::LatLon const & ll, std::string const & message) const
{
CHECK(!message.empty(), ("Note content should not be empty."));
std::string const params = "?lat=" + strings::to_string_dac(ll.m_lat, 7) +
"&lon=" + strings::to_string_dac(ll.m_lon, 7) +
"&text=" + url::UrlEncode(message + " #CoMaps " + OMIM_OS_NAME + " " + GetPlatform().Version());
std::string const params =
"?lat=" + strings::to_string_dac(ll.m_lat, 7) + "&lon=" + strings::to_string_dac(ll.m_lon, 7) +
"&text=" + url::UrlEncode(message + " #CoMaps " + OMIM_OS_NAME + " " + GetPlatform().Version());
OsmOAuth::Response const response = m_auth.Request("/notes" + params, "POST");
if (response.first != OsmOAuth::HTTP::OK)
MYTHROW(ErrorAddingNote, ("Could not post a new note:", response));

View File

@@ -21,7 +21,8 @@ double constexpr kEps = 1e-10;
// maximal zoom levels.
double constexpr kMaxZoom = 20.0;
bool MatchLatLonZoom(string const & s, boost::regex const & re, size_t lati, size_t loni, size_t zoomi, GeoURLInfo & info)
bool MatchLatLonZoom(string const & s, boost::regex const & re, size_t lati, size_t loni, size_t zoomi,
GeoURLInfo & info)
{
boost::smatch m;
if (!boost::regex_search(s, m, re) || m.size() != 4)
@@ -146,7 +147,10 @@ int LatLonParser::GetCoordinatesPriority(string const & token)
return -1;
}
GeoParser::GeoParser() : m_latlonRe(boost::regex(R"(([+-]?\d+(?:\.\d+)?), *([+-]?\d+(?:\.\d+)?)(:?, *([+-]?\d+(?:\.\d+)?))?)")), m_zoomRe(boost::regex(kFloatIntScale)) {}
GeoParser::GeoParser()
: m_latlonRe(boost::regex(R"(([+-]?\d+(?:\.\d+)?), *([+-]?\d+(?:\.\d+)?)(:?, *([+-]?\d+(?:\.\d+)?))?)"))
, m_zoomRe(boost::regex(kFloatIntScale))
{}
bool GeoParser::Parse(std::string const & raw, GeoURLInfo & info) const
{

View File

@@ -8,7 +8,8 @@
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
class Reader;
@@ -68,7 +69,7 @@ private:
size_t operator()(std::string const & str) const { return hash_type{}(str); }
};
std::unordered_map<std::string, std::shared_ptr<Brand>, StringViewHash, std::equal_to<>> m_keyToName;
ankerl::unordered_dense::map<std::string, std::shared_ptr<Brand>, StringViewHash, std::equal_to<>> m_keyToName;
std::set<std::string> m_keys;
};

View File

@@ -7,9 +7,10 @@
#include <array>
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
class Reader;
class CategoriesHolder
@@ -40,7 +41,7 @@ public:
int8_t m_code;
};
using GroupTranslations = std::unordered_map<std::string, std::vector<Category::Name>>;
using GroupTranslations = ankerl::unordered_dense::map<std::string, std::vector<Category::Name>>;
private:
using Type2CategoryCont = std::multimap<uint32_t, std::shared_ptr<Category>>;

View File

@@ -16,6 +16,8 @@
#include <google/protobuf/text_format.h>
#include "3party/ankerl/unordered_dense.h"
namespace drule
{
using namespace std;
@@ -345,7 +347,7 @@ void RulesHolder::InitBackgroundColors(ContainerProto const & cont)
uint32_t bgColorDefault = DEFAULT_BG_COLOR;
// Background colors specified for scales
unordered_map<int, uint32_t> bgColorForScale;
ankerl::unordered_dense::map<int, uint32_t> bgColorForScale;
// Find the "natural-land" classification element
for (int i = 0; i < cont.cont_size(); ++i)

View File

@@ -13,9 +13,10 @@
#include <iostream>
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
class LineRuleProto;
class AreaRuleProto;
class SymbolRuleProto;
@@ -85,7 +86,7 @@ private:
/// background color for scales in range [0...scales::UPPER_STYLE_SCALE]
std::vector<uint32_t> m_bgColors;
std::unordered_map<std::string, uint32_t> m_colors;
ankerl::unordered_dense::map<std::string, uint32_t> m_colors;
std::vector<BaseRule *> m_dRules;
};

View File

@@ -98,12 +98,7 @@ bool EditableMapObject::CanMarkPlaceAsDisused() const
std::string mainTypeStr = classif().GetReadableObjectName(mainType);
constexpr string_view typePrefixes[] = {
"shop",
"amenity-restaurant",
"amenity-fast_food",
"amenity-cafe",
"amenity-pub",
"amenity-bar",
"shop", "amenity-restaurant", "amenity-fast_food", "amenity-cafe", "amenity-pub", "amenity-bar",
};
for (auto const & typePrefix : typePrefixes)
@@ -601,14 +596,15 @@ bool EditableMapObject::ValidateLevel(string const & level)
{
auto constexpr kMinBuildingLevel = -9;
double valueDouble;
return strings::to_double(s, valueDouble) && valueDouble > kMinBuildingLevel && valueDouble <= kMaximumLevelsEditableByUsers;
return strings::to_double(s, valueDouble) && valueDouble > kMinBuildingLevel &&
valueDouble <= kMaximumLevelsEditableByUsers;
};
// Check for simple value (e.g. "42")
if (!isValidNumber(value))
{
// Check for range (e.g. "-3-12")
size_t rangeSymbol = value.find('-', 1); // skip first as it could be a negative sign
size_t rangeSymbol = value.find('-', 1); // skip first as it could be a negative sign
if (rangeSymbol == std::string::npos)
return false;
@@ -935,16 +931,10 @@ void EditableMapObject::ApplyBusinessReplacement(uint32_t new_type)
// Metadata
feature::Metadata new_metadata;
constexpr MetadataID metadataToKeep[] = {
MetadataID::FMD_WHEELCHAIR,
MetadataID::FMD_POSTCODE,
MetadataID::FMD_LEVEL,
MetadataID::FMD_ELE,
MetadataID::FMD_HEIGHT,
MetadataID::FMD_MIN_HEIGHT,
MetadataID::FMD_BUILDING_LEVELS,
MetadataID::FMD_BUILDING_MIN_LEVEL
};
constexpr MetadataID metadataToKeep[] = {MetadataID::FMD_WHEELCHAIR, MetadataID::FMD_POSTCODE,
MetadataID::FMD_LEVEL, MetadataID::FMD_ELE,
MetadataID::FMD_HEIGHT, MetadataID::FMD_MIN_HEIGHT,
MetadataID::FMD_BUILDING_LEVELS, MetadataID::FMD_BUILDING_MIN_LEVEL};
for (MetadataID const & metadataID : metadataToKeep)
new_metadata.Set(metadataID, std::string(m_metadata.Get(metadataID)));

View File

@@ -137,7 +137,7 @@ void ChargeSocketsHelper::AggregateChargeSocketKey(std::string const & k, std::s
}
// normalize type
static std::unordered_map<std::string_view, std::string_view> const kTypeMap = {
static ankerl::unordered_dense::map<std::string_view, std::string_view> const kTypeMap = {
{"tesla_supercharger", "nacs"},
{"tesla_destination", "nacs"},
{"tesla_standard", "nacs"},
@@ -402,7 +402,7 @@ KeyValueDiffSet ChargeSocketsHelper::Diff(ChargeSocketDescriptors const & oldSoc
auto oldKeys = ChargeSocketsHelper(oldSockets).GetOSMKeyValues();
auto newKeys = GetOSMKeyValues();
std::unordered_map<std::string, std::string> oldMap, newMap;
ankerl::unordered_dense::map<std::string, std::string> oldMap, newMap;
for (auto && [k, v] : oldKeys)
oldMap.emplace(k, v);

View File

@@ -15,9 +15,10 @@
#include "base/control_flow.hpp"
#include <unordered_map>
#include <utility>
#include "3party/ankerl/unordered_dense.h"
namespace feature
{
using namespace std;
@@ -88,7 +89,7 @@ bool GetBestName(StrUtf8 const & src, vector<int8_t> const & priorityList, strin
vector<int8_t> GetSimilarLanguages(int8_t lang)
{
static unordered_map<int8_t, vector<int8_t>> const kSimilarLanguages = {
static ankerl::unordered_dense::map<int8_t, vector<int8_t>> const kSimilarLanguages = {
{GetIndex("be"), {GetIndex("ru")}},
{GetIndex("ja"), {GetIndex("ja_kana"), GetIndex("ja_rm")}},
{GetIndex("ko"), {GetIndex("ko_rm")}},

View File

@@ -141,11 +141,8 @@ bool TypeAlwaysExists(uint32_t type, GeomType geomType = GeomType::Undefined)
if (geomType != GeomType::Line)
{
static uint32_t const arrTypes[] = {
cl.GetTypeByPath({"internet_access"}),
cl.GetTypeByPath({"toilets"}),
cl.GetTypeByPath({"drinking_water"}),
cl.GetTypeByPath({"lateral"}),
cl.GetTypeByPath({"cardinal"}),
cl.GetTypeByPath({"internet_access"}), cl.GetTypeByPath({"toilets"}), cl.GetTypeByPath({"drinking_water"}),
cl.GetTypeByPath({"lateral"}), cl.GetTypeByPath({"cardinal"}),
};
if (base::IsExist(arrTypes, type))
return true;

View File

@@ -4,11 +4,11 @@
#include "indexer/feature_data.hpp"
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace ftypes
{
template <typename Container>
@@ -56,8 +56,8 @@ private:
};
template <typename Key, typename Value>
using HashMapMatcher = Matcher<std::unordered_map<Key, Value>>;
using HashMapMatcher = Matcher<ankerl::unordered_dense::map<Key, Value>>;
template <typename Key>
using HashSetMatcher = Matcher<std::unordered_set<Key>>;
using HashSetMatcher = Matcher<ankerl::unordered_dense::set<Key>>;
} // namespace ftypes

View File

@@ -8,7 +8,8 @@
#include "base/macros.hpp"
#include <initializer_list>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
namespace mwm_set_test
{
@@ -18,7 +19,7 @@ using platform::CountryFile;
using platform::LocalCountryFile;
using tests::TestMwmSet;
using MwmsInfo = unordered_map<string, shared_ptr<MwmInfo>>;
using MwmsInfo = ankerl::unordered_dense::map<string, shared_ptr<MwmInfo>>;
void GetMwmsInfo(MwmSet const & mwmSet, MwmsInfo & mwmsInfo)
{

View File

@@ -11,9 +11,10 @@
#include <memory>
#include <mutex>
#include <string>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace feature
{
class MetadataBase;
@@ -92,8 +93,8 @@ public:
void Freeze(Writer & writer) const;
private:
std::unordered_map<std::string, uint32_t> m_stringToId;
std::unordered_map<uint32_t, std::string> m_idToString;
ankerl::unordered_dense::map<std::string, uint32_t> m_stringToId;
ankerl::unordered_dense::map<uint32_t, std::string> m_idToString;
MapUint32ToValueBuilder<MetadataDeserializer::MetaIds> m_builder;
};
} // namespace indexer

View File

@@ -81,11 +81,11 @@ public:
MwmTypeT GetType() const;
feature::RegionData GetRegionData() const {
feature::RegionData GetRegionData() const
{
auto regionData = m_data;
if (GetType() == MwmTypeT::WORLD || GetType() == MwmTypeT::COASTS) {
regionData.SetLanguages({"int_name","en","default"});
}
if (GetType() == MwmTypeT::WORLD || GetType() == MwmTypeT::COASTS)
regionData.SetLanguages({"int_name", "en", "default"});
return regionData;
}

View File

@@ -30,7 +30,7 @@ char const * const g_patterns[] = {
"aannaa", "aannnaa", "aannnn", "an naa", "ana naa", "ana nan", "ananan", "ann aann",
"ann naa", "annnnaaa", "nn nnn", "nnn", "nnn nn", "nnn nnn", "nnn nnnn", "nnnn",
"nnnn aa", "nnnn nnn", "nnnnaa", "nnnnn", "nnnnn nnn", "nnnnn nnnn", "nnnnn nnnnn", "nnnnnn",
"nnnnnnn", "nnnnnnnn", "〒nnn nnnn", "annnn", "ana aaaa", "aannn", "ann"};
"nnnnnnn", "nnnnnnnn", "〒nnn nnnn", "annnn", "ana aaaa", "aannn", "ann"};
UniChar SimplifyChar(UniChar const & c)
{

View File

@@ -8,9 +8,10 @@
#include <algorithm>
#include <array>
#include <cctype>
#include <unordered_map>
#include <utility>
#include "3party/ankerl/unordered_dense.h"
/*
* TODO : why all this parsing happens in the run-time? The most of it should be moved to the generator.
* E.g. now the ref contains
@@ -43,7 +44,7 @@ std::array<std::string, 13> const kModifiers = {{"alt", "alternate", "bus", "bus
"connector", "loop", "scenic", "spur", "temporary", "toll", "truck"}};
// Shields based on a network tag in a route=road relation.
std::unordered_map<std::string, RoadShieldType> const kRoadNetworkShields = {
ankerl::unordered_dense::map<std::string, RoadShieldType> const kRoadNetworkShields = {
// International road networks.
{"e-road", RoadShieldType::Generic_Green}, // E 105
{"asianhighway", RoadShieldType::Hidden}, // AH8. Blue, but usually not posted.
@@ -127,7 +128,7 @@ public:
RoadShieldsSetT GetRoadShields() const
{
RoadShieldsSetT result, defaultShields;
uint8_t index = 0;
strings::Tokenize(m_baseRoadNumber, ";", [&](std::string_view rawText)
{
@@ -291,7 +292,12 @@ public:
struct Entry
{
Entry() = default;
Entry(std::string_view name, RoadShieldType type, bool isRedundant = false, bool shouldTrimName = false) : m_name(name), m_type(type), m_isRedundant(isRedundant), m_shouldTrimName(shouldTrimName) {}
Entry(std::string_view name, RoadShieldType type, bool isRedundant = false, bool shouldTrimName = false)
: m_name(name)
, m_type(type)
, m_isRedundant(isRedundant)
, m_shouldTrimName(shouldTrimName)
{}
std::string_view m_name;
RoadShieldType m_type = RoadShieldType::Default;
@@ -328,11 +334,10 @@ public:
strings::ReplaceFirst(name, std::string{p.m_name}, "");
strings::Trim(name);
}
if (index != 1 && p.m_isRedundant) {
if (index != 1 && p.m_isRedundant)
type = RoadShieldType::Hidden;
} else {
else
type = p.m_type;
}
idx = i;
}
}
@@ -352,7 +357,14 @@ public:
struct Entry
{
Entry() = default;
Entry(std::string_view name, HighwayClass highwayClass, RoadShieldType type, bool isRedundant = false, bool shouldTrimName = false) : m_name(name), m_type(type), m_highwayClass(highwayClass), m_isRedundant(isRedundant), m_shouldTrimName(shouldTrimName) {}
Entry(std::string_view name, HighwayClass highwayClass, RoadShieldType type, bool isRedundant = false,
bool shouldTrimName = false)
: m_name(name)
, m_type(type)
, m_highwayClass(highwayClass)
, m_isRedundant(isRedundant)
, m_shouldTrimName(shouldTrimName)
{}
std::string_view m_name;
RoadShieldType m_type = RoadShieldType::Default;
@@ -364,18 +376,19 @@ public:
using ShieldTypes = buffer_vector<Entry, 8>;
HighwayClassRoadShieldParser(std::string const & baseRoadNumber, HighwayClass highwayClass, ShieldTypes && types, RoadShieldType defaultType = RoadShieldType::Default)
: RoadShieldParser(baseRoadNumber)
, m_highwayClass(highwayClass)
, m_types(std::move(types))
, m_defaultType(defaultType)
HighwayClassRoadShieldParser(std::string const & baseRoadNumber, HighwayClass highwayClass, ShieldTypes && types,
RoadShieldType defaultType = RoadShieldType::Default)
: RoadShieldParser(baseRoadNumber)
, m_highwayClass(highwayClass)
, m_types(std::move(types))
, m_defaultType(defaultType)
{}
RoadShield ParseRoadShield(std::string_view rawText, uint8_t index) const override
{
if (rawText.size() > kMaxRoadShieldBytesSize)
return RoadShield();
if (index == 1)
{
for (auto const & p : m_types)
@@ -392,11 +405,12 @@ public:
}
}
}
SimpleRoadShieldParser::ShieldTypes simpleShieldTypes = {};
for (auto const & p : m_types)
{
simpleShieldTypes.push_back(SimpleRoadShieldParser::Entry(p.m_name, p.m_type, p.m_isRedundant, p.m_shouldTrimName));
simpleShieldTypes.push_back(
SimpleRoadShieldParser::Entry(p.m_name, p.m_type, p.m_isRedundant, p.m_shouldTrimName));
}
return SimpleRoadShieldParser(m_baseRoadNumber, std::move(simpleShieldTypes)).ParseRoadShield(rawText, index);
}
@@ -564,8 +578,8 @@ class TurkeyRoadShieldParser : public SimpleRoadShieldParser
{
public:
explicit TurkeyRoadShieldParser(std::string const & baseRoadNumber)
: SimpleRoadShieldParser(baseRoadNumber, {{"O", RoadShieldType::Highway_Hexagon_Turkey},
{"D", RoadShieldType::Generic_Blue}})
: SimpleRoadShieldParser(baseRoadNumber,
{{"O", RoadShieldType::Highway_Hexagon_Turkey}, {"D", RoadShieldType::Generic_Blue}})
{}
};
@@ -573,7 +587,7 @@ class HungaryRoadShieldParser : public SimpleRoadShieldParser
{
public:
explicit HungaryRoadShieldParser(std::string const & baseRoadNumber)
: SimpleRoadShieldParser(baseRoadNumber, {{"M", RoadShieldType::Hungary_Blue}}, RoadShieldType::Hungary_Green)
: SimpleRoadShieldParser(baseRoadNumber, {{"M", RoadShieldType::Hungary_Blue}}, RoadShieldType::Hungary_Green)
{}
};
@@ -794,14 +808,14 @@ class CyprusRoadShieldParser : public SimpleRoadShieldParser
{
public:
explicit CyprusRoadShieldParser(std::string const & baseRoadNumber)
: SimpleRoadShieldParser(baseRoadNumber, {// North Cyprus.
: SimpleRoadShieldParser(baseRoadNumber, { // North Cyprus.
{"D.", RoadShieldType::Generic_Blue}, // White font.
{"GM.", RoadShieldType::Generic_White_Bordered}, // Blue font.
{"GZ.", RoadShieldType::Generic_White_Bordered}, // Blue font.
{"GR.", RoadShieldType::Generic_White_Bordered}, // Blue font.
{"LF.", RoadShieldType::Generic_White_Bordered}, // Blue font.
{"İK.", RoadShieldType::Generic_White_Bordered}, // Blue font.
// South Cyprus.
// South Cyprus.
{"A", RoadShieldType::Generic_Green}, // Yellow font. Hexagon.
{"B", RoadShieldType::Generic_Blue}, // Yellow font.
{"E", RoadShieldType::Generic_Blue}, // Yellow font.
@@ -861,7 +875,7 @@ RoadShieldsSetT GetRoadShields(FeatureType & f)
auto const & highwayClass = ftypes::GetHighwayClass(feature::TypesHolder(f));
if (highwayClass == HighwayClass::Undefined)
return {};
// Find out country name.
std::string mwmName = f.GetID().GetMwmName();
ASSERT(!mwmName.empty(), (f.GetID()));
@@ -873,7 +887,8 @@ RoadShieldsSetT GetRoadShields(FeatureType & f)
return GetRoadShields(mwmName, ref, highwayClass);
}
RoadShieldsSetT GetRoadShields(std::string const & mwmName, std::string const & roadNumber, HighwayClass const & highwayClass)
RoadShieldsSetT GetRoadShields(std::string const & mwmName, std::string const & roadNumber,
HighwayClass const & highwayClass)
{
if (mwmName == "US")
return USRoadShieldParser(roadNumber).GetRoadShields();

View File

@@ -82,7 +82,8 @@ struct RoadShield
// Use specific country road shield styles based on mwm feature belongs to.
using RoadShieldsSetT = buffer_vector<RoadShield, 2>;
RoadShieldsSetT GetRoadShields(FeatureType & f);
RoadShieldsSetT GetRoadShields(std::string const & mwmName, std::string const & roadNumber, HighwayClass const & highwayClass);
RoadShieldsSetT GetRoadShields(std::string const & mwmName, std::string const & roadNumber,
HighwayClass const & highwayClass);
// Simple parsing without specific country styles.
RoadShieldsSetT GetRoadShields(std::string const & rawRoadNumber);

View File

@@ -2,9 +2,10 @@
#include "base/base.hpp"
#include <unordered_set>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
class CheckUniqueIndexes
{
public:

View File

@@ -7,9 +7,10 @@
#include <map>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace feature
{
class RegionData;
@@ -32,7 +33,7 @@ public:
}
};
using LocalizableString = std::unordered_map<int8_t, std::string>;
using LocalizableString = ankerl::unordered_dense::map<int8_t, std::string>;
using LocalizableStringSubIndex = std::map<int8_t, uint32_t>;
using LocalizableStringIndex = std::vector<LocalizableStringSubIndex>;
using Properties = std::map<std::string, std::string>;

View File

@@ -32,7 +32,8 @@
#include <chrono>
#include <limits>
#include <sstream>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
namespace
{
@@ -2671,8 +2672,8 @@ void BookmarkManager::CreateCategories(KMLDataCollection && dataCollection, bool
ResetIds(fileData);
}
std::unordered_map<kml::CompilationId, BookmarkCategory *> compilations;
std::unordered_set<std::string> compilationNames;
ankerl::unordered_dense::map<kml::CompilationId, BookmarkCategory *> compilations;
ankerl::unordered_dense::set<std::string> compilationNames;
for (auto & compilation : fileData.m_compilationsData)
{
SetUniqueName(compilation, [&compilationNames](auto const & name) { return compilationNames.count(name) == 0; });
@@ -3206,7 +3207,7 @@ void BookmarkManager::MarksChangesTracker::InferVisibility(BookmarkCategory * co
kml::CategoryData const & categoryData = group->GetCategoryData();
if (categoryData.m_compilationIds.empty())
return;
std::unordered_set<kml::MarkGroupId> visibility;
ankerl::unordered_dense::set<kml::MarkGroupId> visibility;
visibility.reserve(categoryData.m_compilationIds.size());
for (kml::MarkGroupId const compilationId : categoryData.m_compilationIds)
{

View File

@@ -3130,8 +3130,8 @@ void Framework::CreateNote(osm::MapObject const & mapObject, osm::Editor::NotePr
latLon = mapObject.GetLatLon();
}
osm::Editor::Instance().CreateNote(latLon, mapObject.GetID(), mapObject.GetTypes(),
mapObject.GetDefaultName(), type, note);
osm::Editor::Instance().CreateNote(latLon, mapObject.GetID(), mapObject.GetTypes(), mapObject.GetDefaultName(), type,
note);
if (type == osm::Editor::NoteProblemType::PlaceDoesNotExist)
DeactivateMapSelection();
}

View File

@@ -2,13 +2,13 @@
#include "base/assert.hpp"
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
using namespace power_management;
namespace
{
std::unordered_map<Scheme, FacilitiesState> const kSchemeToState = {
ankerl::unordered_dense::map<Scheme, FacilitiesState> const kSchemeToState = {
{Scheme::Normal,
{{
/* Buildings3d */ true,
@@ -47,7 +47,7 @@ std::unordered_map<Scheme, FacilitiesState> const kSchemeToState = {
}}},
};
std::unordered_map<AutoScheme, FacilitiesState> const kAutoSchemeToState = {
ankerl::unordered_dense::map<AutoScheme, FacilitiesState> const kAutoSchemeToState = {
{AutoScheme::Normal,
{{
/* Buildings3d */ true,

View File

@@ -349,16 +349,16 @@ void RoutePointsLayout::SetFollowingMode(bool enabled)
void RoutePointsLayout::RemovePassedPoints()
{
// Prevent recalculation of markIds at every iteration, since we are removing elements
auto markIds = m_manager.GetUserMarkIds(UserMark::Type::ROUTING);
for (auto markId : markIds) {
auto * mark = m_editSession.GetMarkForEdit<RouteMarkPoint>(markId);
if (mark && mark->IsPassed() && mark->GetRoutePointType() == RouteMarkType::Intermediate)
m_editSession.DeleteUserMark(mark->GetId());
}
// Prevent recalculation of markIds at every iteration, since we are removing elements
auto markIds = m_manager.GetUserMarkIds(UserMark::Type::ROUTING);
for (auto markId : markIds)
{
auto * mark = m_editSession.GetMarkForEdit<RouteMarkPoint>(markId);
if (mark && mark->IsPassed() && mark->GetRoutePointType() == RouteMarkType::Intermediate)
m_editSession.DeleteUserMark(mark->GetId());
}
}
RouteMarkPoint const * RoutePointsLayout::GetRoutePoint(RouteMarkType type, size_t intermediateIndex) const
{
for (auto markId : m_manager.GetUserMarkIds(UserMark::Type::ROUTING))

View File

@@ -98,6 +98,7 @@ public:
void PassRoutePoint(RouteMarkType type, size_t intermediateIndex = 0);
void SetFollowingMode(bool enabled);
void RemovePassedPoints();
private:
using TRoutePointCallback = std::function<void(RouteMarkPoint * mark)>;
void ForEachIntermediatePoint(TRoutePointCallback const & fn);

View File

@@ -21,6 +21,8 @@
#include <string>
#include <type_traits>
#include "3party/ankerl/unordered_dense.h"
using namespace search;
using namespace std;
@@ -323,7 +325,7 @@ void SearchAPI::EnableIndexingOfBookmarkGroup(kml::MarkGroupId const & groupId,
m_engine.EnableIndexingOfBookmarkGroup(KmlGroupIdToSearchGroupId(groupId), enable);
}
unordered_set<kml::MarkGroupId> const & SearchAPI::GetIndexableGroups() const
ankerl::unordered_dense::set<kml::MarkGroupId> const & SearchAPI::GetIndexableGroups() const
{
return m_indexableGroups;
}

View File

@@ -20,9 +20,10 @@
#include <memory>
#include <optional>
#include <string>
#include <unordered_set>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
class DataSource;
namespace search
@@ -121,7 +122,7 @@ public:
// This method must be used to enable or disable indexing all current and future
// bookmarks belonging to |groupId|.
void EnableIndexingOfBookmarkGroup(kml::MarkGroupId const & groupId, bool enable);
std::unordered_set<kml::MarkGroupId> const & GetIndexableGroups() const;
ankerl::unordered_dense::set<kml::MarkGroupId> const & GetIndexableGroups() const;
// Returns the bookmarks search to its default, pre-launch state.
// This includes dropping all bookmark data for created bookmarks (efficiently
@@ -175,5 +176,5 @@ private:
// Same as the one in bookmarks::Processor. Duplicated here because
// it is easier than obtaining the information about a group asynchronously
// from |m_engine|.
std::unordered_set<kml::MarkGroupId> m_indexableGroups;
ankerl::unordered_dense::set<kml::MarkGroupId> m_indexableGroups;
};

View File

@@ -2,9 +2,10 @@
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace platform
{
// class GetTextById is ready to work with different sources of text strings.
@@ -40,7 +41,7 @@ private:
bool IsValid() const { return !m_localeTexts.empty(); }
std::string m_locale;
std::unordered_map<std::string, std::string> m_localeTexts;
ankerl::unordered_dense::map<std::string, std::string> m_localeTexts;
};
/// Factories to create GetTextById instances.

View File

@@ -27,9 +27,10 @@ SOFTWARE.
#include <functional>
#include <string>
#include <unordered_map>
#include <utility>
#include "3party/ankerl/unordered_dense.h"
namespace platform
{
class HttpClient
@@ -43,7 +44,7 @@ public:
std::string m_value;
};
using Headers = std::unordered_map<std::string, std::string>;
using Headers = ankerl::unordered_dense::map<std::string, std::string>;
HttpClient() = default;
explicit HttpClient(std::string const & url);

View File

@@ -18,7 +18,8 @@
#include <cctype>
#include <memory>
#include <sstream>
#include <unordered_set>
#include "3party/ankerl/unordered_dense.h"
#include <boost/regex.hpp>

View File

@@ -13,10 +13,7 @@ void EnumerateFiles(std::string const & directory, std::function<void(char const
void EnumerateFilesByRegExp(std::string const & directory, boost::regex const & regexp, std::vector<std::string> & res);
inline void EnumerateFiles(std::string const & directory, std::vector<std::string> & res)
{
EnumerateFiles(directory, [&](char const * entry)
{
res.push_back(std::string(entry));
});
{
EnumerateFiles(directory, [&](char const * entry) { res.push_back(std::string(entry)); });
}
} // namespace pl

View File

@@ -20,9 +20,10 @@
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace routing
{
@@ -46,8 +47,8 @@ struct CrossBorderSegment
double m_weight = 0.0;
};
using CrossBorderSegments = std::unordered_map<RegionSegmentId, CrossBorderSegment>;
using MwmIdToSegmentIds = std::unordered_map<NumMwmId, std::vector<RegionSegmentId>>;
using CrossBorderSegments = ankerl::unordered_dense::map<RegionSegmentId, CrossBorderSegment>;
using MwmIdToSegmentIds = ankerl::unordered_dense::map<NumMwmId, std::vector<RegionSegmentId>>;
struct CrossBorderGraph
{

View File

@@ -12,9 +12,10 @@
#include "base/buffer_vector.hpp"
#include <string>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace routing
{
namespace connector
@@ -280,7 +281,7 @@ private:
};
std::vector<KeyTransitionT> m_transitions;
using MwmID2FeatureIDMapT = std::unordered_map<CrossMwmId, uint32_t, connector::HashKey>;
using MwmID2FeatureIDMapT = ankerl::unordered_dense::map<CrossMwmId, uint32_t, connector::HashKey>;
MwmID2FeatureIDMapT m_crossMwmIdToFeatureId;
// Weight is the time required for the route to pass edge, measured in seconds rounded upwards.

View File

@@ -8,7 +8,8 @@
#include "base/lru_cache.hpp"
#include <map>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
namespace routing
{
@@ -19,7 +20,7 @@ class MwmDataSource
{
DataSource & m_dataSource;
std::shared_ptr<NumMwmIds> m_numMwmIDs;
std::unordered_map<NumMwmId, MwmSet::MwmHandle> m_handles;
ankerl::unordered_dense::map<NumMwmId, MwmSet::MwmHandle> m_handles;
// Used for FeaturesRoadGraph in openlr only.
std::map<MwmSet::MwmId, MwmSet::MwmHandle> m_handles2;

View File

@@ -10,7 +10,8 @@
#include "geometry/point_with_altitude.hpp"
#include <memory>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
class DataSource;
@@ -64,7 +65,7 @@ public:
protected:
VehicleType const m_vehicleType;
double m_defaultPenalty = 0.0;
std::unordered_map<int, double> m_turnPenaltyMap;
ankerl::unordered_dense::map<int, double> m_turnPenaltyMap;
private:
double const m_maxWeightSpeedMpS;
@@ -72,7 +73,7 @@ private:
// DataSource * m_dataSourcePtr;
// std::shared_ptr<NumMwmIds> m_numMwmIds;
// std::unordered_map<NumMwmId, double> m_leapWeightSpeedMpS;
// ankerl::unordered_dense::map<NumMwmId, double> m_leapWeightSpeedMpS;
double ComputeDefaultLeapWeightSpeed() const;
double GetLeapWeightSpeed(NumMwmId mwmId);

View File

@@ -22,9 +22,10 @@
#include <memory>
#include <optional>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace routing
{
bool IsUTurn(Segment const & u, Segment const & v);
@@ -42,7 +43,7 @@ public:
template <typename VertexType>
using Parents = typename AStarGraph<VertexType, void, void>::Parents;
using Restrictions = std::unordered_map<uint32_t, std::vector<std::vector<uint32_t>>>;
using Restrictions = ankerl::unordered_dense::map<uint32_t, std::vector<std::vector<uint32_t>>>;
using SegmentEdgeListT = SmallList<SegmentEdge>;
using JointEdgeListT = SmallList<JointEdge>;
@@ -203,7 +204,7 @@ private:
//
// If m_noUTurnRestrictions.count(featureId) == 0, that means, that there are no any
// no_u_turn restriction at the feature with id = featureId.
std::unordered_map<uint32_t, UTurnEnding> m_noUTurnRestrictions;
ankerl::unordered_dense::map<uint32_t, UTurnEnding> m_noUTurnRestrictions;
RoadAccess m_roadAccess;
RoadPenalty m_roadPenalty;
RoutingOptions m_avoidRoutingOptions;

View File

@@ -17,7 +17,8 @@
#include <algorithm>
#include <map>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
namespace routing
{
@@ -67,9 +68,9 @@ private:
// May be nullptr, because it has "lazy" loading.
GraphPtrT m_graph;
};
unordered_map<NumMwmId, GraphAttrs> m_graphs;
ankerl::unordered_dense::map<NumMwmId, GraphAttrs> m_graphs;
unordered_map<NumMwmId, SpeedCamerasMapT> m_cachedCameras;
ankerl::unordered_dense::map<NumMwmId, SpeedCamerasMapT> m_cachedCameras;
SpeedCamerasMapT const & ReceiveSpeedCamsFromMwm(NumMwmId numMwmId);
RoutingOptions m_avoidRoutingOptions;
@@ -186,7 +187,8 @@ bool ReadSpeedCamsFromMwm(MwmValue const & mwmValue, SpeedCamerasMapT & camerasM
}
catch (Reader::Exception const & e)
{
LOG(LERROR, ("Error while reading", CAMERAS_INFO_FILE_TAG, "section in", mwmValue.GetCountryFileName(), ":", e.Msg()));
LOG(LERROR,
("Error while reading", CAMERAS_INFO_FILE_TAG, "section in", mwmValue.GetCountryFileName(), ":", e.Msg()));
}
return false;
}
@@ -206,7 +208,8 @@ bool ReadRoadAccessFromMwm(MwmValue const & mwmValue, VehicleType vehicleType, R
}
catch (Reader::Exception const & e)
{
LOG(LERROR, ("Error while reading", ROAD_ACCESS_FILE_TAG, "section in", mwmValue.GetCountryFileName(), ":", e.Msg()));
LOG(LERROR,
("Error while reading", ROAD_ACCESS_FILE_TAG, "section in", mwmValue.GetCountryFileName(), ":", e.Msg()));
}
return false;
}
@@ -236,11 +239,13 @@ bool ReadRoadPenaltyFromMwm(MwmValue const & mwmValue, VehicleType vehicleType,
catch (Reader::OpenException const &)
{
// This is expected for older mwm files - not an error
LOG(LINFO, (ROAD_PENALTY_FILE_TAG, "section not found in", mwmValue.GetCountryFileName(), "- using legacy penalty system"));
LOG(LINFO, (ROAD_PENALTY_FILE_TAG, "section not found in", mwmValue.GetCountryFileName(),
"- using legacy penalty system"));
}
catch (Reader::Exception const & e)
{
LOG(LERROR, ("Error while reading", ROAD_PENALTY_FILE_TAG, "section in", mwmValue.GetCountryFileName(), ":", e.Msg()));
LOG(LERROR,
("Error while reading", ROAD_PENALTY_FILE_TAG, "section in", mwmValue.GetCountryFileName(), ":", e.Msg()));
}
return false;
}

View File

@@ -8,9 +8,9 @@ uint32_t constexpr IndexGraphSerializer::JointsFilter::kEmptyEntry;
uint32_t constexpr IndexGraphSerializer::JointsFilter::kPushedEntry;
// IndexGraphSerializer::SectionSerializer ---------------------------------------------------------
void IndexGraphSerializer::SectionSerializer::PreSerialize(IndexGraph const & graph,
std::unordered_map<uint32_t, VehicleMask> const & masks,
JointIdEncoder & jointEncoder)
void IndexGraphSerializer::SectionSerializer::PreSerialize(
IndexGraph const & graph, ankerl::unordered_dense::map<uint32_t, VehicleMask> const & masks,
JointIdEncoder & jointEncoder)
{
m_buffer.clear();
MemWriter<std::vector<uint8_t>> memWriter(m_buffer);
@@ -65,7 +65,7 @@ void IndexGraphSerializer::JointsFilter::Push(Joint::Id jointIdInFile, RoadPoint
// IndexGraphSerializer ----------------------------------------------------------------------------
// static
VehicleMask IndexGraphSerializer::GetRoadMask(std::unordered_map<uint32_t, VehicleMask> const & masks,
VehicleMask IndexGraphSerializer::GetRoadMask(ankerl::unordered_dense::map<uint32_t, VehicleMask> const & masks,
uint32_t featureId)
{
auto const & it = masks.find(featureId);
@@ -90,7 +90,7 @@ uint32_t IndexGraphSerializer::ConvertJointsNumber(uint32_t jointsNumber)
// static
void IndexGraphSerializer::PrepareSectionSerializers(IndexGraph const & graph,
std::unordered_map<uint32_t, VehicleMask> const & masks,
ankerl::unordered_dense::map<uint32_t, VehicleMask> const & masks,
std::vector<SectionSerializer> & serializers)
{
size_t maskToIndex[kNumVehicleMasks] = {};

View File

@@ -14,9 +14,10 @@
#include <limits>
#include <type_traits>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace routing
{
class IndexGraphSerializer final
@@ -25,7 +26,8 @@ public:
IndexGraphSerializer() = delete;
template <class Sink>
static void Serialize(IndexGraph const & graph, std::unordered_map<uint32_t, VehicleMask> const & masks, Sink & sink)
static void Serialize(IndexGraph const & graph, ankerl::unordered_dense::map<uint32_t, VehicleMask> const & masks,
Sink & sink)
{
Header header(graph);
JointIdEncoder jointEncoder;
@@ -278,7 +280,7 @@ private:
private:
Joint::Id m_count = 0;
std::unordered_map<Joint::Id, Joint::Id> m_convertedIds;
ankerl::unordered_dense::map<Joint::Id, Joint::Id> m_convertedIds;
};
class JointIdDecoder final
@@ -364,7 +366,7 @@ private:
void AddRoad(uint32_t featureId) { m_featureIds.push_back(featureId); }
void SortRoads() { sort(m_featureIds.begin(), m_featureIds.end()); }
void PreSerialize(IndexGraph const & graph, std::unordered_map<uint32_t, VehicleMask> const & masks,
void PreSerialize(IndexGraph const & graph, ankerl::unordered_dense::map<uint32_t, VehicleMask> const & masks,
JointIdEncoder & jointEncoder);
template <class Sink>
@@ -380,10 +382,10 @@ private:
std::vector<uint8_t> m_buffer;
};
static VehicleMask GetRoadMask(std::unordered_map<uint32_t, VehicleMask> const & masks, uint32_t featureId);
static VehicleMask GetRoadMask(ankerl::unordered_dense::map<uint32_t, VehicleMask> const & masks, uint32_t featureId);
static uint32_t ConvertJointsNumber(uint32_t jointsNumber);
static void PrepareSectionSerializers(IndexGraph const & graph,
std::unordered_map<uint32_t, VehicleMask> const & masks,
ankerl::unordered_dense::map<uint32_t, VehicleMask> const & masks,
std::vector<SectionSerializer> & sections);
};
} // namespace routing

View File

@@ -10,14 +10,14 @@
#include "base/assert.hpp"
#include "3party/skarupke/bytell_hash_map.hpp" // needed despite of IDE warning
#include <algorithm>
#include <map>
#include <optional>
#include <queue>
#include <vector>
#include "3party/skarupke/bytell_hash_map.hpp" // needed despite of IDE warning
namespace routing
{
enum class WorldGraphMode;

View File

@@ -10,9 +10,9 @@
#include "coding/simple_dense_coding.hpp"
#include <memory>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
#include "3party/succinct/elias_fano.hpp"
namespace routing
@@ -50,7 +50,7 @@ private:
static int constexpr DEFAULT_SPEEDS_COUNT = 2;
// Default speeds (KmPerH) for MWM, 0 - outside a city, 1 - inside a city.
std::unordered_map<HighwayType, MaxspeedType> m_defaultSpeeds[DEFAULT_SPEEDS_COUNT];
ankerl::unordered_dense::map<HighwayType, MaxspeedType> m_defaultSpeeds[DEFAULT_SPEEDS_COUNT];
};
std::unique_ptr<Maxspeeds> LoadMaxspeeds(MwmSet::MwmHandle const & handle);

View File

@@ -1,6 +1,6 @@
#include "routing/mwm_hierarchy_handler.hpp"
#include <unordered_set>
#include "3party/ankerl/unordered_dense.h"
namespace routing
{
@@ -11,7 +11,7 @@ namespace
// passport and other types of border control at their mutual borders.
inline size_t constexpr kCrossCountryPenaltyS = 60 * 60 * 2;
using CountrySetT = std::unordered_set<std::string_view>;
using CountrySetT = ankerl::unordered_dense::set<std::string_view>;
// The Eurasian Economic Union (EAEU) list of countries.
CountrySetT kEAEU = {"Armenia", "Belarus", "Kazakhstan", "Kyrgyzstan", "Russian Federation"};

View File

@@ -7,7 +7,8 @@
#include <memory>
#include <string>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
namespace routing
{
@@ -33,7 +34,7 @@ private:
std::shared_ptr<NumMwmIds> m_numMwmIds;
CountryParentNameGetterFn m_countryParentNameGetterFn;
using MwmToCountry = std::unordered_map<NumMwmId, std::string>;
using MwmToCountry = ankerl::unordered_dense::map<NumMwmId, std::string>;
MwmToCountry m_mwmCountriesCache;
};
} // namespace routing

View File

@@ -134,7 +134,7 @@ void RegionsRouter::Do()
}
}
std::unordered_set<std::string> const & RegionsRouter::GetMwmNames() const
ankerl::unordered_dense::set<std::string> const & RegionsRouter::GetMwmNames() const
{
return m_mwmNames;
}

View File

@@ -7,10 +7,11 @@
#include "base/thread.hpp"
#include <unordered_set>
#include <utility>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace routing
{
class IndexGraphStarter;
@@ -25,7 +26,7 @@ public:
void Do() override;
std::unordered_set<std::string> const & GetMwmNames() const;
ankerl::unordered_dense::set<std::string> const & GetMwmNames() const;
private:
template <typename Vertex, typename Edge, typename Weight>
@@ -42,7 +43,7 @@ private:
std::shared_ptr<NumMwmIds> m_numMwmIds;
DataSource & m_dataSource;
Checkpoints const m_checkpoints;
std::unordered_set<std::string> m_mwmNames;
ankerl::unordered_dense::set<std::string> m_mwmNames;
RouterDelegate const & m_delegate;
};

Some files were not shown because too many files have changed in this diff Show More