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
path: root/base
diff options
context:
space:
mode:
authorVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2018-04-11 13:37:44 +0300
committerTatiana Yan <tatiana.kondakova@gmail.com>2018-04-11 14:47:31 +0300
commit9c0617335c101f2a9b43e789e9531e20996a8263 (patch)
tree99cf09668522c2275c9d4f8757868de37d62956f /base
parent6fee8371a53f6fc45e728596523faef23a20e6a1 (diff)
Review fixes.
Diffstat (limited to 'base')
-rw-r--r--base/base_tests/fifo_cache_test.cpp12
-rw-r--r--base/fifo_cache.hpp10
2 files changed, 11 insertions, 11 deletions
diff --git a/base/base_tests/fifo_cache_test.cpp b/base/base_tests/fifo_cache_test.cpp
index d4e1a773df..7b63f1fb93 100644
--- a/base/base_tests/fifo_cache_test.cpp
+++ b/base/base_tests/fifo_cache_test.cpp
@@ -21,11 +21,11 @@ public:
Value const & GetValue(Key const & key) { return m_cache.GetValue(key); }
unordered_map<Key, Value> const & GetMap() const { return m_cache.m_map; }
- boost::circular_buffer<Key> const & GetList() const { return m_cache.m_list; }
+ boost::circular_buffer<Key> const & GetFifo() const { return m_cache.m_fifo; }
bool IsValid() const
{
- set<Key> listKeys(m_cache.m_list.begin(), m_cache.m_list.end());
+ set<Key> listKeys(m_cache.m_fifo.begin(), m_cache.m_fifo.end());
set<Key> mapKeys;
for (auto const & kv : m_cache.m_map)
@@ -65,9 +65,9 @@ UNIT_TEST(FifoCache)
{
unordered_map<Key, Value> expectedMap({{1 /* key */, 1 /* value */}, {2, 2}, {3, 3}});
TEST_EQUAL(cache.GetMap(), expectedMap, ());
- std::list<Key> expectedList({2, 3, 1});
+ list<Key> expectedList({2, 3, 1});
boost::circular_buffer<Key> expectedCB(expectedList.cbegin(), expectedList.cend());
- TEST_EQUAL(cache.GetList(), expectedCB, ());
+ TEST_EQUAL(cache.GetFifo(), expectedCB, ());
}
TEST_EQUAL(cache.GetValue(7), 7, ());
@@ -75,9 +75,9 @@ UNIT_TEST(FifoCache)
{
unordered_map<Key, Value> expectedMap({{7 /* key */, 7 /* value */}, {2, 2}, {3, 3}});
TEST_EQUAL(cache.GetMap(), expectedMap, ());
- std::list<Key> expectedList({7, 2, 3});
+ list<Key> expectedList({7, 2, 3});
boost::circular_buffer<Key> expectedCB(expectedList.cbegin(), expectedList.cend());
- TEST_EQUAL(cache.GetList(), expectedCB, ());
+ TEST_EQUAL(cache.GetFifo(), expectedCB, ());
}
}
diff --git a/base/fifo_cache.hpp b/base/fifo_cache.hpp
index d08739fe76..675d8c4d81 100644
--- a/base/fifo_cache.hpp
+++ b/base/fifo_cache.hpp
@@ -19,7 +19,7 @@ public:
/// \param capacity maximum size of the cache in number of items.
/// \param loader Function which is called if it's necessary to load a new item for the cache.
FifoCache(size_t capacity, Loader const & loader)
- : m_list(capacity), m_capacity(capacity), m_loader(loader)
+ : m_fifo(capacity), m_capacity(capacity), m_loader(loader)
{
}
@@ -33,11 +33,11 @@ public:
if (Size() >= m_capacity)
{
- CHECK(!m_list.empty(), ());
- m_map.erase(m_list.back());
+ CHECK(!m_fifo.empty(), ());
+ m_map.erase(m_fifo.back());
}
- m_list.push_front(key);
+ m_fifo.push_front(key);
auto & v = m_map[key];
m_loader(key, v);
@@ -48,7 +48,7 @@ private:
size_t Size() const { return m_map.size(); }
std::unordered_map<Key, Value> m_map;
- boost::circular_buffer<Key> m_list;
+ boost::circular_buffer<Key> m_fifo;
size_t m_capacity;
Loader m_loader;
};