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:
authorvng <viktor.govako@gmail.com>2011-08-25 08:47:17 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:22:21 +0300
commit23894576db1c9c13ba55d9173488202a050a0d3a (patch)
treee8c7f3572c476271e431b6b7166595bf83565880 /indexer/index.hpp
parentb9df96e89b57666178aada45c4c25eece8f8d756 (diff)
[Refactoring] Factor out feature loading routine to separate instance.
Diffstat (limited to 'indexer/index.hpp')
-rw-r--r--indexer/index.hpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/indexer/index.hpp b/indexer/index.hpp
index 95bcff847f..642cf5a08f 100644
--- a/indexer/index.hpp
+++ b/indexer/index.hpp
@@ -267,11 +267,10 @@ private:
: m_action(INDEX_DO_NOTHING), m_file(file), m_lockCount(0),
m_queriesSkipped(0)
{
- feature::DataHeader header;
- header.Load(FilesContainerR(GetPlatform().GetReader(m_file)).GetReader(HEADER_FILE_TAG));
+ m_header.LoadForVersion(FilesContainerR(GetPlatform().GetReader(m_file)));
- m_rect = header.GetBounds();
- m_scaleRange = header.GetScaleRange();
+ m_rect = m_header.GetBounds();
+ m_scaleRange = m_header.GetScaleRange();
}
IndexT * Lock(int scale, m2::RectD const & occlusionRect)
@@ -322,7 +321,7 @@ private:
search::SearchInfo * GetSearchInfo() const
{
- return new search::SearchInfo(FilesContainerR(GetPlatform().GetReader(m_file)));
+ return new search::SearchInfo(FilesContainerR(GetPlatform().GetReader(m_file)), m_header);
}
void CloseIfUnlocked()
@@ -357,8 +356,7 @@ private:
{
if (p == 0)
{
- FilesContainerR container(GetPlatform().GetReader(m_file));
- p = new IndexT(container);
+ p = new IndexT(FilesContainerR(GetPlatform().GetReader(m_file)), m_header);
}
}
@@ -383,6 +381,8 @@ private:
}
string m_file;
+
+ feature::DataHeader m_header;
m2::RectD m_rect;
pair<int, int> m_scaleRange;
@@ -425,9 +425,8 @@ template <class FeatureVectorT, class BaseT> class OffsetToFeatureAdapter : publ
public:
typedef typename BaseT::Query Query;
- explicit OffsetToFeatureAdapter(FilesContainerR const & container)
- : BaseT(container.GetReader(INDEX_FILE_TAG)),
- m_FeatureVector(container)
+ OffsetToFeatureAdapter(FilesContainerR const & cont, feature::DataHeader const & header)
+ : BaseT(cont.GetReader(INDEX_FILE_TAG)), m_FeatureVector(cont, header)
{
}