diff options
author | Anatoly Serdtcev <serdtcev@maps.me> | 2019-01-22 20:06:38 +0300 |
---|---|---|
committer | Anatoly Serdtcev <serdtcev@maps.me> | 2019-01-31 14:15:44 +0300 |
commit | 1ea259ab053e2dce54eebfcb83d330a831115685 (patch) | |
tree | 0f6cad2c739dab1e59f1bec8e01fb68c99f3b6d6 /geocoder | |
parent | 3842ba3aacb979b924d063b397a19535cd3dc762 (diff) |
Fix for review
Diffstat (limited to 'geocoder')
-rw-r--r-- | geocoder/hierarchy_reader.cpp | 10 | ||||
-rw-r--r-- | geocoder/hierarchy_reader.hpp | 6 |
2 files changed, 9 insertions, 7 deletions
diff --git a/geocoder/hierarchy_reader.cpp b/geocoder/hierarchy_reader.cpp index c306e93ca6..2ac3e1ae8b 100644 --- a/geocoder/hierarchy_reader.cpp +++ b/geocoder/hierarchy_reader.cpp @@ -21,14 +21,14 @@ HierarchyReader::HierarchyReader(string const & pathToJsonHierarchy) : MYTHROW(OpenException, ("Failed to open file", pathToJsonHierarchy)); } -vector<Hierarchy::Entry> HierarchyReader::ReadEntries(size_t readerCount, ParsingStats & stats) +vector<Hierarchy::Entry> HierarchyReader::ReadEntries(size_t readersCount, ParsingStats & stats) { LOG(LINFO, ("Reading entries...")); - readerCount = max(readerCount, size_t{8}); - vector<multimap<base::GeoObjectId, Entry>> taskEntries(readerCount); + readersCount = min(readersCount, size_t{8}); + vector<multimap<base::GeoObjectId, Entry>> taskEntries(readersCount); vector<thread> tasks{}; - for (size_t t = 0; t < readerCount; ++t) + for (size_t t = 0; t < readersCount; ++t) tasks.emplace_back(&HierarchyReader::ReadEntryMap, this, ref(taskEntries[t]), ref(stats)); for (auto & reader : tasks) @@ -99,7 +99,7 @@ void HierarchyReader::ReadEntryMap(multimap<base::GeoObjectId, Entry> & entries, Entry entry; // todo(@m) We should really write uints as uints. - auto osmId = base::GeoObjectId(static_cast<uint64_t>(encodedId)); + auto const osmId = base::GeoObjectId(static_cast<uint64_t>(encodedId)); entry.m_osmId = osmId; if (!entry.DeserializeFromJSON(line, stats)) diff --git a/geocoder/hierarchy_reader.hpp b/geocoder/hierarchy_reader.hpp index d964ac7f2a..e28a318fe6 100644 --- a/geocoder/hierarchy_reader.hpp +++ b/geocoder/hierarchy_reader.hpp @@ -3,10 +3,12 @@ #include "geocoder/hierarchy.hpp" #include "base/exception.hpp" +#include "base/geo_object_id.hpp" #include <fstream> #include <map> #include <mutex> +#include <string> #include <vector> namespace geocoder @@ -19,9 +21,9 @@ public: DECLARE_EXCEPTION(OpenException, RootException); - HierarchyReader(std::string const & pathToJsonHierarchy); + explicit HierarchyReader(std::string const & pathToJsonHierarchy); - std::vector<Entry> ReadEntries(size_t readerCount, ParsingStats & stats); + std::vector<Entry> ReadEntries(size_t readersCount, ParsingStats & stats); private: void ReadEntryMap(std::multimap<base::GeoObjectId, Entry> & entries, ParsingStats & stats); |