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>2015-08-12 13:41:49 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 03:03:06 +0300
commitcbbbb9aa9b24d11fb4265980715bf20f50fc3111 (patch)
treef8350c94dd5d3a9383b70fb746e5433b43c2817a /generator/statistics.hpp
parentb6eabd2c962c02a1c84557258ca5d3dc3f6db64e (diff)
[generator] Added “top features by area” statistics.
Diffstat (limited to 'generator/statistics.hpp')
-rw-r--r--generator/statistics.hpp43
1 files changed, 13 insertions, 30 deletions
diff --git a/generator/statistics.hpp b/generator/statistics.hpp
index 692cb818f1..968777fd35 100644
--- a/generator/statistics.hpp
+++ b/generator/statistics.hpp
@@ -23,37 +23,24 @@ namespace stats
}
};
- template <class TKey>
- struct GeneralInfoKey
+ template <class T, int Tag>
+ struct IntegralType
{
- TKey m_key;
- GeneralInfo m_info;
-
- GeneralInfoKey(TKey key) : m_key(key) {}
-
- bool operator< (GeneralInfoKey const & rhs) const
- {
- return m_key < rhs.m_key;
- }
+ T m_val;
+ explicit IntegralType(T v) : m_val(v) {}
+ bool operator<(IntegralType const & rhs) const { return m_val < rhs.m_val; }
};
- struct TypeTag
- {
- uint32_t m_val;
-
- TypeTag(uint32_t v) : m_val(v) {}
-
- bool operator< (TypeTag const & rhs) const
- {
- return m_val < rhs.m_val;
- }
- };
+ using ClassifType = IntegralType<uint32_t, 0>;
+ using CountType = IntegralType<uint32_t, 1>;
+ using AreaType = IntegralType<size_t, 2>;
struct MapInfo
{
- set<GeneralInfoKey<feature::EGeomType> > m_byGeomType;
- set<GeneralInfoKey<TypeTag> > m_byClassifType;
- set<GeneralInfoKey<uint32_t> > m_byPointsCount, m_byTrgCount;
+ map<feature::EGeomType, GeneralInfo> m_byGeomType;
+ map<ClassifType, GeneralInfo> m_byClassifType;
+ map<CountType, GeneralInfo> m_byPointsCount, m_byTrgCount;
+ map<AreaType, GeneralInfo> m_byAreaSize;
GeneralInfo m_inner[3];
@@ -61,11 +48,7 @@ namespace stats
void AddToSet(TKey key, uint32_t sz, TSet & theSet)
{
if (sz > 0)
- {
- // GCC doesn't allow to modify set value ...
- const_cast<GeneralInfo &>(
- theSet.insert(GeneralInfoKey<TKey>(key)).first->m_info).Add(sz);
- }
+ theSet[key].Add(sz);
}
};