summaryrefslogtreecommitdiff
path: root/src/maps
diff options
context:
space:
mode:
Diffstat (limited to 'src/maps')
-rw-r--r--src/maps/shashmap.h9
-rw-r--r--src/maps/shashmap.tmpl14
2 files changed, 22 insertions, 1 deletions
diff --git a/src/maps/shashmap.h b/src/maps/shashmap.h
index 6152ba2..99dd7c8 100644
--- a/src/maps/shashmap.h
+++ b/src/maps/shashmap.h
@@ -4,6 +4,8 @@
#include <pthread.h>
#include "hashmap.h"
+#include "../monitor/dump.h"
+
using namespace std;
template
@@ -13,11 +15,15 @@ template
class hash_type = size_hash<string>,
class alloc_type = compare_allocator<string>
>
-class shashmap : protected hashmap<obj_type, key_type_, hash_type, alloc_type>
+class shashmap : protected hashmap<obj_type, key_type_, hash_type, alloc_type>,
+ public dumpable
{
private:
pthread_mutex_t mut_shashmap;
+protected:
+ virtual void dumpit();
+
public:
explicit shashmap();
~shashmap();
@@ -36,6 +42,7 @@ public:
virtual inline vector<key_type_>* get_key_vector();
virtual inline void run_func( void (*func)(obj_type) );
virtual inline void run_func( void (*func)(obj_type, void*), void* v_arg );
+
};
#include "shashmap.tmpl"
diff --git a/src/maps/shashmap.tmpl b/src/maps/shashmap.tmpl
index 4559284..c864d28 100644
--- a/src/maps/shashmap.tmpl
+++ b/src/maps/shashmap.tmpl
@@ -139,3 +139,17 @@ shashmap<obj_type, key_type_, hash_type, alloc_type>::run_func( void (*func)(obj
hashmap<obj_type, key_type_, hash_type, alloc_type>::run_func(func, v_arg);
pthread_mutex_unlock( &mut_shashmap );
}
+
+template<class obj_type, class key_type_, class hash_type, class alloc_type>
+void
+shashmap<obj_type, key_type_, hash_type, alloc_type>::dumpit()
+{
+ dumpable::add("[shashmap]");
+ vector<key_type_>* p_vec = get_key_vector();
+
+ typename vector<key_type_>::iterator iter;
+ for (iter = p_vec->begin(); iter != p_vec->end(); ++iter)
+ dumpable::add(*iter);
+
+ delete p_vec;
+}