From d10b8914aeb4f297d6b6deca2408cd81b1adad08 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 30 Sep 2015 23:48:05 +0100 Subject: Use AdHoc plugins for scriptable things and remove legacy plugin support --- project2/common/instanceStore.h | 52 ----------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 project2/common/instanceStore.h (limited to 'project2/common/instanceStore.h') diff --git a/project2/common/instanceStore.h b/project2/common/instanceStore.h deleted file mode 100644 index 4fd4519..0000000 --- a/project2/common/instanceStore.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef INSTANCESTORE_H -#define INSTANCESTORE_H - -#include -#include -#include -#include - -/// A static collection of any type, specifically with automatically cleaned up storage of a function static variable -// which makes it safe to use in constructor functions. -template -class InstanceStore { - public: - static const StoreType & GetAll(); - static void Add(const typename StoreType::value_type & p); - - protected: - static void prune(); - static StoreType * & getInstances(); -}; - -/// Keyed collection of instances -template -class InstanceMap : public InstanceStore>> { - public: - typedef std::map> Store; - typedef InstanceStore>> IStore; - typedef typename Store::value_type Value; - - static void Add(const KeyType & k, Type * p); - static void Add(const KeyType & k, const boost::shared_ptr & p); - static void Remove(const KeyType &); - - template static boost::shared_ptr Get(const KeyType & n) - { - return AdHoc::safeMapLookup(InstanceStore::GetAll(), n); - } - - static void OnEach(const boost::function & func); -}; - -/// Anonymous collection of instances -template -class InstanceSet : public InstanceStore>> { - public: - typedef InstanceStore>> IStore; - static void OnAll(const boost::function & func); - static void Remove(const boost::shared_ptr &); -}; - -#endif - -- cgit v1.2.3