From aabae24de531dbd3b8c2d3780ddac6c0bc8dc7a6 Mon Sep 17 00:00:00 2001 From: Mikhail Gorbushin Date: Thu, 24 Oct 2019 13:12:47 +0300 Subject: [PATCH] [indexer] Add const to MwmValue * --- indexer/mwm_set.hpp | 6 +++--- routing/cross_mwm_graph.cpp | 2 +- routing/cross_mwm_index_graph.hpp | 2 +- search/house_to_street_table.cpp | 6 +++--- search/house_to_street_table.hpp | 2 +- search/lazy_centers_table.cpp | 2 +- search/lazy_centers_table.hpp | 4 ++-- search/mwm_context.hpp | 2 +- search/retrieval.cpp | 4 ++-- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/indexer/mwm_set.hpp b/indexer/mwm_set.hpp index fe79fdca5f..411ed3f56d 100644 --- a/indexer/mwm_set.hpp +++ b/indexer/mwm_set.hpp @@ -148,7 +148,7 @@ public: ~MwmHandle(); // Returns a non-owning ptr. - MwmValue * GetValue() const { return m_value.get(); } + MwmValue const * GetValue() const { return m_value.get(); } bool IsAlive() const { return m_value.get() != nullptr; } MwmId const & GetId() const { return m_mwmId; } @@ -387,8 +387,8 @@ public: version::MwmVersion const & GetMwmVersion() const { return m_factory.GetMwmVersion(); } std::string const & GetCountryFileName() const { return m_file.GetCountryFile().GetName(); } - bool HasSearchIndex() { return m_cont.IsExist(SEARCH_INDEX_FILE_TAG); } - bool HasGeometryIndex() { return m_cont.IsExist(INDEX_FILE_TAG); } + bool HasSearchIndex() const { return m_cont.IsExist(SEARCH_INDEX_FILE_TAG); } + bool HasGeometryIndex() const { return m_cont.IsExist(INDEX_FILE_TAG); } }; // class MwmValue diff --git a/routing/cross_mwm_graph.cpp b/routing/cross_mwm_graph.cpp index 3b29662bb7..c41a284b21 100644 --- a/routing/cross_mwm_graph.cpp +++ b/routing/cross_mwm_graph.cpp @@ -184,7 +184,7 @@ CrossMwmGraph::MwmStatus CrossMwmGraph::GetMwmStatus(NumMwmId numMwmId, if (!handle.IsAlive()) return MwmStatus::NotLoaded; - MwmValue * value = handle.GetValue(); + MwmValue const * value = handle.GetValue(); CHECK(value != nullptr, ("Country file:", m_numMwmIds->GetFile(numMwmId))); return value->m_cont.IsExist(sectionName) ? MwmStatus::SectionExists : MwmStatus::NoSection; } diff --git a/routing/cross_mwm_index_graph.hpp b/routing/cross_mwm_index_graph.hpp index 7102fb50e2..27f9ac7d21 100644 --- a/routing/cross_mwm_index_graph.hpp +++ b/routing/cross_mwm_index_graph.hpp @@ -245,7 +245,7 @@ private: if (!handle.IsAlive()) MYTHROW(RoutingException, ("Mwm", m_numMwmIds->GetFile(numMwmId), "cannot be loaded.")); - MwmValue * value = handle.GetValue(); + MwmValue const * value = handle.GetValue(); CHECK(value != nullptr, ("Country file:", m_numMwmIds->GetFile(numMwmId))); FilesContainerR::TReader const reader = diff --git a/search/house_to_street_table.cpp b/search/house_to_street_table.cpp index abdf44552a..2f02484758 100644 --- a/search/house_to_street_table.cpp +++ b/search/house_to_street_table.cpp @@ -26,7 +26,7 @@ class Fixed3BitsTable : public HouseToStreetTable public: using Vector = FixedBitsDDVector<3, ModelReaderPtr>; - explicit Fixed3BitsTable(MwmValue & value) + explicit Fixed3BitsTable(MwmValue const & value) : m_vector(Vector::Create(value.m_cont.GetReader(SEARCH_ADDRESS_FILE_TAG))) { ASSERT(m_vector.get(), ("Can't instantiate Fixed3BitsDDVector.")); @@ -49,7 +49,7 @@ class EliasFanoMap : public HouseToStreetTable public: using Map = MapUint32ToValue; - explicit EliasFanoMap(MwmValue & value) : m_reader(unique_ptr()) + explicit EliasFanoMap(MwmValue const & value) : m_reader(unique_ptr()) { auto const readBlockCallback = [&](NonOwningReaderSource & source, uint32_t blockSize, vector & values) { @@ -95,7 +95,7 @@ public: }; } // namespace -unique_ptr HouseToStreetTable::Load(MwmValue & value) +unique_ptr HouseToStreetTable::Load(MwmValue const & value) { version::MwmTraits traits(value.GetMwmVersion()); auto const format = traits.GetHouseToStreetTableFormat(); diff --git a/search/house_to_street_table.hpp b/search/house_to_street_table.hpp index d5ec9a2f1d..049776b7d5 100644 --- a/search/house_to_street_table.hpp +++ b/search/house_to_street_table.hpp @@ -25,7 +25,7 @@ public: /// @todo Actually, value may be nullptr in the very common case. /// It's better to construct a table from MwmHandle. - static std::unique_ptr Load(MwmValue & value); + static std::unique_ptr Load(MwmValue const & value); // Returns true and stores street identifier to |streetIndex|. // Street identifier type depends on data version. See StreetIdType. diff --git a/search/lazy_centers_table.cpp b/search/lazy_centers_table.cpp index ae7e65875b..a30a6b553f 100644 --- a/search/lazy_centers_table.cpp +++ b/search/lazy_centers_table.cpp @@ -8,7 +8,7 @@ namespace search { -LazyCentersTable::LazyCentersTable(MwmValue & value) +LazyCentersTable::LazyCentersTable(MwmValue const & value) : m_value(value), m_state(STATE_NOT_LOADED), m_reader(std::unique_ptr()) { } diff --git a/search/lazy_centers_table.hpp b/search/lazy_centers_table.hpp index 3948d681c2..53dffbeb95 100644 --- a/search/lazy_centers_table.hpp +++ b/search/lazy_centers_table.hpp @@ -23,7 +23,7 @@ public: STATE_FAILED }; - explicit LazyCentersTable(MwmValue & value); + explicit LazyCentersTable(MwmValue const & value); inline State GetState() const { return m_state; } @@ -32,7 +32,7 @@ public: WARN_UNUSED_RESULT bool Get(uint32_t id, m2::PointD & center); private: - MwmValue & m_value; + MwmValue const & m_value; State m_state; FilesContainerR::TReader m_reader; diff --git a/search/mwm_context.hpp b/search/mwm_context.hpp index 125970f595..5d107e06bb 100644 --- a/search/mwm_context.hpp +++ b/search/mwm_context.hpp @@ -86,7 +86,7 @@ public: } MwmSet::MwmHandle m_handle; - MwmValue & m_value; + MwmValue const & m_value; private: FeatureStatus GetEditedStatus(uint32_t index) const diff --git a/search/retrieval.cpp b/search/retrieval.cpp index a69beb5d93..7de92fa20a 100644 --- a/search/retrieval.cpp +++ b/search/retrieval.cpp @@ -337,7 +337,7 @@ struct RetrievePostcodeFeaturesAdaptor }; template -unique_ptr> ReadTrie(MwmValue & value, ModelReaderPtr & reader) +unique_ptr> ReadTrie(MwmValue const & value, ModelReaderPtr & reader) { return trie::ReadTrie, ValueList>( SubReaderWrapper(reader.GetPtr()), SingleValueSerializer()); @@ -349,7 +349,7 @@ Retrieval::Retrieval(MwmContext const & context, base::Cancellable const & cance , m_cancellable(cancellable) , m_reader(context.m_value.m_cont.GetReader(SEARCH_INDEX_FILE_TAG)) { - auto & value = context.m_value; + auto const & value = context.m_value; version::MwmTraits mwmTraits(value.GetMwmVersion()); auto const format = mwmTraits.GetSearchIndexFormat();