From a68acefedc5224fce919c2b8007217a41ad39ccb Mon Sep 17 00:00:00 2001 From: Maksim Andrianov Date: Fri, 15 Nov 2019 18:50:14 +0300 Subject: [PATCH] [generator] Fixed RoutingCityBoundariesCollector. --- generator/collector_routing_city_boundaries.cpp | 10 +++++----- generator/collector_routing_city_boundaries.hpp | 6 +++--- .../collector_routing_city_boundaries_tests.cpp | 4 ++-- generator/translator_country.cpp | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/generator/collector_routing_city_boundaries.cpp b/generator/collector_routing_city_boundaries.cpp index eaba3bc4af..24a4b1d557 100644 --- a/generator/collector_routing_city_boundaries.cpp +++ b/generator/collector_routing_city_boundaries.cpp @@ -103,18 +103,18 @@ RoutingCityBoundariesCollector::LocalityData::Deserialize(ReaderSource cache) + std::string const & filename, std::shared_ptr const & cache) : CollectorInterface(filename) , m_writer(std::make_unique(GetTmpFilename())) - , m_cache(std::move(cache)) - , m_featureMakerSimple(m_cache) + , m_cache(cache) + , m_featureMakerSimple(cache) { } std::shared_ptr RoutingCityBoundariesCollector::Clone( - std::shared_ptr const &) const + std::shared_ptr const & cache) const { - return std::make_shared(GetFilename(), m_cache->Clone()); + return std::make_shared(GetFilename(), cache ? m_cache : cache); } void RoutingCityBoundariesCollector::Collect(OsmElement const & osmElement) diff --git a/generator/collector_routing_city_boundaries.hpp b/generator/collector_routing_city_boundaries.hpp index 515e371385..7f501ddd1b 100644 --- a/generator/collector_routing_city_boundaries.hpp +++ b/generator/collector_routing_city_boundaries.hpp @@ -41,11 +41,11 @@ public: }; RoutingCityBoundariesCollector(std::string const & filename, - std::shared_ptr cache); + std::shared_ptr const & cache); // CollectorInterface overrides: std::shared_ptr Clone( - std::shared_ptr const & = {}) const override; + std::shared_ptr const & cache = {}) const override; void Collect(OsmElement const & osmElement) override; void Finish() override; @@ -58,7 +58,7 @@ public: private: std::unique_ptr m_writer; - std::shared_ptr m_cache; + std::shared_ptr m_cache; FeatureMakerSimple m_featureMakerSimple; }; diff --git a/generator/generator_tests/collector_routing_city_boundaries_tests.cpp b/generator/generator_tests/collector_routing_city_boundaries_tests.cpp index 0fd60fb611..1cbb9c17e6 100644 --- a/generator/generator_tests/collector_routing_city_boundaries_tests.cpp +++ b/generator/generator_tests/collector_routing_city_boundaries_tests.cpp @@ -171,7 +171,7 @@ UNIT_CLASS_TEST(TestWithClassificator, CollectorRoutingCityBoundaries_1) auto const filename = generator_tests::GetFileName(); SCOPE_GUARD(_, std::bind(Platform::RemoveFileIfExists, std::cref(filename))); - std::shared_ptr cache; + std::shared_ptr cache; auto c1 = std::make_shared(filename, cache); Collect(*c1, {placeRelation1, placeRelation2, placeRelation3, placeRelation4}); @@ -189,7 +189,7 @@ UNIT_CLASS_TEST(TestWithClassificator, CollectorRoutingCityBoundaries_2) auto const filename = generator_tests::GetFileName(); SCOPE_GUARD(_, std::bind(Platform::RemoveFileIfExists, std::cref(filename))); - std::shared_ptr cache; + std::shared_ptr cache; auto c1 = std::make_shared(filename, cache); auto c2 = c1->Clone(); diff --git a/generator/translator_country.cpp b/generator/translator_country.cpp index 5904f6ddf3..37c763feb7 100644 --- a/generator/translator_country.cpp +++ b/generator/translator_country.cpp @@ -107,7 +107,7 @@ TranslatorCountry::TranslatorCountry(std::shared_ptr std::make_shared(info.GetIntermediateFileName(CITIES_AREAS_TMP_FILENAME))); // Collectors for gathering of additional information for the future building of routing section. collectors->Append(std::make_shared( - info.GetIntermediateFileName(ROUTING_CITY_BOUNDARIES_TMP_FILENAME), cache)); + info.GetIntermediateFileName(ROUTING_CITY_BOUNDARIES_TMP_FILENAME), cache->GetCache())); collectors->Append( std::make_shared(info.GetIntermediateFileName(MAXSPEEDS_FILENAME))); collectors->Append(std::make_shared(