2 * Copyright 2005, Haiku.
3 * Distributed under the terms of the MIT License.
6 * Axel Dörfler, axeld@pinc-software.de
12 #include <SupportDefs.h>
17 virtual ~Hashable() {};
18 virtual uint32
Hash() const = 0;
19 virtual bool CompareTo(Hashable
& hashable
) const = 0;
24 HashTable(bool owning
= false, int32 capacity
= 100, float loadFactor
= 0.75);
27 void MakeEmpty(bool deleteValues
= true);
28 bool IsEmpty() const { return fCount
== 0; }
29 bool ContainsKey(Hashable
& key
) const { return _GetHashEntry(key
) != NULL
; }
30 int32
CountItems() const { return fCount
; }
32 Hashable
*GetValue(Hashable
& key
) const;
34 bool AddItem(Hashable
* value
);
35 Hashable
*RemoveItem(Hashable
& key
);
41 entry
*_GetHashEntry(Hashable
& key
) const;
44 int32 fCapacity
, fCount
, fThreshold
;
49 #endif /* HASHTABLE_H */