diff options
author | vng <viktor.govako@gmail.com> | 2014-09-20 17:22:09 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:28:32 +0300 |
commit | 8d367208c6fd8dcbb7e30b806c8e17c28d1ac69d (patch) | |
tree | b2ebdc03146485cb21dcc45b9cfeac064b466ccf /coding/file_container.hpp | |
parent | f8da9e5245f631676de4c6572606d3e24d1b1b69 (diff) |
[generator] Added statistics for routing container.
Diffstat (limited to 'coding/file_container.hpp')
-rw-r--r-- | coding/file_container.hpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/coding/file_container.hpp b/coding/file_container.hpp index 89af73b54a..54ae5ed2bc 100644 --- a/coding/file_container.hpp +++ b/coding/file_container.hpp @@ -12,6 +12,12 @@ class FilesContainerBase public: typedef string Tag; + bool IsExist(Tag const & tag) const + { + return GetInfo(tag) != 0; + } + +protected: struct Info { Tag m_tag; @@ -20,18 +26,12 @@ public: Info() {} Info(Tag const & tag, uint64_t offset) : m_tag(tag), m_offset(offset) {} - - friend string DebugPrint(Info const & info); }; - Info const * GetInfo(Tag const & tag) const; + friend string DebugPrint(Info const & info); - bool IsExist(Tag const & tag) const - { - return GetInfo(tag) != 0; - } + Info const * GetInfo(Tag const & tag) const; -protected: struct LessInfo { bool operator() (Info const & t1, Info const & t2) const @@ -87,6 +87,12 @@ protected: template <class ReaderT> void ReadInfo(ReaderT & reader); + +public: + template <class ToDo> void ForEachTag(ToDo toDo) const + { + for_each(m_info.begin(), m_info.end(), toDo); + } }; class FilesContainerR : public FilesContainerBase |