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:
authorSergey Yershov <yershov@corp.mail.ru>2015-08-20 18:32:37 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 03:03:14 +0300
commit8a05999c2ed155f6deb5bb1570e2c455145b7788 (patch)
treef5ed246479167eb06b75cbf4ec60b724db613c62 /generator
parent1e075e71dd237b7a3ea72a7d1f64a5237b809b91 (diff)
Debug commit read/write activity logging
Diffstat (limited to 'generator')
-rw-r--r--generator/data_cache_file.hpp9
-rw-r--r--generator/osm_decl.hpp14
2 files changed, 22 insertions, 1 deletions
diff --git a/generator/data_cache_file.hpp b/generator/data_cache_file.hpp
index 3dcacb3983..de57bc698a 100644
--- a/generator/data_cache_file.hpp
+++ b/generator/data_cache_file.hpp
@@ -14,6 +14,8 @@
#include "std/utility.hpp"
#include "std/vector.hpp"
+#include "std/fstream.hpp"
+
/// Classes for reading and writing any data in file with map of offsets for
/// fast searching in memory by some key.
namespace cache
@@ -136,15 +138,18 @@ public:
protected:
TStream m_stream;
detail::IndexFile<TOffsetFile, uint64_t> m_offsets;
+ string m_name;
public:
- OSMElementCache(string const & name) : m_stream(name), m_offsets(name + OFFSET_EXT) {}
+ OSMElementCache(string const & name) : m_stream(name), m_offsets(name + OFFSET_EXT), m_name(name) {}
template <class TValue>
void Write(TKey id, TValue const & value)
{
m_offsets.Add(id, m_stream.Pos());
value.Write(m_stream);
+ std::ofstream ff((m_name+".wlog").c_str(), std::ios::binary | std::ios::app);
+ ff << id << " " << value.ToString() << std::endl;
}
template <class TValue>
@@ -155,6 +160,8 @@ public:
{
m_stream.Seek(pos);
value.Read(m_stream);
+ std::ofstream ff((m_name+".rlog").c_str(), std::ios::binary | std::ios::app);
+ ff << id << " " << value.ToString() << std::endl;
return true;
}
else
diff --git a/generator/osm_decl.hpp b/generator/osm_decl.hpp
index 7cf78b62dd..561c35b5e9 100644
--- a/generator/osm_decl.hpp
+++ b/generator/osm_decl.hpp
@@ -60,6 +60,13 @@ struct WayElement
{
ar >> nodes;
}
+
+ string ToString() const
+ {
+ stringstream ss;
+ ss << nodes.size() << " " << m_wayOsmId;
+ return ss.str();
+ }
};
class RelationElement
@@ -109,6 +116,13 @@ public:
ar >> nodes >> ways >> tags;
}
+ string ToString() const
+ {
+ stringstream ss;
+ ss << nodes.size() << " " << ways.size() << " " << tags.size();
+ return ss.str();
+ }
+
protected:
bool FindRoleImpl(TMembers const & container, uint64_t id, string & role) const
{