2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-11-23 21:22:07 +00:00

Add TechsetDefinitionCache to cache loaded techset definitions

This commit is contained in:
Jan
2022-08-06 10:52:35 +02:00
parent b474109452
commit a3a01660d6
5 changed files with 69 additions and 14 deletions

View File

@@ -0,0 +1,18 @@
#include "TechsetDefinitionCache.h"
using namespace techset;
TechsetDefinition* TechsetDefinitionCache::GetCachedTechsetDefinition(const std::string& techsetName) const
{
const auto foundTechset = m_cache.find(techsetName);
if (foundTechset != m_cache.end())
return foundTechset->second.get();
return nullptr;
}
void TechsetDefinitionCache::AddTechsetDefinitionToCache(std::string name, std::unique_ptr<TechsetDefinition> definition)
{
m_cache.emplace(std::make_pair(std::move(name), std::move(definition)));
}