diff --git a/integration_tests/osrm_test_tools.cpp b/integration_tests/osrm_test_tools.cpp index 30deb2eb21..bf8053f3f9 100644 --- a/integration_tests/osrm_test_tools.cpp +++ b/integration_tests/osrm_test_tools.cpp @@ -280,7 +280,7 @@ namespace integration //Always returns empty LocalFile return shared_ptr(new LocalCountryFile()); }; - routing::OnlineAbsentFetcher fetcher(countryFileGetter, localFileGetter); + routing::OnlineAbsentCountriesFetcher fetcher(countryFileGetter, localFileGetter); fetcher.GenerateRequest(MercatorBounds::FromLatLon(startPoint.y, startPoint.x), MercatorBounds::FromLatLon(finalPoint.y, finalPoint.x)); vector absent; diff --git a/map/framework.cpp b/map/framework.cpp index b4720f9e30..b47c471335 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -2159,7 +2159,7 @@ void Framework::SetRouter(RouterType type) }; unique_ptr router; - unique_ptr fetcher; + unique_ptr fetcher; if (type == RouterType::Pedestrian) { router = CreatePedestrianAStarBidirectionalRouter(m_model.GetIndex(), countryFileGetter, @@ -2169,7 +2169,7 @@ void Framework::SetRouter(RouterType type) { router.reset(new OsrmRouter(&m_model.GetIndex(), countryFileGetter, localFileGetter, routingVisualizerFn)); - fetcher.reset(new OnlineAbsentFetcher(countryFileGetter, localFileGetter)); + fetcher.reset(new OnlineAbsentCountriesFetcher(countryFileGetter, localFileGetter)); } m_routingSession.SetRouter(move(router), move(fetcher), routingStatisticsFn); diff --git a/map/routing_session.cpp b/map/routing_session.cpp index fbf7571949..f4b7e96ea6 100644 --- a/map/routing_session.cpp +++ b/map/routing_session.cpp @@ -192,7 +192,7 @@ void RoutingSession::AssignRoute(Route & route) } void RoutingSession::SetRouter(unique_ptr && router, - unique_ptr && fetcher, + unique_ptr && fetcher, TRoutingStatisticsCallback const & routingStatisticsFn) { m_router.reset(new AsyncRouter(move(router), move(fetcher), routingStatisticsFn)); diff --git a/map/routing_session.hpp b/map/routing_session.hpp index b4b605fdb3..8db4aca21c 100644 --- a/map/routing_session.hpp +++ b/map/routing_session.hpp @@ -52,7 +52,7 @@ public: RoutingSession(); - void SetRouter(unique_ptr && router, unique_ptr && fetcher, + void SetRouter(unique_ptr && router, unique_ptr && fetcher, TRoutingStatisticsCallback const & routingStatisticsFn); /// @param[in] startPoint and endPoint in mercator diff --git a/routing/async_router.cpp b/routing/async_router.cpp index 32fa9ae4da..2be8740b80 100644 --- a/routing/async_router.cpp +++ b/routing/async_router.cpp @@ -30,13 +30,6 @@ string ToString(IRouter::ResultCode code) case IRouter::RouteNotFound: return "RouteNotFound"; case IRouter::InternalError: return "InternalError"; case IRouter::NeedMoreMaps: return "NeedMoreMaps"; - default: - { - ASSERT(false, ("Unknown IRouter::ResultCode value ", code)); - ostringstream o; - o << "UnknownResultCode(" << static_cast(code) << ")"; - return o.str(); - } } } @@ -59,7 +52,7 @@ map PrepareStatisticsData(string const & routerName, } // namespace -AsyncRouter::AsyncRouter(unique_ptr && router, unique_ptr && fetcher, +AsyncRouter::AsyncRouter(unique_ptr && router, unique_ptr && fetcher, TRoutingStatisticsCallback const & routingStatisticsFn) : m_absentFetcher(move(fetcher)), m_router(move(router)), @@ -126,8 +119,14 @@ void AsyncRouter::LogCode(IRouter::ResultCode code, double const elapsedSec) case IRouter::NoError: LOG(LINFO, ("Route found, elapsed seconds:", elapsedSec)); break; - - default: + case IRouter::NoCurrentPosition: + LOG(LINFO, ("No current position")); + break; + case IRouter::InconsistentMWMandRoute: + LOG(LINFO, ("Inconsistent mwm and route")); + break; + case IRouter::InternalError: + LOG(LINFO, ("Internal error")); break; } } @@ -156,7 +155,6 @@ void AsyncRouter::CalculateRouteImpl(TReadyCallback const & callback) } my::Timer timer; - timer.Reset(); try { LOG(LDEBUG, ("Calculating the route from", startPoint, "to", finalPoint, "startDirection", startDirection)); diff --git a/routing/async_router.hpp b/routing/async_router.hpp index 41ebb52c67..73da5a8c2f 100644 --- a/routing/async_router.hpp +++ b/routing/async_router.hpp @@ -25,7 +25,7 @@ public: /// AsyncRouter is a wrapper class to run routing routines in the different thread /// @param router pointer to the router implementation. AsyncRouter will take ownership over /// router. - AsyncRouter(unique_ptr && router, unique_ptr && fetcher, + AsyncRouter(unique_ptr && router, unique_ptr && fetcher, TRoutingStatisticsCallback const & routingStatisticsFn); virtual ~AsyncRouter(); @@ -66,7 +66,7 @@ private: m2::PointD m_finalPoint; m2::PointD m_startDirection; - unique_ptr const m_absentFetcher; + unique_ptr const m_absentFetcher; unique_ptr const m_router; TRoutingStatisticsCallback const m_routingStatisticsFn; }; diff --git a/routing/online_absent_fetcher.cpp b/routing/online_absent_fetcher.cpp index 4b244ad5d5..4a35e4121c 100644 --- a/routing/online_absent_fetcher.cpp +++ b/routing/online_absent_fetcher.cpp @@ -11,7 +11,7 @@ using platform::LocalCountryFile; namespace routing { -void OnlineAbsentFetcher::GenerateRequest(const m2::PointD & startPoint, +void OnlineAbsentCountriesFetcher::GenerateRequest(const m2::PointD & startPoint, const m2::PointD & finalPoint) { // single mwm case @@ -22,19 +22,19 @@ void OnlineAbsentFetcher::GenerateRequest(const m2::PointD & startPoint, m_fetcherThread.Create(move(fetcher)); } -void OnlineAbsentFetcher::GetAbsentCountries(vector & countries) +void OnlineAbsentCountriesFetcher::GetAbsentCountries(vector & countries) { // Have task check if (!m_fetcherThread.GetRoutine()) return; m_fetcherThread.Join(); - for (auto point : static_cast(m_fetcherThread.GetRoutine())->GetMwmPoints()) + for (auto point : m_fetcherThread.GetRoutineAs()->GetMwmPoints()) { string name = m_countryFileFn(point); auto localFile = m_countryLocalFileFn(name); if (!HasOptions(localFile->GetFiles(), TMapOptions::EMapWithCarRouting)) { - LOG(LINFO, ("Online recomends to download: ", name)); + LOG(LINFO, ("Online absent countries fetcher recomends to download: ", name)); countries.emplace_back(move(name)); } } diff --git a/routing/online_absent_fetcher.hpp b/routing/online_absent_fetcher.hpp index 6c8438b335..a8bfa44445 100644 --- a/routing/online_absent_fetcher.hpp +++ b/routing/online_absent_fetcher.hpp @@ -11,10 +11,10 @@ namespace routing { -class OnlineAbsentFetcher +class OnlineAbsentCountriesFetcher { public: - OnlineAbsentFetcher(TCountryFileFn const & countryFileFn, TCountryLocalFileFn const & countryLocalFileFn) : m_countryFileFn(countryFileFn), m_countryLocalFileFn(countryLocalFileFn) {} + OnlineAbsentCountriesFetcher(TCountryFileFn const & countryFileFn, TCountryLocalFileFn const & countryLocalFileFn) : m_countryFileFn(countryFileFn), m_countryLocalFileFn(countryLocalFileFn) {} void GenerateRequest(m2::PointD const & startPoint, m2::PointD const & finalPoint); void GetAbsentCountries(vector & countries); diff --git a/routing/online_cross_fetcher.hpp b/routing/online_cross_fetcher.hpp index 5c492871b6..e005cfa6bd 100644 --- a/routing/online_cross_fetcher.hpp +++ b/routing/online_cross_fetcher.hpp @@ -39,7 +39,7 @@ public: OnlineCrossFetcher(string const & serverURL, m2::PointD const & startPoint, m2::PointD const & finalPoint); - /// Do synchronous (blocking) call of online OSRM server. Designing for call from another thread. + /// Override threads::IRoutine processing procedure. Calls online OSRM server and parses response. void Do() override; /// \brief GetMwmPoints returns mwm representation points list. diff --git a/routing/osrm2feature_map.cpp b/routing/osrm2feature_map.cpp index 198f5725d8..cba8fdee8d 100644 --- a/routing/osrm2feature_map.cpp +++ b/routing/osrm2feature_map.cpp @@ -18,6 +18,7 @@ #include "3party/succinct/mapper.hpp" +const routing::TNodesList kEmptyList; namespace routing { diff --git a/routing/osrm2feature_map.hpp b/routing/osrm2feature_map.hpp index 3e592a8949..4208f9f83c 100644 --- a/routing/osrm2feature_map.hpp +++ b/routing/osrm2feature_map.hpp @@ -101,7 +101,6 @@ class OsrmFtSegBackwardIndex succinct::rs_bit_vector m_rankIndex; vector m_nodeIds; unique_ptr m_table; - const TNodesList kEmptyList; unique_ptr m_mappedBits;