29 #include "nomlib/system/ObjectCache.hpp"
35 std::map <std::string, std::shared_ptr<SDL_Surface>> ObjectCache::cache;
37 ObjectCache::ObjectCache (
void )
42 ObjectCache::~ObjectCache (
void )
47 std::shared_ptr<SDL_Surface> ObjectCache::addObject (
const std::string& key,
48 std::shared_ptr<SDL_Surface>
object
51 std::map <std::string, std::shared_ptr<SDL_Surface>>::iterator res;
53 res = cache.insert( std::pair< std::string, std::shared_ptr<SDL_Surface>> ( key,
object ) ).first;
55 NOM_LOG_INFO ( NOM,
"ObjectCache: " + key +
" has been added to the cache." );
67 std::shared_ptr<SDL_Surface> ObjectCache::getObject (
const std::string& key )
69 std::map <std::string, std::shared_ptr<SDL_Surface>>::iterator itr;
71 itr = cache.find ( key );
75 if ( itr == cache.end() )
bool removeObject(const std::string &key)