From 0cfbc69d15695c149e71e8a80b52ec4e750d8aef Mon Sep 17 00:00:00 2001 From: randomdan Date: Fri, 21 Mar 2014 11:28:47 +0000 Subject: Remove guidmap, not used anymore --- netfs/daemon/daemon.h | 1 - netfs/lib/guidmap.h | 64 --------------------------------------------------- 2 files changed, 65 deletions(-) delete mode 100644 netfs/lib/guidmap.h 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 #include #include -#include "guidmap.h" #include 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 -#include -#include -#include - -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 GUIDMapImpl : public GUIDMap { - public: - typedef std::map 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 l(lock); - int32_t newKey = (seed + ++key); - while (storage.find(newKey) != storage.end()) { - newKey = (seed + ++key); - } - storage.insert(std::pair(newKey, value)); - return newKey; - } - void remove(int32_t key) { - boost::unique_lock l(lock); - storage.erase(key); - } - Value get(int32_t key) const { - boost::shared_lock 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 l(lock); - return (storage.find(key) != storage.end()); - } - - private: - Storage storage; -}; - -#endif - -- cgit v1.2.3