From d4c9f10efe815af146438cafb694d16da0e5650a Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 6 Apr 2013 13:14:47 +0200 Subject: tagging ychat-0.7.0 --- src/maps/hmap.h | 6 +++++- src/maps/hmap.tmpl | 15 ++++----------- src/maps/mtools.h | 4 ++++ src/maps/nmap.h | 3 +++ src/maps/smap.h | 3 ++- src/maps/smap.tmpl | 12 ++++-------- 6 files changed, 22 insertions(+), 21 deletions(-) (limited to 'src/maps') diff --git a/src/maps/hmap.h b/src/maps/hmap.h index 38ea2e4..a0824ec 100644 --- a/src/maps/hmap.h +++ b/src/maps/hmap.h @@ -9,6 +9,11 @@ using namespace std; +// void add_elem( obj_type x, key_type k ) --> Insert x +// void del_elem( key_type k ) --> Remove x +// obj_type get_elem( key_type k ) --> Return item that matches x +// void make_empty( ) --> Remove all items + template class hmap { @@ -72,7 +77,6 @@ public: virtual void make_empty( ); virtual void make_empty( void (*func)(key_type) ); virtual void del_elem ( const key_type &k ); - virtual void rename_key ( const key_type &k1, const key_type &k2 ); virtual obj_type set_elem ( const obj_type &x, const key_type &k ); virtual void run_func( void (*func)(obj_type) ); diff --git a/src/maps/hmap.tmpl b/src/maps/hmap.tmpl index cc2ec24..10facac 100644 --- a/src/maps/hmap.tmpl +++ b/src/maps/hmap.tmpl @@ -104,17 +104,6 @@ void hmap::del_elem( const key_type & k ) array[ i_current_pos ].info = DELETED; } -// Remove item x from the hash table. -template -void hmap::rename_key( const key_type & k1, const key_type & k2 ) -{ - int i_current_pos = find_pos( k1 ); - if( is_active( i_current_pos ) ) { - array[ i_current_pos ].info = DELETED; - add_elem( array[ i_current_pos ].element, k2 ); - } -} - // Finds item x and resets its value. template obj_type hmap::set_elem( const obj_type & x, const key_type & k ) @@ -286,4 +275,8 @@ hmap::get_size() return size; } + + + #endif + diff --git a/src/maps/mtools.h b/src/maps/mtools.h index 6062191..f32a49e 100644 --- a/src/maps/mtools.h +++ b/src/maps/mtools.h @@ -1,6 +1,7 @@ #ifndef MTOOLS_H #define MTOOLS_H + template struct mtools { @@ -8,4 +9,7 @@ struct mtools }; #include "mtools.tmpl" + #endif + + diff --git a/src/maps/nmap.h b/src/maps/nmap.h index e29da3b..56d30f5 100644 --- a/src/maps/nmap.h +++ b/src/maps/nmap.h @@ -19,4 +19,7 @@ class nmap : public smap }; #include "nmap.tmpl" + #endif + + diff --git a/src/maps/smap.h b/src/maps/smap.h index a3ee89d..e056519 100644 --- a/src/maps/smap.h +++ b/src/maps/smap.h @@ -13,6 +13,7 @@ template class smap : public hmap { + private: pthread_mutex_t mut_smap; @@ -29,7 +30,6 @@ class smap : public hmap void add_elem ( const obj_type &x, const key_type &k ); obj_type set_elem ( const obj_type &x, const key_type &k ); void del_elem ( const key_type &k ); - void rename_key ( const key_type &k1, const key_type &k2 ); bool is_avail ( const key_type &k ); obj_type get_elem ( const key_type &k ); obj_type pop_elem ( const key_type &k ); @@ -52,4 +52,5 @@ class smap : public hmap }; #include "smap.tmpl" + #endif diff --git a/src/maps/smap.tmpl b/src/maps/smap.tmpl index 670b84d..3167504 100644 --- a/src/maps/smap.tmpl +++ b/src/maps/smap.tmpl @@ -15,6 +15,7 @@ smap::~smap() pthread_mutex_destroy( &mut_smap ); } + template void smap::lock_mutex() { pthread_mutex_lock( &mut_smap ); @@ -76,14 +77,6 @@ smap::del_elem( const key_type & k ) pthread_mutex_unlock( &mut_smap ); } -template void -smap::rename_key( const key_type & k1, const key_type & k2 ) -{ - pthread_mutex_lock ( &mut_smap ); - hmap::rename_key( k1, k2 ); - pthread_mutex_unlock( &mut_smap ); -} - template obj_type smap::get_elem( const key_type &k ) @@ -164,6 +157,7 @@ void smap::make_empty_insecure( void (*func)(key_type) ) hmap::make_empty( func ); } + template void smap::add_elem_insecure( const obj_type &x, const key_type &k ) { @@ -212,4 +206,6 @@ smap::get_key_vector_insecure() return hmap::get_key_vector(); } + #endif + -- cgit v1.2.3