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