diff --git a/src/lib/utility/Cache.h b/src/lib/utility/Cache.h index 6a93407e..93a9dd82 100644 --- a/src/lib/utility/Cache.h +++ b/src/lib/utility/Cache.h @@ -2,9 +2,9 @@ #define CACHE_H #include -#include +#include -template +template > class Cache { public: @@ -13,19 +13,19 @@ public: private: std::function m_calculator; - std::map m_map; + std::unordered_map m_map; }; -template -Cache::Cache(std::function calculator) +template +Cache::Cache(std::function calculator) : m_calculator(calculator) { } -template -ValType Cache::getValue(KeyType key) +template > +ValType Cache::getValue(KeyType key) { - typename std::map::const_iterator it = m_map.find(key); + typename std::unordered_map::const_iterator it = m_map.find(key); if (it != m_map.end()) { return it->second; diff --git a/src/lib/utility/file/FileRegister.cpp b/src/lib/utility/file/FileRegister.cpp index c7ef7d5f..4cb24428 100644 --- a/src/lib/utility/file/FileRegister.cpp +++ b/src/lib/utility/file/FileRegister.cpp @@ -107,28 +107,12 @@ bool FileRegister::sourceFileIsParsed(const FilePath& filePath) const return false; } - if (it->second == STATE_UNPARSED) - { - return false; - } - else if (it->second == STATE_PARSED) + if (it->second == STATE_PARSED) { return true; } - } - { - std::lock_guard lock(m_threadFileMutex); - - std::map>::const_iterator it2 = m_threadParsingFiles.find(std::this_thread::get_id()); - if (it2 != m_threadParsingFiles.end()) - { - if (it2->second.find(filePath) != it2->second.end()) - { - return false; - } - } - return true; + return false; } } @@ -143,28 +127,12 @@ bool FileRegister::includeFileIsParsed(const FilePath& filePath) const return false; } - if (it->second == STATE_UNPARSED) - { - return false; - } - else if (it->second == STATE_PARSED) + if (it->second == STATE_PARSED) { return true; } - } - { - std::lock_guard lock(m_threadFileMutex); - - std::map>::const_iterator it2 = m_threadParsingFiles.find(std::this_thread::get_id()); - if (it2 != m_threadParsingFiles.end()) - { - if (it2->second.find(filePath) != it2->second.end()) - { - return false; - } - } - return true; + return false; } }