Welcome to mirror list, hosted at ThFree Co, Russian Federation.

caching_rank_table_loader.hpp « indexer - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2e80429ae7f8f3fdb35c1efdf4b606096cf7df7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once

#include "indexer/feature_decl.hpp"
#include "indexer/mwm_set.hpp"
#include "indexer/rank_table.hpp"

#include "base/macros.hpp"

#include <cstdint>
#include <map>
#include <memory>
#include <string>

class DataSource;
struct FeatureID;

// *NOTE* This class IS NOT thread-safe.
class CachingRankTableLoader
{
public:
  CachingRankTableLoader(DataSource const & dataSource, std::string const & sectionName);

  uint8_t Get(FeatureID const & featureId) const;
  void OnMwmDeregistered(platform::LocalCountryFile const & localFile);

private:
  DataSource const & m_dataSource;
  std::string const m_sectionName;
  mutable std::map<MwmSet::MwmId, std::unique_ptr<search::RankTable const> const> m_deserializers;

  DISALLOW_COPY(CachingRankTableLoader);
};