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-07-03 21:16:43 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:20:30 +0300
commitae88aa1971d63e506ba54000dc3aa53135534eb2 (patch)
treef96aa393b5385ff30707a484e88f455cbe69bf4f /indexer/index.hpp
parentadde2107d1effebd18358b60bc190c7bd4e5d75b (diff)
[Refactoring] Use mwm-file descriptor (string name) in Index. Open FileReader only when necessary.
Diffstat (limited to 'indexer/index.hpp')
-rw-r--r--indexer/index.hpp28
1 files changed, 11 insertions, 17 deletions
diff --git a/indexer/index.hpp b/indexer/index.hpp
index 8f5264abfc..eeb21b3db1 100644
--- a/indexer/index.hpp
+++ b/indexer/index.hpp
@@ -8,6 +8,8 @@
#include "../../defines.hpp"
+#include "../platform/platform.hpp"
+
#include "../geometry/rect2d.hpp"
#include "../coding/file_container.hpp"
@@ -134,7 +136,7 @@ public:
}
}
- void Add(ModelReaderPtr const & file)
+ void Add(string const & file)
{
threads::MutexGuard mutexGuard(m_mutex);
UNUSED_VALUE(mutexGuard);
@@ -148,14 +150,14 @@ public:
UpdateIndexes();
}
- void Remove(string const & path)
+ void Remove(string const & file)
{
threads::MutexGuard mutexGuard(m_mutex);
UNUSED_VALUE(mutexGuard);
for (size_t i = 0; i < m_indexes.size(); ++i)
{
- if (m_indexes[i]->IsMyData(path))
+ if (m_indexes[i]->IsMyData(file))
m_indexes[i]->m_action = IndexProxy::INDEX_REMOVE;
}
@@ -218,15 +220,12 @@ private:
class IndexProxy
{
public:
- typedef ModelReaderPtr ReaderT;
-
- explicit IndexProxy(ReaderT const & file)
+ explicit IndexProxy(string const & file)
: m_action(INDEX_DO_NOTHING), m_file(file), m_pIndex(NULL), m_lockCount(0),
m_queriesSkipped(0)
{
- // TODO: If path is cellid-style-square, make rect from cellid and don't open the file.
feature::DataHeader header;
- header.Load(FilesContainerR(m_file).GetReader(HEADER_FILE_TAG));
+ header.Load(FilesContainerR(GetPlatform().GetReader(m_file)).GetReader(HEADER_FILE_TAG));
m_rect = header.GetBounds();
m_scaleRange = header.GetScaleRange();
@@ -266,13 +265,9 @@ private:
return m_lockCount == 0;
}
- bool IsMyData(string const & path) const
+ bool IsMyData(string const & file) const
{
- return m_file.IsEqual(path);
- }
- bool IsMyData(ReaderT const & file) const
- {
- return m_file.IsEqual(file);
+ return Reader::IsEqual(m_file, file);
}
void CloseIfUnlocked()
@@ -312,8 +307,7 @@ private:
{
if (!m_pIndex)
{
- // LOG(LINFO, (m_Path));
- FilesContainerR container(m_file);
+ FilesContainerR container(GetPlatform().GetReader(m_file));
m_pIndex = new IndexT(container);
}
}
@@ -329,7 +323,7 @@ private:
}
}
- ReaderT m_file;
+ string m_file;
m2::RectD m_rect;
pair<int, int> m_scaleRange;