From f2871f3fd2b16fcce0525e0fb4e9af013f60916f Mon Sep 17 00:00:00 2001 From: Yury Melnichek Date: Tue, 4 Jan 2011 16:26:24 +0100 Subject: [PATCH] Names and formatting change in file_container.hpp --- coding/file_container.cpp | 14 +++++++------- coding/file_container.hpp | 29 +++++++++++++---------------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/coding/file_container.cpp b/coding/file_container.cpp index 2b28a12f57..0dab2e5b90 100644 --- a/coding/file_container.cpp +++ b/coding/file_container.cpp @@ -44,8 +44,8 @@ FilesContainerR::FilesContainerR(string const & fName, FileReader FilesContainerR::GetReader(Tag const & tag) const { - info_cont_t::const_iterator i = - lower_bound(m_info.begin(), m_info.end(), tag, less_info()); + InfoContainer::const_iterator i = + lower_bound(m_info.begin(), m_info.end(), tag, LessInfo()); if (i != m_info.end() && i->m_tag == tag) return m_source.SubReader(i->m_offset, i->m_size); @@ -64,7 +64,7 @@ FilesContainerW::FilesContainerW(string const & fName, FileWriter::Op op) { FileReader reader(fName); ReadInfo(reader); - m_needRewrite = true; + m_bNeedRewrite = true; } if (m_info.empty()) @@ -72,7 +72,7 @@ FilesContainerW::FilesContainerW(string const & fName, FileWriter::Op op) FileWriter writer(fName); uint64_t skip = 0; writer.Write(&skip, sizeof(skip)); - m_needRewrite = false; + m_bNeedRewrite = false; } } @@ -94,9 +94,9 @@ uint64_t FilesContainerW::SaveCurrentSize() FileWriter FilesContainerW::GetWriter(Tag const & tag) { ASSERT(!m_bFinished, ()); - if (m_needRewrite) + if (m_bNeedRewrite) { - m_needRewrite = false; + m_bNeedRewrite = false; ASSERT ( !m_info.empty(), () ); uint64_t const curr = m_info.back().m_offset + m_info.back().m_size; @@ -153,7 +153,7 @@ void FilesContainerW::Finish() WriteToSink(writer, curr); } - sort(m_info.begin(), m_info.end(), less_info()); + sort(m_info.begin(), m_info.end(), LessInfo()); FileWriter writer(m_name, FileWriter::OP_APPEND); diff --git a/coding/file_container.hpp b/coding/file_container.hpp index 9b94464095..e013c5da57 100644 --- a/coding/file_container.hpp +++ b/coding/file_container.hpp @@ -21,7 +21,7 @@ protected: Info(Tag const & tag, uint64_t offset) : m_tag(tag), m_offset(offset) {} }; - struct less_info + struct LessInfo { bool operator() (Info const & t1, Info const & t2) const { @@ -37,18 +37,14 @@ protected: } }; - typedef vector info_cont_t; - info_cont_t m_info; + typedef vector InfoContainer; + InfoContainer m_info; void ReadInfo(FileReader & reader); }; class FilesContainerR : public FilesContainerBase { - typedef FilesContainerBase base_type; - - FileReader m_source; - public: explicit FilesContainerR(string const & fName, uint32_t logPageSize = 10, @@ -61,19 +57,13 @@ public: for (size_t i = 0; i < m_info.size(); ++i) f(m_info[i].m_tag); } + +private: + FileReader m_source; }; class FilesContainerW : public FilesContainerBase { - typedef FilesContainerBase base_type; - - string m_name; - - uint64_t SaveCurrentSize(); - - bool m_needRewrite; - bool m_bFinished; - public: FilesContainerW(string const & fName, FileWriter::Op op = FileWriter::OP_WRITE_TRUNCATE); @@ -85,4 +75,11 @@ public: void Append(vector const & buffer, Tag const & tag); void Finish(); + +private: + uint64_t SaveCurrentSize(); + + string m_name; + bool m_bNeedRewrite; + bool m_bFinished; };