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

online_absent_fetcher.hpp « routing - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: dc8791e7d9467fe3a2ffc37ee449f34b06818a6a (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
#pragma once

#include "routing_mapping.hpp"

#include "geometry/point2d.hpp"

#include "base/thread.hpp"

#include "std/string.hpp"
#include "std/unique_ptr.hpp"


namespace routing
{
using TCountryLocalFileFn = function<bool(string const &)>;

class IOnlineFetcher
{
public:
  virtual ~IOnlineFetcher() = default;
  virtual void GenerateRequest(m2::PointD const & startPoint, m2::PointD const & finalPoint) = 0;
  virtual void GetAbsentCountries(vector<string> & countries) = 0;
};

/*!
 * \brief The OnlineAbsentCountriesFetcher class incapsulates async fetching the map
 * names from online OSRM server routines.
 */
class OnlineAbsentCountriesFetcher : public IOnlineFetcher
{
public:
  OnlineAbsentCountriesFetcher(TCountryFileFn const & countryFileFn,
                               TCountryLocalFileFn const & countryLocalFileFn)
    : m_countryFileFn(countryFileFn), m_countryLocalFileFn(countryLocalFileFn)
  {
  }

  // IOnlineFetcher overrides:
  void GenerateRequest(m2::PointD const & startPoint, m2::PointD const & finalPoint) override;
  void GetAbsentCountries(vector<string> & countries) override;

private:
  TCountryFileFn const m_countryFileFn;
  TCountryLocalFileFn const m_countryLocalFileFn;
  unique_ptr<threads::Thread> m_fetcherThread;
};
}  // namespace routing