[Spice-devel] [PATCH 06/30] Add optional templated base class to Cache and SharedCache

Alexander Larsson alexl at redhat.com
Thu Feb 18 12:58:32 PST 2010


We want this for integration with C-style classes.
---
 client/cache.hpp        |    4 ++--
 client/shared_cache.hpp |    4 ++--
 client/utils.h          |    3 +++
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/client/cache.hpp b/client/cache.hpp
index 72340e1..0b53676 100644
--- a/client/cache.hpp
+++ b/client/cache.hpp
@@ -26,8 +26,8 @@
     const char* name();
 };*/
 
-template <class T, class Treat, int HASH_SIZE>
-class Cache {
+template <class T, class Treat, int HASH_SIZE, class Base = EmptyBase>
+class Cache : public Base {
 public:
     Cache()
     {
diff --git a/client/shared_cache.hpp b/client/shared_cache.hpp
index ee96638..96a476f 100644
--- a/client/shared_cache.hpp
+++ b/client/shared_cache.hpp
@@ -27,8 +27,8 @@
     const char* name();
 };*/
 
-template <class T, class Treat, int HASH_SIZE>
-class SharedCache {
+template <class T, class Treat, int HASH_SIZE, class Base = EmptyBase>
+class SharedCache : public Base {
 public:
     SharedCache()
         : _aborting (false)
diff --git a/client/utils.h b/client/utils.h
index 9a29cfb..6ed3eea 100644
--- a/client/utils.h
+++ b/client/utils.h
@@ -149,5 +149,8 @@ private:
     T* _array;
 };
 
+class EmptyBase {
+};
+
 #endif
 
-- 
1.6.6



More information about the Spice-devel mailing list