From 372a54bbc70f3e20e1044059f3f743c0114fc149 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 25 Apr 2015 01:28:01 +0200 Subject: [PATCH] Dead code removal --- apps/openmw/engine.hpp | 1 - components/CMakeLists.txt | 4 --- components/nif/niffile.hpp | 1 + components/nifcache/nifcache.cpp | 40 ------------------------- components/nifcache/nifcache.hpp | 50 -------------------------------- components/nifosg/controller.hpp | 2 -- components/nifosg/nifloader.hpp | 2 -- 7 files changed, 1 insertion(+), 99 deletions(-) delete mode 100644 components/nifcache/nifcache.cpp delete mode 100644 components/nifcache/nifcache.hpp diff --git a/apps/openmw/engine.hpp b/apps/openmw/engine.hpp index be405c600..f3b3a8fbf 100644 --- a/apps/openmw/engine.hpp +++ b/apps/openmw/engine.hpp @@ -7,7 +7,6 @@ #include #include #include -#include #include diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index ece1148cb..cc913912f 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -50,10 +50,6 @@ add_component_dir (nifosg nifloader controller particle userdata ) -#add_component_dir (nifcache -# nifcache -# ) - #add_component_dir (nifbullet # bulletnifloader # ) diff --git a/components/nif/niffile.hpp b/components/nif/niffile.hpp index ae5aca5ac..6fbef31ca 100644 --- a/components/nif/niffile.hpp +++ b/components/nif/niffile.hpp @@ -94,6 +94,7 @@ public: /// Get the name of the file std::string getFilename(){ return filename; } }; +typedef boost::shared_ptr NIFFilePtr; diff --git a/components/nifcache/nifcache.cpp b/components/nifcache/nifcache.cpp deleted file mode 100644 index 342251dbc..000000000 --- a/components/nifcache/nifcache.cpp +++ /dev/null @@ -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; - } -} - -} diff --git a/components/nifcache/nifcache.hpp b/components/nifcache/nifcache.hpp deleted file mode 100644 index 173b91865..000000000 --- a/components/nifcache/nifcache.hpp +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef OPENMW_COMPONENTS_NIFCACHE_H -#define OPENMW_COMPONENTS_NIFCACHE_H - -#include - -#include - -#include - -namespace Nif -{ - - typedef boost::shared_ptr 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 LoadedMap; - - LoadedMap mLoadedMap; - }; - -} - -#endif diff --git a/components/nifosg/controller.hpp b/components/nifosg/controller.hpp index d32c9f977..4ebd4f41d 100644 --- a/components/nifosg/controller.hpp +++ b/components/nifosg/controller.hpp @@ -6,8 +6,6 @@ #include #include -#include - #include #include diff --git a/components/nifosg/nifloader.hpp b/components/nifosg/nifloader.hpp index f2f3c2534..bf1dbe6b5 100644 --- a/components/nifosg/nifloader.hpp +++ b/components/nifosg/nifloader.hpp @@ -3,8 +3,6 @@ #include -#include // NIFFilePtr - #include #include