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

feature_loader.hpp « search - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a24daa64bad38e6908c678d4d6db1782afbc5867 (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
33
34
35
36
37
38
39
#pragma once

#include "indexer/data_source.hpp"
#include "indexer/scales.hpp"

#include "base/assert.hpp"
#include "base/macros.hpp"
#include "base/thread_checker.hpp"

#include <memory>
#include <utility>

class FeatureType;
struct FeatureID;

namespace search
{
class FeatureLoader
{
public:
  explicit FeatureLoader(DataSource const & dataSource);

  std::unique_ptr<FeatureType> Load(FeatureID const & id);

  void Reset();

  void ForEachInRect(m2::RectD const & rect, std::function<void(FeatureType &)> const & fn)
  {
    ASSERT(m_checker.CalledOnOriginalThread(), ());
    m_dataSource.ForEachInRect(fn, rect, scales::GetUpperScale());
  }

private:
  DataSource const & m_dataSource;
  std::unique_ptr<FeaturesLoaderGuard> m_guard;

  ThreadChecker m_checker;
};
}  // namespace search