diff options
author | tatiana-yan <tatiana.kondakova@gmail.com> | 2019-04-10 15:34:13 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2019-04-10 15:47:01 +0300 |
commit | 688b8d68263a1716afee87a4b0d31a441e209575 (patch) | |
tree | 4b07b74d6826e325b0a10488575ea94cf2195cfb /search | |
parent | 7b010981a5d1ddb4d809d046e092fe390abf3773 (diff) |
[search] Remove unused RankTableCache
Diffstat (limited to 'search')
-rw-r--r-- | search/CMakeLists.txt | 2 | ||||
-rw-r--r-- | search/processor.hpp | 1 | ||||
-rw-r--r-- | search/rank_table_cache.cpp | 27 | ||||
-rw-r--r-- | search/rank_table_cache.hpp | 48 |
4 files changed, 0 insertions, 78 deletions
diff --git a/search/CMakeLists.txt b/search/CMakeLists.txt index d0706d8eb9..3652d625df 100644 --- a/search/CMakeLists.txt +++ b/search/CMakeLists.txt @@ -126,8 +126,6 @@ set( query_params.hpp query_saver.cpp query_saver.hpp - rank_table_cache.cpp - rank_table_cache.hpp ranker.cpp ranker.hpp ranking_info.cpp diff --git a/search/processor.hpp b/search/processor.hpp index 677fa5ab73..c9bc2695f3 100644 --- a/search/processor.hpp +++ b/search/processor.hpp @@ -9,7 +9,6 @@ #include "search/emitter.hpp" #include "search/geocoder.hpp" #include "search/pre_ranker.hpp" -#include "search/rank_table_cache.hpp" #include "search/ranker.hpp" #include "search/search_params.hpp" #include "search/search_trie.hpp" diff --git a/search/rank_table_cache.cpp b/search/rank_table_cache.cpp deleted file mode 100644 index b9df112fa2..0000000000 --- a/search/rank_table_cache.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "search/rank_table_cache.hpp" - -#include "search/dummy_rank_table.hpp" - -#include "indexer/data_source.hpp" -#include "indexer/rank_table.hpp" - -namespace search -{ -RankTable const & RankTableCache::Get(DataSource & dataSource, Id const & mwmId) -{ - auto const it = m_ranks.find(Key(mwmId)); - if (it != m_ranks.end()) - return *it->second; - - Key handle(dataSource.GetMwmHandleById(mwmId)); - auto table = RankTable::Load(handle.GetValue<MwmValue>()->m_cont, SEARCH_RANKS_FILE_TAG); - if (!table) - table.reset(new DummyRankTable()); - - return *(m_ranks.emplace(std::move(handle), std::move(table)).first->second.get()); -} - -void RankTableCache::Remove(Id const & id) { m_ranks.erase(Key(id)); } - -void RankTableCache::Clear() { m_ranks.clear(); } -} // namespace search diff --git a/search/rank_table_cache.hpp b/search/rank_table_cache.hpp deleted file mode 100644 index 6eaf8ddcb8..0000000000 --- a/search/rank_table_cache.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -#include "indexer/mwm_set.hpp" - -#include "base/macros.hpp" - -#include <map> -#include <memory> -#include <utility> - -class DataSource; - -namespace search -{ -class RankTable; - -class RankTableCache -{ - using Id = MwmSet::MwmId; - - struct Key : public MwmSet::MwmHandle - { - Key() = default; - Key(Key &&) = default; - - explicit Key(Id const & id) { this->m_mwmId = id; } - explicit Key(MwmSet::MwmHandle && handle) : MwmSet::MwmHandle(std::move(handle)) {} - }; - -public: - RankTableCache() = default; - - RankTable const & Get(DataSource & dataSource, Id const & mwmId); - - void Remove(Id const & id); - void Clear(); - -private: - struct Compare - { - bool operator()(Key const & r1, Key const & r2) const { return (r1.GetId() < r2.GetId()); } - }; - - std::map<Key, std::unique_ptr<RankTable>, Compare> m_ranks; - - DISALLOW_COPY_AND_MOVE(RankTableCache); -}; -} // namespace search |