Dead code removal
parent
a3417a9c49
commit
372a54bbc7
@ -1,40 +0,0 @@
|
||||
#include "nifcache.hpp"
|
||||
|
||||
namespace Nif
|
||||
{
|
||||
|
||||
Cache* Cache::sThis = 0;
|
||||
|
||||
Cache& Cache::getInstance()
|
||||
{
|
||||
assert (sThis);
|
||||
return *sThis;
|
||||
}
|
||||
|
||||
Cache* Cache::getInstancePtr()
|
||||
{
|
||||
return sThis;
|
||||
}
|
||||
|
||||
Cache::Cache()
|
||||
{
|
||||
assert (!sThis);
|
||||
sThis = this;
|
||||
}
|
||||
|
||||
NIFFilePtr Cache::load(const std::string &filename)
|
||||
{
|
||||
// TODO: normalize file path to make sure we're not loading the same file twice
|
||||
|
||||
LoadedMap::iterator it = mLoadedMap.find(filename);
|
||||
if (it != mLoadedMap.end())
|
||||
return it->second;
|
||||
else
|
||||
{
|
||||
NIFFilePtr file(new Nif::NIFFile(filename));
|
||||
mLoadedMap[filename] = file;
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
#ifndef OPENMW_COMPONENTS_NIFCACHE_H
|
||||
#define OPENMW_COMPONENTS_NIFCACHE_H
|
||||
|
||||
#include <components/nif/niffile.hpp>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace Nif
|
||||
{
|
||||
|
||||
typedef boost::shared_ptr<Nif::NIFFile> NIFFilePtr;
|
||||
|
||||
/// @brief A basic resource manager for NIF files
|
||||
class Cache
|
||||
{
|
||||
public:
|
||||
Cache();
|
||||
|
||||
/// Queue this file for background loading. A worker thread will start loading the file.
|
||||
/// To get the loaded NIFFilePtr, use the load method, which will wait until the worker thread is finished
|
||||
/// and then return the loaded file.
|
||||
//void loadInBackground (const std::string& file);
|
||||
|
||||
/// Read and parse the given file. May retrieve from cache if this file has been used previously.
|
||||
/// @note If the file is currently loading in the background, this function will block until
|
||||
/// the background loading finishes, then return the background loaded file.
|
||||
/// @note Returns a SharedPtr to the file and the file will stay loaded as long as the user holds on to this pointer.
|
||||
/// When all external SharedPtrs to a file are released, the cache may decide to unload the file.
|
||||
NIFFilePtr load (const std::string& filename);
|
||||
|
||||
/// Return instance of this class.
|
||||
static Cache& getInstance();
|
||||
static Cache* getInstancePtr();
|
||||
|
||||
private:
|
||||
static Cache* sThis;
|
||||
|
||||
Cache(const Cache&);
|
||||
Cache& operator =(const Cache&);
|
||||
|
||||
typedef std::map<std::string, NIFFilePtr> LoadedMap;
|
||||
|
||||
LoadedMap mLoadedMap;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue