diff options
author | tatiana-yan <tatiana.kondakova@gmail.com> | 2018-07-25 18:33:24 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2018-07-30 12:36:04 +0300 |
commit | c9d9c562b3a473dfde82ef1ccfbd1cbb62b874ee (patch) | |
tree | 6d7c3539e217873d3fac351a31efc213199180ee /indexer | |
parent | b23a973a4347c031242f40e2d02d5de910d51f62 (diff) |
[indexer] Review fixes
Diffstat (limited to 'indexer')
-rw-r--r-- | indexer/feature.cpp | 232 | ||||
-rw-r--r-- | indexer/feature.hpp | 46 | ||||
-rw-r--r-- | indexer/feature_data.cpp | 6 | ||||
-rw-r--r-- | indexer/feature_data.hpp | 44 | ||||
-rw-r--r-- | indexer/features_vector.cpp | 4 | ||||
-rw-r--r-- | indexer/features_vector.hpp | 11 | ||||
-rw-r--r-- | indexer/ftypes_matcher.hpp | 4 | ||||
-rw-r--r-- | indexer/scale_index_builder.hpp | 1 | ||||
-rw-r--r-- | indexer/shared_load_info.cpp | 4 | ||||
-rw-r--r-- | indexer/shared_load_info.hpp | 3 |
10 files changed, 175 insertions, 180 deletions
diff --git a/indexer/feature.cpp b/indexer/feature.cpp index 0a59fd327c..d4305ca7e0 100644 --- a/indexer/feature.cpp +++ b/indexer/feature.cpp @@ -33,7 +33,7 @@ using namespace std; namespace { -uint32_t constexpr kInvalidOffset = static_cast<uint32_t>(-1); +uint32_t constexpr kInvalidOffset = numeric_limits<uint32_t>::max(); // Get the index for geometry serialization. // @param[in] scale: @@ -55,8 +55,10 @@ int GetScaleIndex(SharedLoadInfo const & loadInfo, int scale) case FeatureType::BEST_GEOMETRY: return count - 1; default: for (int i = 0; i < count; ++i) + { if (scale <= loadInfo.GetScale(i)) return i; + } return -1; } } @@ -101,15 +103,14 @@ int GetScaleIndex(SharedLoadInfo const & loadInfo, int scale, if (ind >= 0 && ind < count) return ind; - else - { - ASSERT(false, ("Feature should have any geometry ...")); - return -1; - } + + ASSERT(false, ("Feature should have any geometry ...")); + return -1; } uint32_t CalcOffset(ArrayByteSource const & source, FeatureType::Buffer const data) { + ASSERT_GREATER_OR_EQUAL(source.PtrC(), data, ()); return static_cast<uint32_t>(source.PtrC() - data); } @@ -179,8 +180,9 @@ uint8_t ReadByte(TSource & src) } } // namespace -void FeatureType::Deserialize(const SharedLoadInfo * loadInfo, Buffer buffer) +void FeatureType::Deserialize(SharedLoadInfo const * loadInfo, Buffer buffer) { + CHECK(loadInfo, ()); m_loadInfo = loadInfo; m_data = buffer; m_header = Header(m_data); @@ -202,13 +204,12 @@ feature::EGeomType FeatureType::GetFeatureType() const } } -void FeatureType::SetTypes(uint32_t const (&types)[feature::kMaxTypesCount], uint32_t count) +void FeatureType::SetTypes(array<uint32_t, feature::kMaxTypesCount> const & types, uint32_t count) { ASSERT_GREATER_OR_EQUAL(count, 1, ("Must be one type at least.")); ASSERT_LESS(count, feature::kMaxTypesCount, ("Too many types for feature")); - if (count >= feature::kMaxTypesCount) - count = feature::kMaxTypesCount - 1; - fill(begin(m_types), end(m_types), 0); + count = min(count, static_cast<uint32_t>(feature::kMaxTypesCount - 1)); + m_types.fill(0); copy_n(begin(types), count, begin(m_types)); auto value = static_cast<uint8_t>((count - 1) & feature::HEADER_TYPE_MASK); m_header = (m_header & (~feature::HEADER_TYPE_MASK)) | value; @@ -216,54 +217,55 @@ void FeatureType::SetTypes(uint32_t const (&types)[feature::kMaxTypesCount], uin void FeatureType::ParseTypes() { - if (!m_parsed.m_types) - { - Classificator & c = classif(); - ArrayByteSource source(m_data + m_offsets.m_types); + if (m_parsed.m_types) + return; - size_t const count = GetTypesCount(); - uint32_t index = 0; - try - { - for (size_t i = 0; i < count; ++i) - { - index = ReadVarUint<uint32_t>(source); - m_types[i] = c.GetTypeForIndex(index); - } - } - catch (std::out_of_range const & ex) + auto const typesOffset = sizeof(m_header); + Classificator & c = classif(); + ArrayByteSource source(m_data + typesOffset); + + size_t const count = GetTypesCount(); + uint32_t index = 0; + try + { + for (size_t i = 0; i < count; ++i) { - LOG(LERROR, ("Incorrect type index for feature.FeatureID:", m_id, ". Incorrect index:", index, - ". Loaded feature types:", m_types, ". Total count of types:", count, - ". Header:", m_header, ". Exception:", ex.what())); - throw; + index = ReadVarUint<uint32_t>(source); + m_types[i] = c.GetTypeForIndex(index); } - m_offsets.m_common = CalcOffset(source, m_data); - - m_parsed.m_types = true; } + catch (std::out_of_range const & ex) + { + LOG(LERROR, ("Incorrect type index for feature.FeatureID:", m_id, ". Incorrect index:", index, + ". Loaded feature types:", m_types, ". Total count of types:", count, + ". Header:", m_header)); + throw; + } + + m_offsets.m_common = CalcOffset(source, m_data); + m_parsed.m_types = true; } void FeatureType::ParseCommon() { - if (!m_parsed.m_common) - { - ParseTypes(); - - ArrayByteSource source(m_data + m_offsets.m_common); + if (m_parsed.m_common) + return; - uint8_t const h = Header(m_data); - m_params.Read(source, h); + CHECK(m_loadInfo, ()); + ParseTypes(); - if (GetFeatureType() == GEOM_POINT) - { - m_center = serial::LoadPoint(source, m_loadInfo->GetDefGeometryCodingParams()); - m_limitRect.Add(m_center); - } - m_offsets.m_header2 = CalcOffset(source, m_data); + ArrayByteSource source(m_data + m_offsets.m_common); + uint8_t const h = Header(m_data); + m_params.Read(source, h); - m_parsed.m_common = true; + if (GetFeatureType() == GEOM_POINT) + { + m_center = serial::LoadPoint(source, m_loadInfo->GetDefGeometryCodingParams()); + m_limitRect.Add(m_center); } + + m_offsets.m_header2 = CalcOffset(source, m_data); + m_parsed.m_common = true; } m2::PointD FeatureType::GetCenter() @@ -275,7 +277,7 @@ m2::PointD FeatureType::GetCenter() int8_t FeatureType::GetLayer() { - if (!(m_header & feature::HEADER_HAS_LAYER)) + if ((m_header & feature::HEADER_HAS_LAYER) == 0) return 0; ParseCommon(); @@ -331,79 +333,74 @@ void FeatureType::ParseEverything() void FeatureType::ParseHeader2() { - if (!m_parsed.m_header2) - { - ParseCommon(); + if (m_parsed.m_header2) + return; - uint8_t ptsCount = 0, ptsMask = 0, trgCount = 0, trgMask = 0; + CHECK(m_loadInfo, ()); + ParseCommon(); - BitSource bitSource(m_data + m_offsets.m_header2); + uint8_t ptsCount = 0, ptsMask = 0, trgCount = 0, trgMask = 0; + BitSource bitSource(m_data + m_offsets.m_header2); + uint8_t const typeMask = Header(m_data) & HEADER_GEOTYPE_MASK; - uint8_t const typeMask = Header(m_data) & HEADER_GEOTYPE_MASK; - if (typeMask == HEADER_GEOM_LINE) - { - ptsCount = bitSource.Read(4); - if (ptsCount == 0) - ptsMask = bitSource.Read(4); - else - ASSERT_GREATER(ptsCount, 1, ()); - } - else if (typeMask == HEADER_GEOM_AREA) - { - trgCount = bitSource.Read(4); - if (trgCount == 0) - trgMask = bitSource.Read(4); - } - - ArrayByteSource src(bitSource.RoundPtr()); + if (typeMask == HEADER_GEOM_LINE) + { + ptsCount = bitSource.Read(4); + if (ptsCount == 0) + ptsMask = bitSource.Read(4); + else + ASSERT_GREATER(ptsCount, 1, ()); + } + else if (typeMask == HEADER_GEOM_AREA) + { + trgCount = bitSource.Read(4); + if (trgCount == 0) + trgMask = bitSource.Read(4); + } - serial::GeometryCodingParams const & cp = m_loadInfo->GetDefGeometryCodingParams(); + ArrayByteSource src(bitSource.RoundPtr()); + serial::GeometryCodingParams const & cp = m_loadInfo->GetDefGeometryCodingParams(); - if (typeMask == HEADER_GEOM_LINE) + if (typeMask == HEADER_GEOM_LINE) + { + if (ptsCount > 0) { - if (ptsCount > 0) - { - int const count = (ptsCount - 2 + 3) / 4; - ASSERT_LESS(count, 4, ()); + int const count = ((ptsCount - 2) + 4 - 1) / 4; + ASSERT_LESS(count, 4, ()); - for (int i = 0; i < count; ++i) - { - uint32_t mask = ReadByte(src); - m_ptsSimpMask += (mask << (i << 3)); - } - - char const * start = src.PtrC(); - - src = ArrayByteSource(serial::LoadInnerPath(start, ptsCount, cp, m_points)); - - m_innerStats.m_points = static_cast<uint32_t>(src.PtrC() - start); - } - else + for (int i = 0; i < count; ++i) { - m_points.push_back(serial::LoadPoint(src, cp)); - - ReadOffsets(*m_loadInfo, src, ptsMask, m_offsets.m_pts); + uint32_t mask = ReadByte(src); + m_ptsSimpMask += (mask << (i << 3)); } + + char const * start = src.PtrC(); + src = ArrayByteSource(serial::LoadInnerPath(start, ptsCount, cp, m_points)); + m_innerStats.m_points = static_cast<uint32_t>(src.PtrC() - start); } - else if (typeMask == HEADER_GEOM_AREA) + else { - if (trgCount > 0) - { - trgCount += 2; - - char const * start = static_cast<char const *>(src.PtrC()); - src = ArrayByteSource(serial::LoadInnerTriangles(start, trgCount, cp, m_triangles)); - m_innerStats.m_strips = static_cast<uint32_t>(src.PtrC() - start); - } - else - { - ReadOffsets(*m_loadInfo, src, trgMask, m_offsets.m_trg); - } + m_points.emplace_back(serial::LoadPoint(src, cp)); + ReadOffsets(*m_loadInfo, src, ptsMask, m_offsets.m_pts); } - m_innerStats.m_size = static_cast<uint32_t>(src.PtrC() - m_data); + } + else if (typeMask == HEADER_GEOM_AREA) + { + if (trgCount > 0) + { + trgCount += 2; - m_parsed.m_header2 = true; + char const * start = static_cast<char const *>(src.PtrC()); + src = ArrayByteSource(serial::LoadInnerTriangles(start, trgCount, cp, m_triangles)); + m_innerStats.m_strips = CalcOffset(src, start); + } + else + { + ReadOffsets(*m_loadInfo, src, trgMask, m_offsets.m_trg); + } } + m_innerStats.m_size = CalcOffset(src, m_data); + m_parsed.m_header2 = true; } void FeatureType::ResetGeometry() @@ -425,6 +422,7 @@ uint32_t FeatureType::ParseGeometry(int scale) uint32_t sz = 0; if (!m_parsed.m_points) { + CHECK(m_loadInfo, ()); ParseHeader2(); if ((Header(m_data) & HEADER_GEOTYPE_MASK) == HEADER_GEOM_LINE) @@ -458,14 +456,14 @@ uint32_t FeatureType::ParseGeometry(int scale) int const scaleIndex = GetScaleIndex(*m_loadInfo, scale); ASSERT_LESS(scaleIndex, m_loadInfo->GetScalesCount(), ()); - points.push_back(m_points.front()); + points.emplace_back(m_points.front()); for (size_t i = 1; i + 1 < count; ++i) { // check for point visibility in needed scaleIndex if (static_cast<int>((m_ptsSimpMask >> (2 * (i - 1))) & 0x3) <= scaleIndex) - points.push_back(m_points[i]); + points.emplace_back(m_points[i]); } - points.push_back(m_points.back()); + points.emplace_back(m_points.back()); m_points.swap(points); } @@ -482,6 +480,7 @@ uint32_t FeatureType::ParseTriangles(int scale) uint32_t sz = 0; if (!m_parsed.m_triangles) { + CHECK(m_loadInfo, ()); ParseHeader2(); if ((Header(m_data) & HEADER_GEOTYPE_MASK) == HEADER_GEOM_AREA) @@ -511,6 +510,7 @@ void FeatureType::ParseMetadata() if (m_parsed.m_metadata) return; + CHECK(m_loadInfo, ()); try { struct TMetadataIndexEntry @@ -561,9 +561,9 @@ void FeatureType::SetNames(StringUtf8Multilang const & newNames) }); if (m_params.name.IsEmpty()) - m_header = ~feature::HEADER_HAS_NAME & m_header; + m_header = m_header & ~feature::HEADER_HAS_NAME; else - m_header = feature::HEADER_HAS_NAME | m_header; + m_header = m_header | feature::HEADER_HAS_NAME; } void FeatureType::SetMetadata(feature::Metadata const & newMetadata) @@ -708,7 +708,7 @@ m2::PointD const & FeatureType::GetPoint(size_t i) const vector<m2::PointD> FeatureType::GetTriangesAsPoints(int scale) { ParseTriangles(scale); - return {std::begin(m_triangles), std::end(m_triangles)}; + return {m_triangles.begin(), m_triangles.end()}; } void FeatureType::ParseGeometryAndTriangles(int scale) @@ -837,3 +837,9 @@ string FeatureType::GetRoadNumber() ParseCommon(); return m_params.ref; } + +feature::Metadata & FeatureType::GetMetadata() +{ + ParseMetadata(); + return m_metadata; +} diff --git a/indexer/feature.hpp b/indexer/feature.hpp index d7818efa95..277ef4ca92 100644 --- a/indexer/feature.hpp +++ b/indexer/feature.hpp @@ -8,6 +8,7 @@ #include "base/buffer_vector.hpp" +#include <array> #include <cstdint> #include <functional> #include <iterator> @@ -32,7 +33,7 @@ public: using Buffer = char const *; using GeometryOffsets = buffer_vector<uint32_t, feature::DataHeader::MAX_SCALES_COUNT>; - void Deserialize(const feature::SharedLoadInfo * loadInfo, Buffer buffer); + void Deserialize(feature::SharedLoadInfo const * loadInfo, Buffer buffer); feature::EGeomType GetFeatureType() const; FeatureParamsBase & GetParams() { return m_params; } @@ -40,8 +41,7 @@ public: uint8_t GetTypesCount() const { return (m_header & feature::HEADER_TYPE_MASK) + 1; } bool HasName() const { return (m_header & feature::HEADER_HAS_NAME) != 0; } - - void SetTypes(uint32_t const (&types)[feature::kMaxTypesCount], uint32_t count); + StringUtf8Multilang const & GetNames(); m2::PointD GetCenter(); @@ -52,7 +52,7 @@ public: return false; ParseCommon(); - m_params.name.ForEach(forward<T>(fn)); + m_params.name.ForEach(std::forward<T>(fn)); return true; } @@ -72,10 +72,12 @@ public: //@{ /// Apply changes from UI for edited or newly created features. /// Replaces all FeatureType's components. + std::vector<m2::PointD> GetTriangesAsPoints(int scale); + void ReplaceBy(osm::EditableMapObject const & ef); - StringUtf8Multilang const & GetNames(); void SetNames(StringUtf8Multilang const & newNames); + void SetTypes(std::array<uint32_t, feature::kMaxTypesCount> const & types, uint32_t count); void SetMetadata(feature::Metadata const & newMetadata); void UpdateHeader(bool commonParsed, bool metadataParsed); @@ -90,7 +92,7 @@ public: void SetID(FeatureID const & id) { m_id = id; } FeatureID const & GetID() const { return m_id; } - /// @name Parse functions. Do simple dispatching to m_loader. + /// @name Parse functions. //@{ /// Super-method to call all possible Parse* methods. void ParseEverything(); @@ -143,13 +145,11 @@ public: } } - std::vector<m2::PointD> GetTriangesAsPoints(int scale); - template <typename Functor> void ForEachTriangleEx(Functor && f, int scale) const { f.StartPrimitive(m_triangles.size()); - ForEachTriangle(forward<Functor>(f), scale); + ForEachTriangle(std::forward<Functor>(f), scale); f.EndPrimitive(); } //@} @@ -172,7 +172,6 @@ public: void GetReadableName(std::string & name); void GetReadableName(bool allowTranslit, int8_t deviceLang, std::string & name); - static int8_t const DEFAULT_LANG = StringUtf8Multilang::kDefaultCode; bool GetName(int8_t lang, std::string & name); //@} @@ -180,11 +179,7 @@ public: uint64_t GetPopulation(); std::string GetRoadNumber(); - feature::Metadata & GetMetadata() - { - ParseMetadata(); - return m_metadata; - } + feature::Metadata & GetMetadata(); /// @name Statistic functions. //@{ @@ -192,7 +187,7 @@ public: struct InnerGeomStat { - uint32_t m_points, m_strips, m_size; + uint32_t m_points = 0, m_strips = 0, m_size = 0; void MakeZero() { @@ -204,11 +199,9 @@ public: struct GeomStat { - uint32_t m_size, m_count; + uint32_t m_size = 0, m_count = 0; GeomStat(uint32_t sz, size_t count) : m_size(sz), m_count(static_cast<uint32_t>(count)) {} - - GeomStat() : m_size(0), m_count(0) {} }; GeomStat GetGeometrySize(int scale); @@ -230,7 +223,6 @@ private: struct Offsets { - static uint32_t const m_types = 1; uint32_t m_common = 0; uint32_t m_header2 = 0; GeometryOffsets m_pts; @@ -251,7 +243,7 @@ private: void ParseGeometryAndTriangles(int scale); uint8_t m_header = 0; - uint32_t m_types[feature::kMaxTypesCount]; + std::array<uint32_t, feature::kMaxTypesCount> m_types; FeatureID m_id; FeatureParamsBase m_params; @@ -261,17 +253,19 @@ private: // For better result this value should be greater than 17 // (number of points in inner triangle-strips). - static const size_t static_buffer = 32; - using Points = buffer_vector<m2::PointD, static_buffer>; + static const size_t kStaticBufferSize = 32; + using Points = buffer_vector<m2::PointD, kStaticBufferSize>; Points m_points, m_triangles; feature::Metadata m_metadata; - const feature::SharedLoadInfo * m_loadInfo; - Buffer m_data = 0; + // Non-owning pointer to shared load info. SharedLoadInfo created once per FeaturesVector. + feature::SharedLoadInfo const * m_loadInfo = nullptr; + // Raw pointer to data buffer. + Buffer m_data = nullptr; ParsedFlags m_parsed; Offsets m_offsets; - uint32_t m_ptsSimpMask; + uint32_t m_ptsSimpMask = 0; InnerGeomStat m_innerStats; }; diff --git a/indexer/feature_data.cpp b/indexer/feature_data.cpp index 9fc472137d..2ed70c18e3 100644 --- a/indexer/feature_data.cpp +++ b/indexer/feature_data.cpp @@ -27,7 +27,7 @@ string DebugPrint(TypesHolder const & holder) { Classificator const & c = classif(); string s; - for (uint32_t type : holder) + for (uint32_t const type : holder) s += c.GetReadableObjectName(type) + " "; if (!s.empty()) s.pop_back(); @@ -172,13 +172,13 @@ void TypesHolder::SortBySpec() // Put "very common" types to the end of possible PP-description types. static UselessTypesChecker checker; - UNUSED_VALUE(RemoveIfKeepValid(m_types, m_types + m_size, [](uint32_t t) { return checker(t); })); + UNUSED_VALUE(RemoveIfKeepValid(begin(), end(), [](uint32_t t) { return checker(t); })); } vector<string> TypesHolder::ToObjectNames() const { vector<string> result; - for (auto type : *this) + for (auto const type : *this) result.push_back(classif().GetReadableObjectName(type)); return result; } diff --git a/indexer/feature_data.hpp b/indexer/feature_data.hpp index b6761bbdcb..08dc50b19d 100644 --- a/indexer/feature_data.hpp +++ b/indexer/feature_data.hpp @@ -9,9 +9,10 @@ #include "coding/value_opt_string.hpp" #include "std/algorithm.hpp" +#include "std/array.hpp" #include "std/string.hpp" -#include "std/vector.hpp" #include "std/utility.hpp" +#include "std/vector.hpp" struct FeatureParamsBase; class FeatureType; @@ -51,6 +52,8 @@ namespace feature class TypesHolder { public: + using Types = array<uint32_t, kMaxTypesCount>; + TypesHolder() = default; explicit TypesHolder(EGeomType geoType) : m_geoType(geoType) {} explicit TypesHolder(FeatureType & f); @@ -71,38 +74,33 @@ namespace feature /// @name Selectors. //@{ - inline EGeomType GetGeoType() const { return m_geoType; } + EGeomType GetGeoType() const { return m_geoType; } - inline size_t Size() const { return m_size; } - inline bool Empty() const { return (m_size == 0); } - inline uint32_t const * begin() const { return m_types; } - inline uint32_t const * end() const { return m_types + m_size; } + size_t Size() const { return m_size; } + bool Empty() const { return (m_size == 0); } + Types::const_iterator begin() const { return m_types.cbegin(); } + Types::const_iterator end() const { return m_types.cbegin() + m_size; } + Types::iterator begin() { return m_types.begin(); } + Types::iterator end() { return m_types.begin() + m_size; } /// Assume that m_types is already sorted by SortBySpec function. - inline uint32_t GetBestType() const + uint32_t GetBestType() const { // 0 - is an empty type. return (m_size > 0 ? m_types[0] : 0); } - inline bool Has(uint32_t t) const - { - return (find(begin(), end(), t) != end()); - } + bool Has(uint32_t t) const { return (find(begin(), end(), t) != end()); } //@} template <class TFn> bool RemoveIf(TFn && fn) { - if (m_size > 0) - { - size_t const oldSize = m_size; + size_t const oldSize = m_size; - uint32_t * e = remove_if(m_types, m_types + m_size, forward<TFn>(fn)); - m_size = distance(m_types, e); + auto const e = remove_if(begin(), end(), forward<TFn>(fn)); + m_size = distance(begin(), e); - return (m_size != oldSize); - } - return false; + return (m_size != oldSize); } void Remove(uint32_t type); @@ -117,7 +115,7 @@ namespace feature vector<string> ToObjectNames() const; private: - uint32_t m_types[kMaxTypesCount]; + Types m_types; size_t m_size = 0; EGeomType m_geoType = GEOM_UNDEFINED; @@ -248,7 +246,7 @@ public: /// Assign parameters except geometry type. /// Geometry is independent state and it's set by FeatureType's geometry functions. - inline void SetParams(FeatureParams const & rhs) + void SetParams(FeatureParams const & rhs) { BaseT::operator=(rhs); @@ -257,13 +255,13 @@ public: m_metadata = rhs.m_metadata; } - inline bool IsValid() const { return !m_Types.empty(); } + bool IsValid() const { return !m_Types.empty(); } void SetGeomType(feature::EGeomType t); void SetGeomTypePointEx(); feature::EGeomType GetGeomType() const; - inline void AddType(uint32_t t) { m_Types.push_back(t); } + void AddType(uint32_t t) { m_Types.push_back(t); } /// Special function to replace a regular railway station type with /// the special subway type for the correspondent city. diff --git a/indexer/features_vector.cpp b/indexer/features_vector.cpp index 233862eb32..33b7828043 100644 --- a/indexer/features_vector.cpp +++ b/indexer/features_vector.cpp @@ -10,8 +10,8 @@ void FeaturesVector::GetByIndex(uint32_t index, FeatureType & ft) const { uint32_t offset = 0, size = 0; auto const ftOffset = m_table ? m_table->GetFeatureOffset(index) : index; - m_RecordReader.ReadRecord(ftOffset, m_buffer, offset, size); - ft.Deserialize(&m_LoadInfo, &m_buffer[offset]); + m_recordReader.ReadRecord(ftOffset, m_buffer, offset, size); + ft.Deserialize(&m_loadInfo, &m_buffer[offset]); } size_t FeaturesVector::GetNumFeatures() const diff --git a/indexer/features_vector.hpp b/indexer/features_vector.hpp index 38d4915874..854e752863 100644 --- a/indexer/features_vector.hpp +++ b/indexer/features_vector.hpp @@ -17,7 +17,7 @@ class FeaturesVector public: FeaturesVector(FilesContainerR const & cont, feature::DataHeader const & header, feature::FeaturesOffsetsTable const * table) - : m_LoadInfo(cont, header), m_RecordReader(m_LoadInfo.GetDataReader(), 256), m_table(table) + : m_loadInfo(cont, header), m_recordReader(m_loadInfo.GetDataReader(), 256), m_table(table) { } @@ -28,10 +28,9 @@ public: template <class ToDo> void ForEach(ToDo && toDo) const { uint32_t index = 0; - m_RecordReader.ForEachRecord([&] (uint32_t pos, char const * data, uint32_t /*size*/) - { + m_recordReader.ForEachRecord([&](uint32_t pos, char const * data, uint32_t /*size*/) { FeatureType ft; - ft.Deserialize(&m_LoadInfo, data); + ft.Deserialize(&m_loadInfo, data); // We can't properly set MwmId here, because FeaturesVector // works with FileContainerR, not with MwmId/MwmHandle/MwmValue. @@ -54,8 +53,8 @@ public: private: friend class FeaturesVectorTest; - feature::SharedLoadInfo m_LoadInfo; - VarRecordReader<FilesContainerR::TReader, &VarRecordSizeReaderVarint> m_RecordReader; + feature::SharedLoadInfo m_loadInfo; + VarRecordReader<FilesContainerR::TReader, &VarRecordSizeReaderVarint> m_recordReader; mutable vector<char> m_buffer; feature::FeaturesOffsetsTable const * m_table; }; diff --git a/indexer/ftypes_matcher.hpp b/indexer/ftypes_matcher.hpp index f43466acb6..3ecb88257e 100644 --- a/indexer/ftypes_matcher.hpp +++ b/indexer/ftypes_matcher.hpp @@ -38,9 +38,9 @@ protected: public: virtual bool IsMatched(uint32_t type) const; - bool operator() (feature::TypesHolder const & types) const; + bool operator()(feature::TypesHolder const & types) const; bool operator()(FeatureType & ft) const; - bool operator() (std::vector<uint32_t> const & types) const; + bool operator()(std::vector<uint32_t> const & types) const; static uint32_t PrepareToMatch(uint32_t type, uint8_t level); diff --git a/indexer/scale_index_builder.hpp b/indexer/scale_index_builder.hpp index 78c74eca24..0af8825d63 100644 --- a/indexer/scale_index_builder.hpp +++ b/indexer/scale_index_builder.hpp @@ -20,6 +20,7 @@ #include "base/macros.hpp" #include "base/scope_guard.hpp" +#include "std/algorithm.hpp" #include "std/string.hpp" #include "std/type_traits.hpp" #include "std/utility.hpp" diff --git a/indexer/shared_load_info.cpp b/indexer/shared_load_info.cpp index 9f8c9b6133..6278d8fb51 100644 --- a/indexer/shared_load_info.cpp +++ b/indexer/shared_load_info.cpp @@ -6,10 +6,6 @@ namespace feature { -//////////////////////////////////////////////////////////////////////////////////////////// -// SharedLoadInfo implementation. -//////////////////////////////////////////////////////////////////////////////////////////// - SharedLoadInfo::SharedLoadInfo(FilesContainerR const & cont, DataHeader const & header) : m_cont(cont), m_header(header) { diff --git a/indexer/shared_load_info.hpp b/indexer/shared_load_info.hpp index 4588967a89..8f209c9eb2 100644 --- a/indexer/shared_load_info.hpp +++ b/indexer/shared_load_info.hpp @@ -9,7 +9,7 @@ namespace feature { -/// This info is created once. +// This info is created once per FeaturesVector. class SharedLoadInfo { public: @@ -31,6 +31,7 @@ public: { return m_header.GetDefGeometryCodingParams(); } + serial::GeometryCodingParams GetGeometryCodingParams(int scaleIndex) const { return m_header.GetGeometryCodingParams(scaleIndex); |