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