version 1.11, 2001/07/10 22:31:13
|
version 1.13, 2002/06/01 00:56:33
|
|
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM, |
|
// The Open Group, Tivoli Systems |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
@param key void pointer to key. | @param key void pointer to key. |
@return pointer to bucket with that key or zero otherwise. | @return pointer to bucket with that key or zero otherwise. |
*/ | */ |
const _BucketBase* lookup(Uint32 hashCode, const void* key); |
const _BucketBase* lookup(Uint32 hashCode, const void* key) const; |
| |
/*- Removes the bucket with the given key. This method uses the | /*- Removes the bucket with the given key. This method uses the |
_BucketBase::equal() method to compare keys. | _BucketBase::equal() method to compare keys. |
|
|
@param key key to be searched for | @param key key to be searched for |
@return true if hash table contains an entry with the given key. | @return true if hash table contains an entry with the given key. |
*/ | */ |
Boolean contains(const K& key) |
Boolean contains(const K& key) const |
{ | { |
V value; | V value; |
return lookup(key, value); | return lookup(key, value); |
|
|
@param value output value. | @param value output value. |
@return true if found; false otherwise. | @return true if found; false otherwise. |
*/ | */ |
Boolean lookup(const K& key, V& value); |
Boolean lookup(const K& key, V& value) const; |
| |
/** Removes the entry with the given key. | /** Removes the entry with the given key. |
@param key key of entry to be removed. | @param key key of entry to be removed. |
|
|
}; | }; |
| |
template<class K, class V, class E, class H> | template<class K, class V, class E, class H> |
inline Boolean HashTable<K, V, E, H>::lookup(const K& key, V& value) |
inline Boolean HashTable<K, V, E, H>::lookup(const K& key, V& value) const |
{ | { |
_Bucket<K, V, E>* bucket | _Bucket<K, V, E>* bucket |
= (_Bucket<K, V, E>*)_rep.lookup(H::hash(key), &key); | = (_Bucket<K, V, E>*)_rep.lookup(H::hash(key), &key); |