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: 6ddfd8ce71e0875c60984302b46256008875372e (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/checkpoints.hpp"
#include "routing/router.hpp"

#include "geometry/point2d.hpp"

#include "base/thread.hpp"

#include <functional>
#include <memory>
#include <string>
#include <vector>

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

class IOnlineFetcher
{
public:
  virtual ~IOnlineFetcher() = default;
  virtual void GenerateRequest(Checkpoints const &) = 0;
  virtual void GetAbsentCountries(std::vector<std::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 &, TCountryLocalFileFn const &);

  // IOnlineFetcher overrides:
  void GenerateRequest(Checkpoints const &) override;
  void GetAbsentCountries(std::vector<std::string> & countries) override;

private:
  bool AllPointsInSameMwm(Checkpoints const &) const;

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