]> www.ginac.de Git - cln.git/blob - src/base/hash/cl_rcpointer_hashweak_rcpointer.cc
8967994cbf374c59f345bf597de5e6ac29c1a1dc
[cln.git] / src / base / hash / cl_rcpointer_hashweak_rcpointer.cc
1 // class cl_wht_from_rcpointer_to_rcpointer.
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cl_rcpointer_hashweak_rcpointer.h"
8
9
10 // Implementation.
11
12 #include "cl_hash1weak.h"
13
14 static void cl_weak_hashtable_from_rcpointer_to_rcpointer_destructor (cl_heap* pointer)
15 {
16 #if (defined(__mips__) || defined(__mips64__)) && !defined(__GNUC__) // workaround SGI CC bug
17         (*(cl_heap_weak_hashtable_from_rcpointer_to_rcpointer*)pointer).~cl_heap_weak_hashtable_1();
18 #else
19         (*(cl_heap_weak_hashtable_from_rcpointer_to_rcpointer*)pointer).~cl_heap_weak_hashtable_from_rcpointer_to_rcpointer();
20 #endif
21 }
22
23 cl_class cl_class_weak_hashtable_from_rcpointer_to_rcpointer = {
24         cl_weak_hashtable_from_rcpointer_to_rcpointer_destructor,
25         0
26 };
27
28 // These are not inline, because they tend to duplicate a lot of template code.
29
30 cl_wht_from_rcpointer_to_rcpointer::cl_wht_from_rcpointer_to_rcpointer (cl_boolean (*maygc_htentry) (const cl_htentry_from_rcpointer_to_rcpointer&))
31 {
32         var cl_heap_weak_hashtable_from_rcpointer_to_rcpointer* ht = new cl_heap_weak_hashtable_from_rcpointer_to_rcpointer (maygc_htentry);
33         ht->refcount = 1;
34         ht->type = &cl_class_weak_hashtable_from_rcpointer_to_rcpointer;
35         pointer = ht;
36 }
37
38 cl_rcpointer * cl_wht_from_rcpointer_to_rcpointer::get (const cl_rcpointer& x) const
39 {
40         return ((cl_heap_weak_hashtable_from_rcpointer_to_rcpointer*)pointer)->get(x);
41 }
42
43 void cl_wht_from_rcpointer_to_rcpointer::put (const cl_rcpointer& x, const cl_rcpointer& y) const
44 {
45         ((cl_heap_weak_hashtable_from_rcpointer_to_rcpointer*)pointer)->put(x,y);
46 }
47