forked from organicmaps/organicmaps
review fix
This commit is contained in:
parent
882af45c2e
commit
e0728d97e3
4 changed files with 8 additions and 18 deletions
|
@ -163,7 +163,7 @@ namespace
|
|||
|
||||
void GenerateFeatures(vector<df::FeatureInfo> & features)
|
||||
{
|
||||
for (int i = 0; i < 100; ++i)
|
||||
for (int i = 0; i < 10000; ++i)
|
||||
features.push_back(df::FeatureInfo(FeatureID(0, rand())));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
namespace df
|
||||
{
|
||||
MemoryFeatureIndex::MemoryFeatureIndex() {}
|
||||
|
||||
void MemoryFeatureIndex::ReadFeaturesRequest(const vector<FeatureInfo> & features, vector<size_t> & indexes)
|
||||
{
|
||||
threads::MutexGuard lock(m_mutex);
|
||||
|
@ -11,13 +9,9 @@ namespace df
|
|||
for (size_t i = 0; i < features.size(); ++i)
|
||||
{
|
||||
const FeatureInfo & info = features[i];
|
||||
bool featureExists = m_features.find(info.m_id) != m_features.end();
|
||||
ASSERT(!(featureExists == false && info.m_isOwner == true), ());
|
||||
if (info.m_isOwner == false && featureExists == false)
|
||||
{
|
||||
m_features.insert(info.m_id);
|
||||
ASSERT(!(m_features.find(info.m_id) == m_features.end() && info.m_isOwner == true), ());
|
||||
if (info.m_isOwner == false && m_features.insert(info.m_id).second == true)
|
||||
indexes.push_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,10 +23,7 @@ namespace df
|
|||
{
|
||||
const FeatureInfo & info = features[i];
|
||||
if (info.m_isOwner == true)
|
||||
{
|
||||
ASSERT(m_features.find(info.m_id) != m_features.end(), ());
|
||||
m_features.erase(info.m_id);
|
||||
}
|
||||
VERIFY(m_features.erase(info.m_id) == 1, ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,14 +7,13 @@
|
|||
#include "../std/set.hpp"
|
||||
#include "../std/utility.hpp"
|
||||
#include "../std/vector.hpp"
|
||||
#include "../std/noncopyable.hpp"
|
||||
|
||||
namespace df
|
||||
{
|
||||
class MemoryFeatureIndex
|
||||
class MemoryFeatureIndex : private noncopyable
|
||||
{
|
||||
public:
|
||||
MemoryFeatureIndex();
|
||||
|
||||
void ReadFeaturesRequest(const vector<FeatureInfo> & features, vector<size_t> & indexes);
|
||||
void RemoveFeatures(const vector<FeatureInfo> & features);
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../indexer/feature_decl.hpp"
|
||||
|
||||
#include "../std/vector.hpp"
|
||||
#include "../std/noncopyable.hpp"
|
||||
|
||||
namespace df
|
||||
{
|
||||
|
@ -15,10 +16,9 @@ namespace df
|
|||
bool m_isOwner;
|
||||
};
|
||||
|
||||
class TileInfo
|
||||
class TileInfo : private noncopyable
|
||||
{
|
||||
public:
|
||||
//TileInfo() : m_x(-1), m_y(-1), m_zoomLevel(-1) {}
|
||||
TileInfo(int x, int y, int zoomLevel)
|
||||
: m_x(x), m_y(y), m_zoomLevel(zoomLevel) {}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue