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

engine.hpp « search - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2f0b1543ec0d65b16b2ddac4b370e0a344a48416 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
#include "../indexer/index.hpp"

#include "../geometry/rect2d.hpp"

#include "../base/base.hpp"
#include "../base/mutex.hpp"
#include "../base/runner.hpp"

#include "../std/function.hpp"
#include "../std/scoped_ptr.hpp"
#include "../std/string.hpp"


class Reader;
class ModelReaderPtr;
class FeatureType;

namespace search
{

namespace impl { class Query; }
class CategoriesHolder;
class Result;

class Engine
{
public:
  typedef Index<ModelReaderPtr>::Type IndexType;

  /// Doesn't take ownership of @pIndex. Modifies @categories.
  Engine(IndexType const * pIndex, CategoriesHolder & categories);
  ~Engine();

  void Search(string const & query,
              m2::RectD const & rect,
              function<void (Result const &)> const & f);

  void StopEverything();

  void OnQueryDelete(impl::Query *);

private:
  IndexType const * m_pIndex;
  scoped_ptr<CategoriesHolder> m_pCategories;
  scoped_ptr<threads::IRunner> m_pRunner;
  threads::Mutex m_mutex;
  impl::Query * volatile m_pLastQuery;
  int volatile m_queriesActive;
};

}  // namespace search