diff options
author | Sergey Yershov <syershov@maps.me> | 2018-06-18 11:39:14 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2018-06-22 12:22:30 +0300 |
commit | 37d3d2f748769f024a0e6b8a969822746de93971 (patch) | |
tree | 2e4dec2e01a056f5d03a9e91a3f3e8ac15cc777e /routing | |
parent | c92fe0a11d20e99ae47c723a2746d44d304a5cd0 (diff) |
[indexer][editor] Refactor Index into DataSource
Remove namespace datasource
Diffstat (limited to 'routing')
32 files changed, 103 insertions, 88 deletions
diff --git a/routing/bicycle_directions.cpp b/routing/bicycle_directions.cpp index f107656e71..ba9ce9c40c 100644 --- a/routing/bicycle_directions.cpp +++ b/routing/bicycle_directions.cpp @@ -12,8 +12,9 @@ #include "routing_common/car_model.hpp" +#include "editor/editable_data_source.hpp" + #include "indexer/ftypes_matcher.hpp" -#include "indexer/index.hpp" #include "indexer/scales.hpp" #include "geometry/mercator.hpp" @@ -157,7 +158,7 @@ bool BicycleDirectionsEngine::AdjacentEdges::IsAlmostEqual(AdjacentEdges const & } // BicycleDirectionsEngine ------------------------------------------------------------------------ -BicycleDirectionsEngine::BicycleDirectionsEngine(Index const & index, shared_ptr<NumMwmIds> numMwmIds) +BicycleDirectionsEngine::BicycleDirectionsEngine(DataSourceBase const & index, shared_ptr<NumMwmIds> numMwmIds) : m_index(index), m_numMwmIds(numMwmIds) { CHECK(m_numMwmIds, ()); @@ -209,10 +210,10 @@ bool BicycleDirectionsEngine::Generate(IndexRoadGraph const & graph, vector<Junc return true; } -Index::FeaturesLoaderGuard & BicycleDirectionsEngine::GetLoader(MwmSet::MwmId const & id) +EditableDataSource::FeaturesLoaderGuard & BicycleDirectionsEngine::GetLoader(MwmSet::MwmId const & id) { if (!m_loader || id != m_loader->GetId()) - m_loader = make_unique<Index::FeaturesLoaderGuard>(m_index, id); + m_loader = make_unique<EditableDataSource::FeaturesLoaderGuard>(m_index, id); return *m_loader; } diff --git a/routing/bicycle_directions.hpp b/routing/bicycle_directions.hpp index a21c82743c..5fcb6df005 100644 --- a/routing/bicycle_directions.hpp +++ b/routing/bicycle_directions.hpp @@ -7,7 +7,7 @@ #include "routing_common/num_mwm_id.hpp" -#include "indexer/index.hpp" +#include "editor/editable_data_source.hpp" #include <map> #include <memory> @@ -28,7 +28,7 @@ public: using AdjacentEdgesMap = std::map<SegmentRange, AdjacentEdges>; - BicycleDirectionsEngine(Index const & index, std::shared_ptr<NumMwmIds> numMwmIds); + BicycleDirectionsEngine(DataSourceBase const & index, std::shared_ptr<NumMwmIds> numMwmIds); // IDirectionsEngine override: bool Generate(IndexRoadGraph const & graph, vector<Junction> const & path, @@ -37,7 +37,7 @@ public: vector<Segment> & segments) override; private: - Index::FeaturesLoaderGuard & GetLoader(MwmSet::MwmId const & id); + EditableDataSource::FeaturesLoaderGuard & GetLoader(MwmSet::MwmId const & id); void LoadPathAttributes(FeatureID const & featureId, LoadedPathSegment & pathSegment); void GetSegmentRangeAndAdjacentEdges(IRoadGraph::TEdgeVector const & outgoingEdges, Edge const & inEdge, uint32_t startSegId, uint32_t endSegId, @@ -56,8 +56,8 @@ private: AdjacentEdgesMap m_adjacentEdges; TUnpackedPathSegments m_pathSegments; - Index const & m_index; + DataSourceBase const & m_index; std::shared_ptr<NumMwmIds> m_numMwmIds; - std::unique_ptr<Index::FeaturesLoaderGuard> m_loader; + std::unique_ptr<EditableDataSource::FeaturesLoaderGuard> m_loader; }; } // namespace routing diff --git a/routing/cross_mwm_graph.cpp b/routing/cross_mwm_graph.cpp index 2bcad69f3c..70051d025c 100644 --- a/routing/cross_mwm_graph.cpp +++ b/routing/cross_mwm_graph.cpp @@ -2,6 +2,7 @@ #include "routing/routing_exceptions.hpp" #include "routing/transit_graph.hpp" +#include "indexer/data_source.hpp" #include "indexer/scales.hpp" #include "geometry/mercator.hpp" @@ -49,7 +50,7 @@ CrossMwmGraph::CrossMwmGraph(shared_ptr<NumMwmIds> numMwmIds, shared_ptr<m4::Tree<NumMwmId>> numMwmTree, shared_ptr<VehicleModelFactoryInterface> vehicleModelFactory, VehicleType vehicleType, CourntryRectFn const & countryRectFn, - Index & index) + DataSourceBase & index) : m_index(index) , m_numMwmIds(numMwmIds) , m_numMwmTree(numMwmTree) diff --git a/routing/cross_mwm_graph.hpp b/routing/cross_mwm_graph.hpp index cfc2d667b5..4735e13cd9 100644 --- a/routing/cross_mwm_graph.hpp +++ b/routing/cross_mwm_graph.hpp @@ -9,8 +9,6 @@ #include "routing_common/num_mwm_id.hpp" #include "routing_common/vehicle_model.hpp" -#include "indexer/index.hpp" - #include "geometry/tree4d.hpp" #include "base/math.hpp" @@ -22,6 +20,8 @@ #include <utility> #include <vector> +class DataSourceBase; + namespace routing { /// \brief Getting information for cross mwm routing. @@ -37,7 +37,7 @@ public: CrossMwmGraph(std::shared_ptr<NumMwmIds> numMwmIds, shared_ptr<m4::Tree<NumMwmId>> numMwmTree, std::shared_ptr<VehicleModelFactoryInterface> vehicleModelFactory, VehicleType vehicleType, - CourntryRectFn const & countryRectFn, Index & index); + CourntryRectFn const & countryRectFn, DataSourceBase & index); /// \brief Transition segment is a segment which is crossed by mwm border. That means /// start and finish of such segment have to lie in different mwms. If a segment is @@ -148,7 +148,7 @@ private: void DeserializeTransitions(std::vector<NumMwmId> const & mwmIds); void DeserializeTransitTransitions(std::vector<NumMwmId> const & mwmIds); - Index & m_index; + DataSourceBase & m_index; std::shared_ptr<NumMwmIds> m_numMwmIds; std::shared_ptr<m4::Tree<NumMwmId>> m_numMwmTree; std::shared_ptr<VehicleModelFactoryInterface> m_vehicleModelFactory; diff --git a/routing/cross_mwm_index_graph.hpp b/routing/cross_mwm_index_graph.hpp index 6cfc51b02e..c3faf1d7a6 100644 --- a/routing/cross_mwm_index_graph.hpp +++ b/routing/cross_mwm_index_graph.hpp @@ -14,7 +14,7 @@ #include "coding/file_container.hpp" #include "coding/reader.hpp" -#include "indexer/index.hpp" +#include "indexer/data_source.hpp" #include <map> #include <memory> @@ -66,7 +66,7 @@ class CrossMwmIndexGraph final public: using ReaderSourceFile = ReaderSource<FilesContainerR::TReader>; - CrossMwmIndexGraph(Index & index, std::shared_ptr<NumMwmIds> numMwmIds, VehicleType vehicleType) + CrossMwmIndexGraph(DataSourceBase & index, std::shared_ptr<NumMwmIds> numMwmIds, VehicleType vehicleType) : m_index(index), m_numMwmIds(numMwmIds), m_vehicleType(vehicleType) { } @@ -193,7 +193,7 @@ private: return it->second; } - Index & m_index; + DataSourceBase & m_index; std::shared_ptr<NumMwmIds> m_numMwmIds; VehicleType m_vehicleType; diff --git a/routing/features_road_graph.cpp b/routing/features_road_graph.cpp index da1e6c9ef9..34b1040a3a 100644 --- a/routing/features_road_graph.cpp +++ b/routing/features_road_graph.cpp @@ -4,9 +4,10 @@ #include "routing_common/vehicle_model.hpp" +#include "editor/editable_data_source.hpp" + #include "indexer/classificator.hpp" #include "indexer/ftypes_matcher.hpp" -#include "indexer/index.hpp" #include "indexer/scales.hpp" #include "geometry/distance_on_sphere.hpp" @@ -29,7 +30,7 @@ double constexpr kMwmCrossingNodeEqualityRadiusMeters = 100.0; double GetRoadCrossingRadiusMeters() { return kMwmRoadCrossingRadiusMeters; } -FeaturesRoadGraph::Value::Value(Index const & index, MwmSet::MwmHandle handle) +FeaturesRoadGraph::Value::Value(DataSourceBase const & index, MwmSet::MwmHandle handle) : m_mwmHandle(move(handle)) { if (!m_mwmHandle.IsAlive()) @@ -110,7 +111,7 @@ void FeaturesRoadGraph::RoadInfoCache::Clear() { m_cache.clear(); } -FeaturesRoadGraph::FeaturesRoadGraph(Index const & index, IRoadGraph::Mode mode, +FeaturesRoadGraph::FeaturesRoadGraph(DataSourceBase const & index, IRoadGraph::Mode mode, shared_ptr<VehicleModelFactoryInterface> vehicleModelFactory) : m_index(index), m_mode(mode), m_vehicleModel(vehicleModelFactory) { @@ -204,7 +205,7 @@ void FeaturesRoadGraph::FindClosestEdges(m2::PointD const & point, uint32_t coun void FeaturesRoadGraph::GetFeatureTypes(FeatureID const & featureId, feature::TypesHolder & types) const { FeatureType ft; - Index::FeaturesLoaderGuard loader(m_index, featureId.m_mwmId); + EditableDataSource::FeaturesLoaderGuard loader(m_index, featureId.m_mwmId); if (!loader.GetFeatureByIndex(featureId.m_index, ft)) return; @@ -305,7 +306,7 @@ IRoadGraph::RoadInfo const & FeaturesRoadGraph::GetCachedRoadInfo(FeatureID cons FeatureType ft; - Index::FeaturesLoaderGuard loader(m_index, featureId.m_mwmId); + EditableDataSource::FeaturesLoaderGuard loader(m_index, featureId.m_mwmId); if (!loader.GetFeatureByIndex(featureId.m_index, ft)) return ri; diff --git a/routing/features_road_graph.hpp b/routing/features_road_graph.hpp index 6d06208faf..c2e559d481 100644 --- a/routing/features_road_graph.hpp +++ b/routing/features_road_graph.hpp @@ -6,7 +6,6 @@ #include "indexer/altitude_loader.hpp" #include "indexer/feature_data.hpp" -#include "indexer/index.hpp" #include "indexer/mwm_set.hpp" #include "geometry/point2d.hpp" @@ -17,7 +16,7 @@ #include "std/unique_ptr.hpp" #include "std/vector.hpp" -class Index; +class DataSourceBase; class FeatureType; namespace routing @@ -64,7 +63,7 @@ private: }; public: - FeaturesRoadGraph(Index const & index, IRoadGraph::Mode mode, + FeaturesRoadGraph(DataSourceBase const & index, IRoadGraph::Mode mode, shared_ptr<VehicleModelFactoryInterface> vehicleModelFactory); static int GetStreetReadScale(); @@ -90,7 +89,7 @@ private: struct Value { Value() = default; - Value(Index const & index, MwmSet::MwmHandle handle); + Value(DataSourceBase const & index, MwmSet::MwmHandle handle); bool IsAlive() const { return m_mwmHandle.IsAlive(); } @@ -113,7 +112,7 @@ private: Value const & LockMwm(MwmSet::MwmId const & mwmId) const; - Index const & m_index; + DataSourceBase const & m_index; IRoadGraph::Mode const m_mode; mutable RoadInfoCache m_cache; mutable CrossCountryVehicleModel m_vehicleModel; diff --git a/routing/geometry.cpp b/routing/geometry.cpp index 0cb7d20809..03709186f3 100644 --- a/routing/geometry.cpp +++ b/routing/geometry.cpp @@ -2,6 +2,8 @@ #include "routing/routing_exceptions.hpp" +#include "editor/editable_data_source.hpp" + #include "indexer/altitude_loader.hpp" #include "geometry/mercator.hpp" @@ -23,7 +25,7 @@ size_t constexpr kRoadsCacheSize = 5000; class GeometryLoaderImpl final : public GeometryLoader { public: - GeometryLoaderImpl(Index const & index, MwmSet::MwmHandle const & handle, + GeometryLoaderImpl(DataSourceBase const & index, MwmSet::MwmHandle const & handle, shared_ptr<VehicleModelInterface> vehicleModel, bool loadAltitudes); // GeometryLoader overrides: @@ -31,13 +33,13 @@ public: private: shared_ptr<VehicleModelInterface> m_vehicleModel; - Index::FeaturesLoaderGuard m_guard; + EditableDataSource::FeaturesLoaderGuard m_guard; string const m_country; feature::AltitudeLoader m_altitudeLoader; bool const m_loadAltitudes; }; -GeometryLoaderImpl::GeometryLoaderImpl(Index const & index, MwmSet::MwmHandle const & handle, +GeometryLoaderImpl::GeometryLoaderImpl(DataSourceBase const & index, MwmSet::MwmHandle const & handle, shared_ptr<VehicleModelInterface> vehicleModel, bool loadAltitudes) : m_vehicleModel(move(vehicleModel)) , m_guard(index, handle.GetId()) @@ -159,7 +161,7 @@ RoadGeometry const & Geometry::GetRoad(uint32_t featureId) } // static -unique_ptr<GeometryLoader> GeometryLoader::Create(Index const & index, +unique_ptr<GeometryLoader> GeometryLoader::Create(DataSourceBase const & index, MwmSet::MwmHandle const & handle, shared_ptr<VehicleModelInterface> vehicleModel, bool loadAltitudes) diff --git a/routing/geometry.hpp b/routing/geometry.hpp index 17c5ecae06..cdbb9d157e 100644 --- a/routing/geometry.hpp +++ b/routing/geometry.hpp @@ -6,7 +6,6 @@ #include "routing_common/vehicle_model.hpp" #include "indexer/feature_altitude.hpp" -#include "indexer/index.hpp" #include "geometry/point2d.hpp" @@ -17,6 +16,8 @@ #include <memory> #include <string> +class DataSourceBase; + namespace routing { class RoadGeometry final @@ -78,7 +79,7 @@ public: virtual void Load(uint32_t featureId, RoadGeometry & road) = 0; // handle should be alive: it is caller responsibility to check it. - static std::unique_ptr<GeometryLoader> Create(Index const & index, + static std::unique_ptr<GeometryLoader> Create(DataSourceBase const & index, MwmSet::MwmHandle const & handle, std::shared_ptr<VehicleModelInterface> vehicleModel, bool loadAltitudes); diff --git a/routing/index_graph_loader.cpp b/routing/index_graph_loader.cpp index 307dd3f132..b1218e1aba 100644 --- a/routing/index_graph_loader.cpp +++ b/routing/index_graph_loader.cpp @@ -5,6 +5,8 @@ #include "routing/road_access_serialization.hpp" #include "routing/routing_exceptions.hpp" +#include "indexer/data_source.hpp" + #include "coding/file_container.hpp" #include "base/assert.hpp" @@ -20,7 +22,7 @@ class IndexGraphLoaderImpl final : public IndexGraphLoader public: IndexGraphLoaderImpl(VehicleType vehicleType, bool loadAltitudes, shared_ptr<NumMwmIds> numMwmIds, shared_ptr<VehicleModelFactoryInterface> vehicleModelFactory, - shared_ptr<EdgeEstimator> estimator, Index & index); + shared_ptr<EdgeEstimator> estimator, DataSourceBase & index); // IndexGraphLoader overrides: Geometry & GetGeometry(NumMwmId numMwmId) override; @@ -39,7 +41,7 @@ private: VehicleType m_vehicleType; bool m_loadAltitudes; - Index & m_index; + DataSourceBase & m_index; shared_ptr<NumMwmIds> m_numMwmIds; shared_ptr<VehicleModelFactoryInterface> m_vehicleModelFactory; shared_ptr<EdgeEstimator> m_estimator; @@ -49,7 +51,7 @@ private: IndexGraphLoaderImpl::IndexGraphLoaderImpl( VehicleType vehicleType, bool loadAltitudes, shared_ptr<NumMwmIds> numMwmIds, shared_ptr<VehicleModelFactoryInterface> vehicleModelFactory, - shared_ptr<EdgeEstimator> estimator, Index & index) + shared_ptr<EdgeEstimator> estimator, DataSourceBase & index) : m_vehicleType(vehicleType) , m_loadAltitudes(loadAltitudes) , m_index(index) @@ -147,7 +149,7 @@ namespace routing unique_ptr<IndexGraphLoader> IndexGraphLoader::Create( VehicleType vehicleType, bool loadAltitudes, shared_ptr<NumMwmIds> numMwmIds, shared_ptr<VehicleModelFactoryInterface> vehicleModelFactory, shared_ptr<EdgeEstimator> estimator, - Index & index) + DataSourceBase & index) { return make_unique<IndexGraphLoaderImpl>(vehicleType, loadAltitudes, numMwmIds, vehicleModelFactory, estimator, index); diff --git a/routing/index_graph_loader.hpp b/routing/index_graph_loader.hpp index 63d698ed89..bcb8336d81 100644 --- a/routing/index_graph_loader.hpp +++ b/routing/index_graph_loader.hpp @@ -7,10 +7,11 @@ #include "routing_common/num_mwm_id.hpp" #include "routing_common/vehicle_model.hpp" -#include "indexer/index.hpp" - #include <memory> +class MwmValue; +class DataSourceBase; + namespace routing { class IndexGraphLoader @@ -25,7 +26,7 @@ public: static std::unique_ptr<IndexGraphLoader> Create( VehicleType vehicleType, bool loadAltitudes, std::shared_ptr<NumMwmIds> numMwmIds, std::shared_ptr<VehicleModelFactoryInterface> vehicleModelFactory, - std::shared_ptr<EdgeEstimator> estimator, Index & index); + std::shared_ptr<EdgeEstimator> estimator, DataSourceBase & index); }; void DeserializeIndexGraph(MwmValue const & mwmValue, VehicleType vehicleType, IndexGraph & graph); diff --git a/routing/index_road_graph.cpp b/routing/index_road_graph.cpp index 107f499e26..e8e81d863c 100644 --- a/routing/index_road_graph.cpp +++ b/routing/index_road_graph.cpp @@ -3,6 +3,8 @@ #include "routing/routing_exceptions.hpp" #include "routing/transit_graph.hpp" +#include "editor/editable_data_source.hpp" + #include <cstdint> using namespace std; @@ -11,7 +13,7 @@ namespace routing { IndexRoadGraph::IndexRoadGraph(shared_ptr<NumMwmIds> numMwmIds, IndexGraphStarter & starter, vector<Segment> const & segments, vector<Junction> const & junctions, - Index & index) + DataSourceBase & index) : m_index(index), m_numMwmIds(numMwmIds), m_starter(starter), m_segments(segments) { // j0 j1 j2 j3 @@ -58,7 +60,7 @@ void IndexRoadGraph::GetEdgeTypes(Edge const & edge, feature::TypesHolder & type FeatureID const featureId = edge.GetFeatureId(); FeatureType ft; - Index::FeaturesLoaderGuard loader(m_index, featureId.m_mwmId); + EditableDataSource::FeaturesLoaderGuard loader(m_index, featureId.m_mwmId); if (!loader.GetFeatureByIndex(featureId.m_index, ft)) { LOG(LERROR, ("Can't load types for feature", featureId)); diff --git a/routing/index_road_graph.hpp b/routing/index_road_graph.hpp index a15ac30a59..804b2ac68a 100644 --- a/routing/index_road_graph.hpp +++ b/routing/index_road_graph.hpp @@ -6,7 +6,7 @@ #include "routing_common/num_mwm_id.hpp" -#include "indexer/index.hpp" +#include "indexer/data_source.hpp" #include <map> #include <memory> @@ -19,7 +19,7 @@ class IndexRoadGraph : public RoadGraphBase public: IndexRoadGraph(std::shared_ptr<NumMwmIds> numMwmIds, IndexGraphStarter & starter, std::vector<Segment> const & segments, std::vector<Junction> const & junctions, - Index & index); + DataSourceBase & index); // IRoadGraphBase overrides: virtual void GetOutgoingEdges(Junction const & junction, TEdgeVector & edges) const override; @@ -35,7 +35,7 @@ private: void GetEdges(Junction const & junction, bool isOutgoing, TEdgeVector & edges) const; std::vector<Segment> const & GetSegments(Junction const & junction, bool isOutgoing) const; - Index & m_index; + DataSourceBase & m_index; std::shared_ptr<NumMwmIds> m_numMwmIds; IndexGraphStarter & m_starter; std::vector<Segment> m_segments; diff --git a/routing/index_router.cpp b/routing/index_router.cpp index c78afae414..1f0aa06d65 100644 --- a/routing/index_router.cpp +++ b/routing/index_router.cpp @@ -26,6 +26,7 @@ #include "transit/transit_speed_limits.hpp" +#include "indexer/data_source.hpp" #include "indexer/feature_altitude.hpp" #include "geometry/distance.hpp" @@ -100,7 +101,7 @@ shared_ptr<VehicleModelFactoryInterface> CreateVehicleModelFactory( } unique_ptr<IDirectionsEngine> CreateDirectionsEngine(VehicleType vehicleType, - shared_ptr<NumMwmIds> numMwmIds, Index & index) + shared_ptr<NumMwmIds> numMwmIds, DataSourceBase & index) { switch (vehicleType) { @@ -153,7 +154,7 @@ bool MwmHasRoutingData(version::MwmTraits const & traits) return traits.HasRoutingIndex() && traits.HasCrossMwmSection(); } -void GetOutdatedMwms(Index & index, vector<string> & outdatedMwms) +void GetOutdatedMwms(DataSourceBase & index, vector<string> & outdatedMwms) { outdatedMwms.clear(); vector<shared_ptr<MwmInfo>> infos; @@ -273,7 +274,7 @@ IndexRouter::IndexRouter(VehicleType vehicleType, bool loadAltitudes, CountryParentNameGetterFn const & countryParentNameGetterFn, TCountryFileFn const & countryFileFn, CourntryRectFn const & countryRectFn, shared_ptr<NumMwmIds> numMwmIds, unique_ptr<m4::Tree<NumMwmId>> numMwmTree, - traffic::TrafficCache const & trafficCache, Index & index) + traffic::TrafficCache const & trafficCache, DataSourceBase & index) : m_vehicleType(vehicleType) , m_loadAltitudes(loadAltitudes) , m_name("astar-bidirectional-" + ToString(m_vehicleType)) diff --git a/routing/index_router.hpp b/routing/index_router.hpp index ae67605646..4b7ec5b7b6 100644 --- a/routing/index_router.hpp +++ b/routing/index_router.hpp @@ -17,7 +17,6 @@ #include "routing_common/num_mwm_id.hpp" #include "routing_common/vehicle_model.hpp" -#include "indexer/index.hpp" #include "indexer/mwm_set.hpp" #include "geometry/tree4d.hpp" @@ -29,6 +28,8 @@ #include <string> #include <vector> +class DataSourceBase; + namespace routing { class IndexGraph; @@ -64,7 +65,7 @@ public: IndexRouter(VehicleType vehicleType, bool loadAltitudes, CountryParentNameGetterFn const & countryParentNameGetterFn, TCountryFileFn const & countryFileFn, CourntryRectFn const & countryRectFn, shared_ptr<NumMwmIds> numMwmIds, unique_ptr<m4::Tree<NumMwmId>> numMwmTree, - traffic::TrafficCache const & trafficCache, Index & index); + traffic::TrafficCache const & trafficCache, DataSourceBase & index); std::unique_ptr<WorldGraph> MakeSingleMwmWorldGraph(); bool FindBestSegment(m2::PointD const & point, m2::PointD const & direction, @@ -146,7 +147,7 @@ private: VehicleType m_vehicleType; bool m_loadAltitudes; std::string const m_name; - Index & m_index; + DataSourceBase & m_index; std::shared_ptr<VehicleModelFactoryInterface> m_vehicleModelFactory; TCountryFileFn const m_countryFileFn; diff --git a/routing/loaded_path_segment.hpp b/routing/loaded_path_segment.hpp index 6b0e780211..4bc06557cb 100644 --- a/routing/loaded_path_segment.hpp +++ b/routing/loaded_path_segment.hpp @@ -14,7 +14,7 @@ #include "std/vector.hpp" -class Index; +class DataSourceBase; namespace routing { diff --git a/routing/nearest_edge_finder.hpp b/routing/nearest_edge_finder.hpp index e9257337e3..536c1507bc 100644 --- a/routing/nearest_edge_finder.hpp +++ b/routing/nearest_edge_finder.hpp @@ -8,7 +8,6 @@ #include "indexer/feature_altitude.hpp" #include "indexer/feature_decl.hpp" -#include "indexer/index.hpp" #include "indexer/mwm_set.hpp" #include <cstdint> diff --git a/routing/restriction_loader.cpp b/routing/restriction_loader.cpp index b085e3f364..d7b1f48db2 100644 --- a/routing/restriction_loader.cpp +++ b/routing/restriction_loader.cpp @@ -3,6 +3,8 @@ #include "routing/restrictions_serialization.hpp" #include "routing/road_index.hpp" +#include "indexer/mwm_set.hpp" + #include "base/stl_helpers.hpp" namespace diff --git a/routing/restriction_loader.hpp b/routing/restriction_loader.hpp index 6c4e6adbfa..3871e9f1b1 100644 --- a/routing/restriction_loader.hpp +++ b/routing/restriction_loader.hpp @@ -3,13 +3,13 @@ #include "routing/index_graph.hpp" #include "routing/restrictions_serialization.hpp" -#include "indexer/index.hpp" - #include "coding/file_container.hpp" #include "std/string.hpp" #include "std/unique_ptr.hpp" +class MwmValue; + namespace routing { class RestrictionLoader diff --git a/routing/routing_benchmarks/helpers.hpp b/routing/routing_benchmarks/helpers.hpp index 0f06b9a36d..1d6d948140 100644 --- a/routing/routing_benchmarks/helpers.hpp +++ b/routing/routing_benchmarks/helpers.hpp @@ -12,7 +12,7 @@ #include "traffic/traffic_cache.hpp" -#include "indexer/index.hpp" +#include "indexer/data_source.hpp" #include "geometry/point2d.hpp" @@ -42,7 +42,7 @@ protected: std::vector<std::pair<routing::Edge, routing::Junction>> & edges); routing::IRoadGraph::Mode const m_mode; - Index m_index; + DataSource m_index; traffic::TrafficCache m_trafficCache; std::vector<platform::LocalCountryFile> m_localFiles; diff --git a/routing/routing_integration_tests/get_altitude_test.cpp b/routing/routing_integration_tests/get_altitude_test.cpp index bbaa3a6b9d..525f08fcfc 100644 --- a/routing/routing_integration_tests/get_altitude_test.cpp +++ b/routing/routing_integration_tests/get_altitude_test.cpp @@ -5,10 +5,10 @@ #include "indexer/altitude_loader.hpp" #include "indexer/classificator.hpp" #include "indexer/classificator_loader.hpp" +#include "indexer/data_source.hpp" #include "indexer/feature_altitude.hpp" #include "indexer/feature_data.hpp" #include "indexer/feature_processor.hpp" -#include "indexer/index.hpp" #include "routing/routing_helpers.hpp" @@ -43,7 +43,7 @@ LocalCountryFile GetLocalCountryFileByCountryId(CountryFile const & country) void TestAltitudeOfAllMwmFeatures(string const & countryId, TAltitude const altitudeLowerBoundMeters, TAltitude const altitudeUpperBoundMeters) { - Index index; + DataSource index; LocalCountryFile const country = GetLocalCountryFileByCountryId(CountryFile(countryId)); TEST_NOT_EQUAL(country, LocalCountryFile(), ()); diff --git a/routing/routing_integration_tests/road_graph_tests.cpp b/routing/routing_integration_tests/road_graph_tests.cpp index 653ee15a3d..c2e990c361 100644 --- a/routing/routing_integration_tests/road_graph_tests.cpp +++ b/routing/routing_integration_tests/road_graph_tests.cpp @@ -5,8 +5,8 @@ #include "geometry/point2d.hpp" #include "indexer/classificator_loader.hpp" +#include "indexer/data_source.hpp" #include "indexer/feature_altitude.hpp" -#include "indexer/index.hpp" #include "indexer/mwm_set.hpp" #include "routing_common/car_model.hpp" @@ -31,7 +31,7 @@ UNIT_TEST(FakeEdgesCombinatorialExplosion) GetAllLocalFiles(localFiles); TEST(!localFiles.empty(), ()); - Index index; + DataSource index; for (auto const & file : localFiles) { auto const result = index.Register(file); diff --git a/routing/routing_integration_tests/routing_test_tools.cpp b/routing/routing_integration_tests/routing_test_tools.cpp index 1e5a483896..46931f03ff 100644 --- a/routing/routing_integration_tests/routing_test_tools.cpp +++ b/routing/routing_integration_tests/routing_test_tools.cpp @@ -15,7 +15,7 @@ #include "routing/router_delegate.hpp" #include "routing/routing_callbacks.hpp" -#include "indexer/index.hpp" +#include "indexer/data_source.hpp" #include "storage/country_parent_getter.hpp" @@ -41,7 +41,7 @@ using namespace routing; using namespace routing_test; using TRouterFactory = - function<unique_ptr<IRouter>(Index & index, TCountryFileFn const & countryFileFn, + function<unique_ptr<IRouter>(DataSourceBase & index, TCountryFileFn const & countryFileFn, shared_ptr<NumMwmIds> numMwmIds)>; namespace @@ -85,7 +85,7 @@ namespace integration return storage::CountryInfoReader::CreateCountryInfoReader(platform); } - unique_ptr<IndexRouter> CreateVehicleRouter(Index & index, + unique_ptr<IndexRouter> CreateVehicleRouter(DataSourceBase & index, storage::CountryInfoGetter const & infoGetter, traffic::TrafficCache const & trafficCache, vector<LocalCountryFile> const & localFiles, @@ -120,7 +120,7 @@ namespace integration return indexRouter; } - unique_ptr<IRouter> CreateAStarRouter(Index & index, + unique_ptr<IRouter> CreateAStarRouter(DataSourceBase & index, storage::CountryInfoGetter const & infoGetter, vector<LocalCountryFile> const & localFiles, TRouterFactory const & routerFactory) diff --git a/routing/routing_integration_tests/routing_test_tools.hpp b/routing/routing_integration_tests/routing_test_tools.hpp index d8b44394fe..6c659f7da9 100644 --- a/routing/routing_integration_tests/routing_test_tools.hpp +++ b/routing/routing_integration_tests/routing_test_tools.hpp @@ -51,7 +51,7 @@ shared_ptr<model::FeaturesFetcher> CreateFeaturesFetcher(vector<LocalCountryFile unique_ptr<storage::CountryInfoGetter> CreateCountryInfoGetter(); -unique_ptr<IndexRouter> CreateVehicleRouter(Index & index, +unique_ptr<IndexRouter> CreateVehicleRouter(DataSourceBase & index, storage::CountryInfoGetter const & infoGetter, traffic::TrafficCache const & trafficCache, vector<LocalCountryFile> const & localFiles, diff --git a/routing/routing_session.cpp b/routing/routing_session.cpp index 1f7b7cd9f3..fcd91502a3 100644 --- a/routing/routing_session.cpp +++ b/routing/routing_session.cpp @@ -284,8 +284,9 @@ void RoutingSession::ResetImpl() m_lastCompletionPercent = 0; } -RoutingSession::State RoutingSession::OnLocationPositionChanged(GpsInfo const & info, Index const & index) - { +RoutingSession::State RoutingSession::OnLocationPositionChanged(GpsInfo const & info, + DataSourceBase const & index) +{ threads::MutexGuard guard(m_routingSessionMutex); ASSERT(m_state != RoutingNotActive, ()); ASSERT(m_router != nullptr, ()); @@ -662,7 +663,7 @@ string RoutingSession::GetTurnNotificationsLocale() const return m_turnNotificationsMgr.GetLocale(); } -double RoutingSession::GetDistanceToCurrentCamM(SpeedCameraRestriction & camera, Index const & index) +double RoutingSession::GetDistanceToCurrentCamM(SpeedCameraRestriction & camera, DataSourceBase const & index) { ASSERT(m_route, ()); diff --git a/routing/routing_session.hpp b/routing/routing_session.hpp index e094eb327d..07b3391a9a 100644 --- a/routing/routing_session.hpp +++ b/routing/routing_session.hpp @@ -7,8 +7,6 @@ #include "routing/turns.hpp" #include "routing/turns_notification_manager.hpp" -#include "indexer/index.hpp" - #include "traffic/speed_groups.hpp" #include "traffic/traffic_cache.hpp" #include "traffic/traffic_info.hpp" @@ -27,6 +25,8 @@ #include "std/shared_ptr.hpp" #include "std/unique_ptr.hpp" +class DataSourceBase; + namespace location { class RouteMatchingInfo; @@ -120,7 +120,7 @@ public: bool GetRouteAltitudesAndDistancesM(vector<double> & routeSegDistanceM, feature::TAltitudes & routeAltitudesM) const; - State OnLocationPositionChanged(location::GpsInfo const & info, Index const & index); + State OnLocationPositionChanged(location::GpsInfo const & info, DataSourceBase const & index); void GetRouteFollowingInfo(location::FollowingInfo & info) const; void MatchLocationToRoute(location::GpsInfo & location, @@ -191,7 +191,7 @@ private: /// Returns a nearest speed camera record on your way and distance to it. /// Returns kInvalidSpeedCameraDistance if there is no cameras on your way. // Should be called with locked m_routingSessionMutex. - double GetDistanceToCurrentCamM(SpeedCameraRestriction & camera, Index const & index); + double GetDistanceToCurrentCamM(SpeedCameraRestriction & camera, DataSourceBase const & index); /// RemoveRoute removes m_route and resets route attributes (m_state, m_lastDistance, m_moveAwayCounter). void RemoveRoute(); diff --git a/routing/routing_tests/routing_session_test.cpp b/routing/routing_tests/routing_session_test.cpp index 132d04b8a1..72533be249 100644 --- a/routing/routing_tests/routing_session_test.cpp +++ b/routing/routing_tests/routing_session_test.cpp @@ -114,7 +114,7 @@ UNIT_TEST(TestRouteBuilding) UNIT_TEST(TestRouteRebuilding) { - Index index; + DataSource index; RoutingSession session; session.Init(nullptr, nullptr); vector<m2::PointD> routePoints = kTestRoute; @@ -172,7 +172,7 @@ UNIT_TEST(TestRouteRebuilding) UNIT_TEST(TestFollowRouteFlagPersistence) { - Index index; + DataSource index; RoutingSession session; session.Init(nullptr, nullptr); vector<m2::PointD> routePoints = kTestRoute; @@ -248,7 +248,7 @@ UNIT_TEST(TestFollowRouteFlagPersistence) UNIT_TEST(TestFollowRoutePercentTest) { - Index index; + DataSource index; RoutingSession session; session.Init(nullptr, nullptr); vector<m2::PointD> routePoints = kTestRoute; diff --git a/routing/speed_camera.cpp b/routing/speed_camera.cpp index d650c77968..233e6703df 100644 --- a/routing/speed_camera.cpp +++ b/routing/speed_camera.cpp @@ -1,8 +1,8 @@ #include "routing/speed_camera.hpp" #include "indexer/classificator.hpp" +#include "indexer/data_source.hpp" #include "indexer/ftypes_matcher.hpp" -#include "indexer/index.hpp" #include "indexer/scales.hpp" #include "coding/read_write_utils.hpp" @@ -37,7 +37,7 @@ uint8_t ReadCameraRestriction(FeatureType & ft) return 0; } -uint8_t CheckCameraInPoint(m2::PointD const & point, Index const & index) +uint8_t CheckCameraInPoint(m2::PointD const & point, DataSourceBase const & index) { uint32_t speedLimit = kNoSpeedCamera; diff --git a/routing/speed_camera.hpp b/routing/speed_camera.hpp index 29e76635f3..c6d27f0b40 100644 --- a/routing/speed_camera.hpp +++ b/routing/speed_camera.hpp @@ -4,11 +4,11 @@ #include "std/cstdint.hpp" -class Index; +class DataSourceBase; namespace routing { extern uint8_t const kNoSpeedCamera; -uint8_t CheckCameraInPoint(m2::PointD const & point, Index const & index); +uint8_t CheckCameraInPoint(m2::PointD const & point, DataSourceBase const & index); } // namespace routing diff --git a/routing/transit_graph_loader.cpp b/routing/transit_graph_loader.cpp index 722f9db6a0..08fe4c892f 100644 --- a/routing/transit_graph_loader.cpp +++ b/routing/transit_graph_loader.cpp @@ -7,6 +7,7 @@ #include "transit/transit_serdes.hpp" #include "transit/transit_types.hpp" +#include "indexer/data_source.hpp" #include "indexer/mwm_set.hpp" #include "platform/country_file.hpp" @@ -26,7 +27,7 @@ namespace routing class TransitGraphLoaderImpl : public TransitGraphLoader { public: - TransitGraphLoaderImpl(Index & index, shared_ptr<NumMwmIds> numMwmIds, + TransitGraphLoaderImpl(DataSourceBase & index, shared_ptr<NumMwmIds> numMwmIds, shared_ptr<EdgeEstimator> estimator); // TransitGraphLoader overrides. @@ -38,13 +39,13 @@ public: private: unique_ptr<TransitGraph> CreateTransitGraph(NumMwmId mwmId, IndexGraph & indexGraph) const; - Index & m_index; + DataSourceBase & m_index; shared_ptr<NumMwmIds> m_numMwmIds; shared_ptr<EdgeEstimator> m_estimator; unordered_map<NumMwmId, unique_ptr<TransitGraph>> m_graphs; }; -TransitGraphLoaderImpl::TransitGraphLoaderImpl(Index & index, shared_ptr<NumMwmIds> numMwmIds, +TransitGraphLoaderImpl::TransitGraphLoaderImpl(DataSourceBase & index, shared_ptr<NumMwmIds> numMwmIds, shared_ptr<EdgeEstimator> estimator) : m_index(index), m_numMwmIds(numMwmIds), m_estimator(estimator) { @@ -100,7 +101,7 @@ unique_ptr<TransitGraph> TransitGraphLoaderImpl::CreateTransitGraph(NumMwmId num } // static -unique_ptr<TransitGraphLoader> TransitGraphLoader::Create(Index & index, +unique_ptr<TransitGraphLoader> TransitGraphLoader::Create(DataSourceBase & index, shared_ptr<NumMwmIds> numMwmIds, shared_ptr<EdgeEstimator> estimator) { diff --git a/routing/transit_graph_loader.hpp b/routing/transit_graph_loader.hpp index a0f9d774da..e077b39848 100644 --- a/routing/transit_graph_loader.hpp +++ b/routing/transit_graph_loader.hpp @@ -6,10 +6,10 @@ #include "routing_common/num_mwm_id.hpp" -#include "indexer/index.hpp" - #include <memory> +class DataSourceBase; + namespace routing { class TransitGraphLoader @@ -20,7 +20,7 @@ public: virtual TransitGraph & GetTransitGraph(NumMwmId mwmId, IndexGraph & indexGraph) = 0; virtual void Clear() = 0; - static std::unique_ptr<TransitGraphLoader> Create(Index & index, + static std::unique_ptr<TransitGraphLoader> Create(DataSourceBase & index, std::shared_ptr<NumMwmIds> numMwmIds, std::shared_ptr<EdgeEstimator> estimator); }; diff --git a/routing/turns_generator.hpp b/routing/turns_generator.hpp index ab6d6a5785..b8c26a09a4 100644 --- a/routing/turns_generator.hpp +++ b/routing/turns_generator.hpp @@ -20,7 +20,7 @@ #include <vector> struct PathData; -class Index; +class DataSourceBase; namespace ftypes { |