blob: f2373c816e50eac67d63fdf537abc3b57e3148ea (
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 "geometry/point2d.hpp"
#include "base/cancellable.hpp"
#include "base/timer.hpp"
#include "std/function.hpp"
namespace routing
{
class TimeoutCancellable : public my::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:
my::Timer m_timer;
uint32_t m_timeoutSec;
};
class RouterDelegate : public TimeoutCancellable
{
public:
using TProgressCallback = function<void(float)>;
using TPointCheckCallback = function<void(m2::PointD const &)>;
RouterDelegate();
/// Set routing progress. Waits current progress status from 0 to 100.
void OnProgress(float progress) const { m_progressCallback(progress); }
void OnPointCheck(m2::PointD const & point) const { m_pointCallback(point); }
void SetProgressCallback(TProgressCallback const & progressCallback);
void SetPointCheckCallback(TPointCheckCallback const & pointCallback);
private:
TProgressCallback m_progressCallback;
TPointCheckCallback m_pointCallback;
};
} // nomespace routing
|