1*0Sstevel@tonic-gate // Copyright (c) 1994 James Clark
2*0Sstevel@tonic-gate // See the file COPYING for copying permission.
3*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
4*0Sstevel@tonic-gate
5*0Sstevel@tonic-gate #ifndef HashTable_DEF_INCLUDED
6*0Sstevel@tonic-gate #define HashTable_DEF_INCLUDED 1
7*0Sstevel@tonic-gate
8*0Sstevel@tonic-gate #ifdef SP_NAMESPACE
9*0Sstevel@tonic-gate namespace SP_NAMESPACE {
10*0Sstevel@tonic-gate #endif
11*0Sstevel@tonic-gate
12*0Sstevel@tonic-gate template<class K, class V>
insert(const K & key,const V & value,Boolean replace)13*0Sstevel@tonic-gate void HashTable<K,V>::insert(const K &key, const V &value, Boolean replace)
14*0Sstevel@tonic-gate {
15*0Sstevel@tonic-gate HashTableItem<K, V> *newItem = new HashTableItem<K, V>(key, value);
16*0Sstevel@tonic-gate HashTableItem<K, V> *tem = (HashTableItem<K, V> *)table_.insert(newItem);
17*0Sstevel@tonic-gate if (tem) {
18*0Sstevel@tonic-gate delete newItem;
19*0Sstevel@tonic-gate if (replace) {
20*0Sstevel@tonic-gate tem->key = key;
21*0Sstevel@tonic-gate tem->value = value;
22*0Sstevel@tonic-gate }
23*0Sstevel@tonic-gate }
24*0Sstevel@tonic-gate }
25*0Sstevel@tonic-gate
26*0Sstevel@tonic-gate template<class K, class V>
HashTableItem(const K & k,const V & v)27*0Sstevel@tonic-gate HashTableItem<K,V>::HashTableItem(const K &k, const V &v)
28*0Sstevel@tonic-gate : HashTableItemBase<K>(k), value(v)
29*0Sstevel@tonic-gate {
30*0Sstevel@tonic-gate }
31*0Sstevel@tonic-gate
32*0Sstevel@tonic-gate template<class K, class V>
copy() const33*0Sstevel@tonic-gate HashTableItemBase<K> *HashTableItem<K,V>::copy() const
34*0Sstevel@tonic-gate {
35*0Sstevel@tonic-gate return new HashTableItem<K, V>(*this);
36*0Sstevel@tonic-gate }
37*0Sstevel@tonic-gate
38*0Sstevel@tonic-gate #ifdef SP_NAMESPACE
39*0Sstevel@tonic-gate }
40*0Sstevel@tonic-gate #endif
41*0Sstevel@tonic-gate
42*0Sstevel@tonic-gate #endif /* not HashTable_DEF_INCLUDED */
43