diff --git a/generator/feature_sorter.cpp b/generator/feature_sorter.cpp index 9d62a2765d..97d25bf392 100644 --- a/generator/feature_sorter.cpp +++ b/generator/feature_sorter.cpp @@ -12,7 +12,8 @@ #include "indexer/feature_impl.hpp" #include "indexer/geometry_serialization.hpp" #include "indexer/scales.hpp" -#include "indexer/mwm_version.hpp" + +#include "platform/mwm_version.hpp" #include "geometry/polygon.hpp" diff --git a/indexer/data_factory.hpp b/indexer/data_factory.hpp index 34b5c76bae..12fea2dbb1 100644 --- a/indexer/data_factory.hpp +++ b/indexer/data_factory.hpp @@ -1,6 +1,7 @@ #pragma once #include "indexer/data_header.hpp" -#include "indexer/mwm_version.hpp" + +#include "platform/mwm_version.hpp" class FilesContainerR; diff --git a/indexer/data_header.hpp b/indexer/data_header.hpp index b8d3b986a9..222537750b 100644 --- a/indexer/data_header.hpp +++ b/indexer/data_header.hpp @@ -1,7 +1,8 @@ #pragma once #include "indexer/coding_params.hpp" -#include "indexer/mwm_version.hpp" + +#include "platform/mwm_version.hpp" #include "geometry/rect2d.hpp" diff --git a/indexer/features_vector.cpp b/indexer/features_vector.cpp index e1329cc85c..88627061fa 100644 --- a/indexer/features_vector.cpp +++ b/indexer/features_vector.cpp @@ -1,9 +1,9 @@ #include "features_vector.hpp" #include "features_offsets_table.hpp" -#include "mwm_version.hpp" #include "data_factory.hpp" #include "platform/constants.hpp" +#include "platform/mwm_version.hpp" void FeaturesVector::GetByIndex(uint32_t index, FeatureType & ft) const diff --git a/indexer/indexer.pro b/indexer/indexer.pro index dd251aa629..11e49e09e8 100644 --- a/indexer/indexer.pro +++ b/indexer/indexer.pro @@ -38,7 +38,6 @@ SOURCES += \ map_style_reader.cpp \ mercator.cpp \ mwm_set.cpp \ - mwm_version.cpp \ old/feature_loader_101.cpp \ point_to_int64.cpp \ scale_index.cpp \ @@ -86,7 +85,6 @@ HEADERS += \ map_style_reader.hpp \ mercator.hpp \ mwm_set.hpp \ - mwm_version.hpp \ old/feature_loader_101.hpp \ old/interval_index_101.hpp \ point_to_int64.hpp \ diff --git a/indexer/mwm_set.hpp b/indexer/mwm_set.hpp index aef8e4d977..e952a21c3c 100644 --- a/indexer/mwm_set.hpp +++ b/indexer/mwm_set.hpp @@ -1,9 +1,8 @@ #pragma once -#include "indexer/mwm_version.hpp" - #include "platform/country_file.hpp" #include "platform/local_country_file.hpp" +#include "platform/mwm_version.hpp" #include "geometry/rect2d.hpp" diff --git a/map/framework.cpp b/map/framework.cpp index 54f0b17707..d8cad58503 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -32,7 +32,6 @@ #include "indexer/drawing_rules.hpp" #include "indexer/feature.hpp" #include "indexer/map_style_reader.hpp" -#include "indexer/mwm_version.hpp" #include "indexer/scales.hpp" /// @todo Probably it's better to join this functionality. @@ -47,6 +46,7 @@ #include "platform/local_country_file_utils.hpp" #include "platform/measurement_utils.hpp" +#include "platform/mwm_version.hpp" #include "platform/platform.hpp" #include "platform/preferred_languages.hpp" #include "platform/settings.hpp" diff --git a/indexer/mwm_version.cpp b/platform/mwm_version.cpp similarity index 89% rename from indexer/mwm_version.cpp rename to platform/mwm_version.cpp index 7a641cee42..2796860b21 100644 --- a/indexer/mwm_version.cpp +++ b/platform/mwm_version.cpp @@ -1,4 +1,4 @@ -#include "indexer/mwm_version.hpp" +#include "mwm_version.hpp" #include "coding/file_container.hpp" #include "coding/reader_wrapper.hpp" @@ -67,4 +67,14 @@ bool ReadVersion(FilesContainerR const & container, MwmVersion & version) ReadVersionT(src, version); return true; } + +uint32_t ReadVersionTimestamp(ModelReaderPtr const & reader) +{ + MwmVersion version; + if (!ReadVersion(FilesContainerR(reader), version)) + return 0; + + return version.timestamp; +} + } // namespace version diff --git a/indexer/mwm_version.hpp b/platform/mwm_version.hpp similarity index 87% rename from indexer/mwm_version.hpp rename to platform/mwm_version.hpp index b189d9ff04..5dd106fed3 100644 --- a/indexer/mwm_version.hpp +++ b/platform/mwm_version.hpp @@ -5,6 +5,7 @@ class FilesContainerR; class ReaderSrc; class Writer; +class ModelReaderPtr; namespace version { @@ -37,4 +38,7 @@ void ReadVersion(ReaderSrc & src, MwmVersion & version); /// otherwise returns false. In the latter case version is /// unchanged. bool ReadVersion(FilesContainerR const & container, MwmVersion & version); + +/// Helper function that is usend in FindAllLocalMaps. +uint32_t ReadVersionTimestamp(ModelReaderPtr const & reader); } // namespace version diff --git a/platform/platform.pro b/platform/platform.pro index d5d88f6489..71be1f2ba2 100644 --- a/platform/platform.pro +++ b/platform/platform.pro @@ -74,6 +74,7 @@ HEADERS += \ local_country_file_utils.hpp \ location.hpp \ measurement_utils.hpp \ + mwm_version.hpp \ platform.hpp \ preferred_languages.hpp \ servers_list.hpp \ @@ -90,6 +91,7 @@ SOURCES += \ local_country_file.cpp \ local_country_file_utils.cpp \ measurement_utils.cpp \ + mwm_version.cpp \ platform.cpp \ preferred_languages.cpp \ servers_list.cpp \ diff --git a/routing/cross_mwm_router.hpp b/routing/cross_mwm_router.hpp index ef9b94b613..6df20a05ea 100644 --- a/routing/cross_mwm_router.hpp +++ b/routing/cross_mwm_router.hpp @@ -2,7 +2,7 @@ #include "osrm_engine.hpp" #include "router.hpp" -#include "routing_mapping.h" +#include "routing_mapping.hpp" #include "std/string.hpp" #include "std/vector.hpp" diff --git a/routing/online_absent_fetcher.hpp b/routing/online_absent_fetcher.hpp index 80fdcaa9b2..0a91cd841b 100644 --- a/routing/online_absent_fetcher.hpp +++ b/routing/online_absent_fetcher.hpp @@ -1,8 +1,6 @@ #pragma once -#include "route.hpp" -#include "router.hpp" -#include "routing_mapping.h" +#include "routing_mapping.hpp" #include "geometry/point2d.hpp" @@ -11,6 +9,7 @@ #include "std/string.hpp" #include "std/unique_ptr.hpp" + namespace routing { using TCountryLocalFileFn = function(string const &)>; diff --git a/routing/osrm_router.hpp b/routing/osrm_router.hpp index d5b4a83317..2b2d098cc4 100644 --- a/routing/osrm_router.hpp +++ b/routing/osrm_router.hpp @@ -1,23 +1,15 @@ #pragma once -#include "routing/osrm2feature_map.hpp" #include "routing/osrm_data_facade.hpp" #include "routing/osrm_engine.hpp" #include "routing/route.hpp" #include "routing/router.hpp" -#include "routing/routing_mapping.h" - -#include "indexer/index.hpp" -#include "base/mutex.hpp" - -#include "std/atomic.hpp" -#include "std/function.hpp" -#include "std/numeric.hpp" -#include "std/queue.hpp" +#include "routing/routing_mapping.hpp" namespace feature { class TypesHolder; } +class Index; struct RawRouteData; struct PhantomNode; struct PathData; diff --git a/routing/road_graph_router.cpp b/routing/road_graph_router.cpp index 81dc0c3fbd..b937e5eb16 100644 --- a/routing/road_graph_router.cpp +++ b/routing/road_graph_router.cpp @@ -10,10 +10,10 @@ #include "indexer/feature.hpp" #include "indexer/ftypes_matcher.hpp" #include "indexer/index.hpp" -#include "indexer/mwm_version.hpp" #include "platform/country_file.hpp" #include "platform/local_country_file.hpp" +#include "platform/mwm_version.hpp" #include "geometry/distance.hpp" diff --git a/routing/routing.pro b/routing/routing.pro index 9348f704ea..32c6f342a9 100644 --- a/routing/routing.pro +++ b/routing/routing.pro @@ -68,7 +68,7 @@ HEADERS += \ router.hpp \ router_delegate.hpp \ routing_algorithm.hpp \ - routing_mapping.h \ + routing_mapping.hpp \ routing_session.hpp \ routing_settings.hpp \ turns.hpp \ diff --git a/routing/routing_mapping.cpp b/routing/routing_mapping.cpp index 8adeb0d66c..578cec1025 100644 --- a/routing/routing_mapping.cpp +++ b/routing/routing_mapping.cpp @@ -1,23 +1,24 @@ -#include "routing/routing_mapping.h" +#include "routing_mapping.hpp" #include "routing/cross_routing_context.hpp" #include "routing/osrm2feature_map.hpp" #include "routing/osrm_data_facade.hpp" -#include "base/logging.hpp" +#include "platform/country_file.hpp" +#include "platform/local_country_file.hpp" +#include "platform/mwm_version.hpp" +#include "platform/platform.hpp" #include "coding/reader_wrapper.hpp" -#include "indexer/mwm_version.hpp" +#include "base/logging.hpp" -#include "platform/country_file.hpp" -#include "platform/local_country_file.hpp" -#include "platform/platform.hpp" using platform::CountryFile; using platform::LocalCountryFile; -namespace { +namespace +{ /*! * \brief CheckMwmConsistency checks versions of mwm and routing files. * \param localFile reference to country file we need to check. diff --git a/routing/routing_mapping.h b/routing/routing_mapping.hpp similarity index 100% rename from routing/routing_mapping.h rename to routing/routing_mapping.hpp diff --git a/routing/routing_tests/routing_mapping_test.cpp b/routing/routing_tests/routing_mapping_test.cpp index 8a53732534..2ab460f6f4 100644 --- a/routing/routing_tests/routing_mapping_test.cpp +++ b/routing/routing_tests/routing_mapping_test.cpp @@ -1,10 +1,10 @@ #include "testing/testing.hpp" #include "indexer/indexer_tests/test_mwm_set.hpp" -#include "routing/routing_mapping.h" - #include "map/feature_vec_model.hpp" +#include "routing/routing_mapping.hpp" + #include "platform/country_file.hpp" #include "platform/local_country_file.hpp" #include "platform/platform.hpp" diff --git a/routing/turns_generator.cpp b/routing/turns_generator.cpp index 3f2f21e0e1..ac205460a0 100644 --- a/routing/turns_generator.cpp +++ b/routing/turns_generator.cpp @@ -1,8 +1,7 @@ -#include "routing/routing_mapping.h" -#include "routing/turns_generator.hpp" -#include "routing/car_model.hpp" +#include "turns_generator.hpp" -#include "search/house_detector.hpp" +#include "routing/car_model.hpp" +#include "routing/routing_mapping.hpp" #include "indexer/ftypes_matcher.hpp" #include "indexer/scales.hpp" @@ -16,6 +15,7 @@ #include "std/numeric.hpp" #include "std/string.hpp" + using namespace routing; using namespace routing::turns;