blob: 65cc0c3da381b2e81ecdf90988f96c24104616e6 (
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
|
#pragma once
#include "routing/routing_callbacks.hpp"
#include "geometry/point2d.hpp"
#include "base/cancellable.hpp"
#include "base/timer.hpp"
#include <mutex>
namespace routing
{
class TimeoutCancellable : public base::Cancellable
{
public:
TimeoutCancellable();
/// Sets timeout before cancellation. 0 means an infinite timeout.
void SetTimeout(uint32_t timeoutSec);
// Cancellable overrides:
bool IsCancelled() const override;
void Reset() override;
private:
base::Timer m_timer;
uint32_t m_timeoutSec;
};
class RouterDelegate : public TimeoutCancellable
{
public:
RouterDelegate();
/// Set routing progress. Waits current progress status from 0 to 100.
void OnProgress(float progress) const;
void OnPointCheck(m2::PointD const & point) const;
void SetProgressCallback(ProgressCallback const & progressCallback);
void SetPointCheckCallback(PointCheckCallback const & pointCallback);
void Reset() override;
private:
mutable std::mutex m_guard;
ProgressCallback m_progressCallback;
PointCheckCallback m_pointCallback;
};
} // namespace routing
|