Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Gorshenin <y@maps.me>2016-09-20 14:48:47 +0300
committerYuri Gorshenin <y@maps.me>2016-09-20 14:51:15 +0300
commite3b5e4575e74a97c00d4ae9abe53c7447f74d13b (patch)
treed9ff29ee4c19fd741a648c22365e04cf150443cc /indexer
parent572db1c9e93f7995bb3a6d123e11c72d59fe3277 (diff)
[indexer] Extensions to FeaturesVector.
Diffstat (limited to 'indexer')
-rw-r--r--indexer/features_vector.cpp4
-rw-r--r--indexer/features_vector.hpp2
-rw-r--r--indexer/index.cpp9
-rw-r--r--indexer/index.hpp2
4 files changed, 17 insertions, 0 deletions
diff --git a/indexer/features_vector.cpp b/indexer/features_vector.cpp
index 06954a254b..30662819bd 100644
--- a/indexer/features_vector.cpp
+++ b/indexer/features_vector.cpp
@@ -14,6 +14,10 @@ void FeaturesVector::GetByIndex(uint32_t index, FeatureType & ft) const
ft.Deserialize(m_LoadInfo.GetLoader(), &m_buffer[offset]);
}
+size_t FeaturesVector::GetNumFeatures() const
+{
+ return m_table ? m_table->size() : 0;
+}
FeaturesVectorTest::FeaturesVectorTest(string const & filePath)
: FeaturesVectorTest((FilesContainerR(filePath, READER_CHUNK_LOG_SIZE, READER_CHUNK_LOG_COUNT)))
diff --git a/indexer/features_vector.hpp b/indexer/features_vector.hpp
index 6daf2eb093..d19b772fcf 100644
--- a/indexer/features_vector.hpp
+++ b/indexer/features_vector.hpp
@@ -22,6 +22,8 @@ public:
void GetByIndex(uint32_t index, FeatureType & ft) const;
+ size_t GetNumFeatures() const;
+
template <class ToDo> void ForEach(ToDo && toDo) const
{
uint32_t index = 0;
diff --git a/indexer/index.cpp b/indexer/index.cpp
index 6811333464..5f642f40f3 100644
--- a/indexer/index.cpp
+++ b/indexer/index.cpp
@@ -135,3 +135,12 @@ bool Index::FeaturesLoaderGuard::GetOriginalFeatureByIndex(uint32_t index, Featu
ft.SetID(FeatureID(m_handle.GetId(), index));
return true;
}
+
+size_t Index::FeaturesLoaderGuard::GetNumFeatures() const
+{
+ if (!m_handle.IsAlive())
+ return 0;
+
+ ASSERT(m_vector.get(), ());
+ return m_vector->GetNumFeatures();
+}
diff --git a/indexer/index.hpp b/indexer/index.hpp
index 91351a9c6f..b593e25b2f 100644
--- a/indexer/index.hpp
+++ b/indexer/index.hpp
@@ -285,6 +285,8 @@ public:
/// Editor core only method, to get 'untouched', original version of feature.
WARN_UNUSED_RESULT bool GetOriginalFeatureByIndex(uint32_t index, FeatureType & ft) const;
+ size_t GetNumFeatures() const;
+
private:
MwmHandle m_handle;
unique_ptr<FeaturesVector> m_vector;