diff options
author | randomdan <randomdan@localhost> | 2014-03-21 11:28:47 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2014-03-21 11:28:47 +0000 |
commit | 0cfbc69d15695c149e71e8a80b52ec4e750d8aef (patch) | |
tree | 7dfb67e65fd49e5d8cad950cbccf2c77df878edd | |
parent | Correct targets for install (diff) | |
download | netfs-0cfbc69d15695c149e71e8a80b52ec4e750d8aef.tar.bz2 netfs-0cfbc69d15695c149e71e8a80b52ec4e750d8aef.tar.xz netfs-0cfbc69d15695c149e71e8a80b52ec4e750d8aef.zip |
Remove guidmap, not used anymore
-rw-r--r-- | netfs/daemon/daemon.h | 1 | ||||
-rw-r--r-- | netfs/lib/guidmap.h | 64 |
2 files changed, 0 insertions, 65 deletions
diff --git a/netfs/daemon/daemon.h b/netfs/daemon/daemon.h index 385dbb3..c6f91cf 100644 --- a/netfs/daemon/daemon.h +++ b/netfs/daemon/daemon.h @@ -11,7 +11,6 @@ #include <types.h> #include <volume.h> #include <entCache.h> -#include "guidmap.h" #include <dirent.h> class NetFSDaemon : public IceBox::Service { diff --git a/netfs/lib/guidmap.h b/netfs/lib/guidmap.h deleted file mode 100644 index b550b30..0000000 --- a/netfs/lib/guidmap.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef GUIDMAP_H -#define GUIDMAP_H - -#include <boost/thread/shared_mutex.hpp> -#include <boost/thread/locks.hpp> -#include <boost/foreach.hpp> -#include <map> - -class GUIDMap { - public: - class NotFound : public std::exception { }; - protected: - GUIDMap(int16_t s) : seed(int32_t(s) << 16) { - } - virtual ~GUIDMap() { - } - mutable boost::shared_mutex lock; - int32_t seed; - int16_t key; -}; -template<class Value, int ValueDeleter(Value)> -class GUIDMapImpl : public GUIDMap { - public: - typedef std::map<int32_t, const Value> Storage; - GUIDMapImpl(int16_t s) : GUIDMap(s) { - } - ~GUIDMapImpl() { - BOOST_FOREACH(typename Storage::value_type v, storage) { - ValueDeleter(v.second); - } - } - - int32_t store(const Value & value) { - boost::unique_lock<boost::shared_mutex> l(lock); - int32_t newKey = (seed + ++key); - while (storage.find(newKey) != storage.end()) { - newKey = (seed + ++key); - } - storage.insert(std::pair<int32_t, const Value>(newKey, value)); - return newKey; - } - void remove(int32_t key) { - boost::unique_lock<boost::shared_mutex> l(lock); - storage.erase(key); - } - Value get(int32_t key) const { - boost::shared_lock<boost::shared_mutex> l(lock); - typename Storage::const_iterator i = storage.find(key); - if (i != storage.end()) { - return i->second; - } - throw NotFound(); - } - bool contains(int32_t key) const { - boost::shared_lock<boost::shared_mutex> l(lock); - return (storage.find(key) != storage.end()); - } - - private: - Storage storage; -}; - -#endif - |