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:
authorAlex Zolotarev <deathbaba@gmail.com>2011-03-20 06:20:31 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:13:54 +0300
commit3d2498ee2119e667580a54074126f7eff12f5aca (patch)
treecb35082737d6075de58b78ae5a1fe2b5b62cdcff /generator/statistics.hpp
parent1e7be338c611ee9f6ea8a2c139b2eb9ac242207f (diff)
- Created [generator],[generator_tests] and moved indexer_tool to [generator_tool]
Diffstat (limited to 'generator/statistics.hpp')
-rw-r--r--generator/statistics.hpp76
1 files changed, 76 insertions, 0 deletions
diff --git a/generator/statistics.hpp b/generator/statistics.hpp
new file mode 100644
index 0000000000..a4a73c03c1
--- /dev/null
+++ b/generator/statistics.hpp
@@ -0,0 +1,76 @@
+#pragma once
+
+#include "../indexer/feature.hpp"
+
+#include "../std/map.hpp"
+
+
+namespace stats
+{
+ struct GeneralInfo
+ {
+ uint64_t m_count, m_size;
+
+ GeneralInfo() : m_count(0), m_size(0) {}
+
+ void Add(uint64_t sz)
+ {
+ if (sz > 0)
+ {
+ ++m_count;
+ m_size += sz;
+ }
+ }
+ };
+
+ template <class TKey>
+ struct GeneralInfoKey
+ {
+ TKey m_key;
+ GeneralInfo m_info;
+
+ GeneralInfoKey(TKey key) : m_key(key) {}
+
+ bool operator< (GeneralInfoKey const & rhs) const
+ {
+ return m_key < rhs.m_key;
+ }
+ };
+
+ 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;
+ }
+ };
+
+ struct MapInfo
+ {
+ set<GeneralInfoKey<FeatureBase::FeatureType> > m_byGeomType;
+ set<GeneralInfoKey<TypeTag> > m_byClassifType;
+ set<GeneralInfoKey<uint32_t> > m_byPointsCount, m_byTrgCount;
+
+ GeneralInfo m_inner[3];
+
+ template <class TKey, class TSet>
+ 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);
+ }
+ }
+ };
+
+ void FileContainerStatistic(string const & fName);
+
+ void CalcStatistic(string const & fName, MapInfo & info);
+ void PrintStatistic(MapInfo & info);
+}