2016-02-06 15:57:54 +00:00
|
|
|
#include "resourcemanager.hpp"
|
|
|
|
|
|
|
|
#include "objectcache.hpp"
|
|
|
|
|
|
|
|
namespace Resource
|
|
|
|
{
|
|
|
|
|
2016-02-07 18:05:55 +00:00
|
|
|
ResourceManager::ResourceManager(const VFS::Manager *vfs)
|
2016-02-06 15:57:54 +00:00
|
|
|
: mVFS(vfs)
|
2016-02-06 23:43:37 +00:00
|
|
|
, mCache(new Resource::ObjectCache)
|
2016-02-07 18:05:55 +00:00
|
|
|
, mExpiryDelay(0.0)
|
2016-02-06 15:57:54 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-03-02 20:58:11 +00:00
|
|
|
ResourceManager::~ResourceManager()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-02-06 15:57:54 +00:00
|
|
|
void ResourceManager::updateCache(double referenceTime)
|
|
|
|
{
|
|
|
|
mCache->updateTimeStampOfObjectsInCacheWithExternalReferences(referenceTime);
|
|
|
|
mCache->removeExpiredObjectsInCache(referenceTime - mExpiryDelay);
|
|
|
|
}
|
|
|
|
|
2016-02-07 18:05:55 +00:00
|
|
|
void ResourceManager::setExpiryDelay(double expiryDelay)
|
|
|
|
{
|
|
|
|
mExpiryDelay = expiryDelay;
|
|
|
|
}
|
|
|
|
|
2016-02-06 15:57:54 +00:00
|
|
|
const VFS::Manager* ResourceManager::getVFS() const
|
|
|
|
{
|
|
|
|
return mVFS;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|