1 // cl_rcpointer hash tables
3 #ifndef _CL_RCPOINTER_HASHWEAK_RCPOINTER_H
4 #define _CL_RCPOINTER_HASHWEAK_RCPOINTER_H
6 #include "cln/object.h"
8 #include "cl_hash1weak.h"
13 static inline bool equal (const cl_rcpointer& x, const cl_rcpointer& y)
14 { return (x.pointer == y.pointer); }
16 // Hash code. Luckily objects don't move around in memory.
17 inline unsigned long hashcode (const cl_rcpointer& x)
18 { return (unsigned long)x.pointer; }
20 typedef cl_htentry1<cl_rcpointer,cl_rcpointer> cl_htentry_from_rcpointer_to_rcpointer;
22 typedef cl_heap_weak_hashtable_1<cl_rcpointer,cl_rcpointer> cl_heap_weak_hashtable_from_rcpointer_to_rcpointer;
24 typedef _cl_hashtable_iterator<cl_htentry_from_rcpointer_to_rcpointer> cl_hashtable_from_rcpointer_to_rcpointer_iterator;
26 struct cl_wht_from_rcpointer_to_rcpointer : public cl_rcpointer {
28 cl_wht_from_rcpointer_to_rcpointer (bool (*maygc_htentry) (const cl_htentry_from_rcpointer_to_rcpointer&));
29 cl_wht_from_rcpointer_to_rcpointer (const cl_wht_from_rcpointer_to_rcpointer&);
30 // Assignment operators.
31 cl_wht_from_rcpointer_to_rcpointer& operator= (const cl_wht_from_rcpointer_to_rcpointer&);
33 cl_hashtable_from_rcpointer_to_rcpointer_iterator iterator () const
34 { return ((cl_heap_weak_hashtable_from_rcpointer_to_rcpointer*)pointer)->iterator(); }
36 cl_rcpointer * get (const cl_rcpointer& x) const;
38 void put (const cl_rcpointer& x, const cl_rcpointer& y) const;
43 #endif /* _CL_RCPOINTER_HASHWEAK_RCPOINTER_H */