blob: 20961394a9a2b8837b3f410b1cb8f09fc13d009e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// smap := Syncronized hmap
// nmap := Syncronized hmap which's get_elem returns a new obj_type
// instance instead of NULL if for a specific key no value has
// been found
#include "../incl.h"
#ifndef SMAP_H
#define SMAP_H
#include "hmap.h"
template <class obj_type, class key_type>
class smap : public hmap<obj_type, key_type>
{
private:
pthread_mutex_t mut_smap;
protected:
void lock_mutex();
void unlock_mutex();
public:
smap( double moc );
~smap();
int get_size();
void make_empty();
void make_empty( void (*func)(key_type) );
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 );
void run_func( void (*func)(obj_type) );
void run_func( void (*func)(obj_type, void*), void* v_arg );
void run_func_on( void (*func)(obj_type), const key_type &k );
vector<key_type>* get_key_vector();
int get_size_insecure();
void make_empty_insecure();
void make_empty_insecure( void (*func)(key_type) );
void add_elem_insecure ( const obj_type &x, const key_type &k );
void del_elem_insecure ( const key_type &k );
bool is_avail_insecure ( const key_type &k );
obj_type get_elem_insecure ( const key_type &k );
obj_type pop_elem_insecure ( const key_type &k );
void run_func_insecure( void (*func)(obj_type) );
void run_func_insecure( void (*func)(obj_type, void*), void* v_arg );
vector<key_type>* get_key_vector_insecure();
};
#include "smap.tmpl"
#endif
|