diff --git a/routing/async_router.cpp b/routing/async_router.cpp index 8bb4072bae..4e1165f1e9 100644 --- a/routing/async_router.cpp +++ b/routing/async_router.cpp @@ -40,7 +40,7 @@ map PrepareStatisticsData(string const & routerName, // ---------------------------------------------------------------------------------------------------------------------------- -AsyncRouter::RouterDelegateProxy::RouterDelegateProxy(TReadyCallback const & onReady, +AsyncRouter::RouterDelegateProxy::RouterDelegateProxy(ReadyCallbackOwnership const & onReady, PointCheckCallback const & onPointCheck, ProgressCallback const & onProgress, uint32_t timeoutSec) @@ -130,7 +130,7 @@ void AsyncRouter::SetRouter(unique_ptr && router, unique_ptr; - - /// Callback on routing statistics -// using TRoutingStatisticsCallback = function const &)>; - /// AsyncRouter is a wrapper class to run routing routines in the different thread AsyncRouter(RoutingStatisticsCallback const & routingStatisticsCallback, PointCheckCallback const & pointCheckCallback); @@ -49,7 +43,7 @@ public: /// @param progressCallback function to update the router progress /// @param timeoutSec timeout to cancel routing. 0 is infinity. void CalculateRoute(Checkpoints const & checkpoints, m2::PointD const & direction, - bool adjustToPrevRoute, TReadyCallback const & readyCallback, + bool adjustToPrevRoute, ReadyCallbackOwnership const & readyCallback, ProgressCallback const & progressCallback, uint32_t timeoutSec); @@ -81,7 +75,7 @@ private: class RouterDelegateProxy { public: - RouterDelegateProxy(TReadyCallback const & onReady, + RouterDelegateProxy(ReadyCallbackOwnership const & onReady, PointCheckCallback const & onPointCheck, ProgressCallback const & onProgress, uint32_t timeoutSec); @@ -96,7 +90,7 @@ private: void OnPointCheck(m2::PointD const & pt); mutex m_guard; - TReadyCallback const m_onReady; + ReadyCallbackOwnership const m_onReady; PointCheckCallback const m_onPointCheck; ProgressCallback const m_onProgress; RouterDelegate m_delegate; diff --git a/routing/routing_callbacks.hpp b/routing/routing_callbacks.hpp index 29325f16a6..78cf0bccde 100644 --- a/routing/routing_callbacks.hpp +++ b/routing/routing_callbacks.hpp @@ -39,7 +39,12 @@ enum class RouterResultCode using CheckpointCallback = std::function; using ProgressCallback = std::function; +// @TODO(bykoianko) ReadyCallback and ReadyCallbackOwnership callbacks should be gathered +// to one with the following signature: +// std::function, RouterResultCode)> +// That means calling ReadyCallback means passing ownership of ready instance of Route. using ReadyCallback = std::function; +using ReadyCallbackOwnership = std::function; using RouteCallback = std::function; using RoutingStatisticsCallback = std::function const &)>; using PointCheckCallback = std::function;