diff options
author | Sergey Yershov <yershov@corp.mail.ru> | 2015-08-20 18:32:37 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 03:03:14 +0300 |
commit | 8a05999c2ed155f6deb5bb1570e2c455145b7788 (patch) | |
tree | f5ed246479167eb06b75cbf4ec60b724db613c62 /generator/data_cache_file.hpp | |
parent | 1e075e71dd237b7a3ea72a7d1f64a5237b809b91 (diff) |
Debug commit read/write activity logging
Diffstat (limited to 'generator/data_cache_file.hpp')
-rw-r--r-- | generator/data_cache_file.hpp | 9 |
1 files changed, 8 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 |