Library: Foundation
Package: Hashing
Header: Poco/FastInfoset/FISHashTable.h
Deprecated. This class is deprecated and should no longer be used.
A FISHashTable stores a key value pair that can be looked up via a hashed key.
In comparision to a HashTable, this class handles collisions by sequentially searching the next free location. This also means that the maximum size of this table is limited, i.e. if the hash table is full, it will throw an exception and that this class does not support remove operations. On the plus side it is faster than the HashTable.
This class is NOT thread safe.
Member Functions: capacity, clear, currentState, exists, existsRaw, get, getKeyRaw, getRaw, hash, index, indexRaw, insert, insertRaw, insertRawRetKey, operator, operator =, resize, size, swap, update, updateRaw
typedef std::vector < HashEntry * > HashTableVector;
FISHashTable(
UInt32 capacity = 251
);
Creates the FISHashTable.
FISHashTable(
const FISHashTable & ht
);
~FISHashTable();
Destroys the FISHashTable.
UInt32 capacity() const;
void clear();
HashStatistic currentState(
bool details = false
) const;
Returns the current internal state
bool exists(
const Key & key
) const;
bool existsRaw(
const Key & key,
UInt32 hsh
) const;
Poco::UInt32 get(
const Key & key
) const;
Throws an exception if the value does not exist
Poco::UInt32 & get(
const Key & key
);
Throws an exception if the value does not exist
bool get(
const Key & key,
Poco::UInt32 & v
) const;
Sets v to the found value, returns false if no value was found
const Key & getKeyRaw(
const Key & key,
UInt32 hsh
);
Throws an exception if the key does not exist. returns a reference to the internally stored key. Useful when someone does an insert and wants for performance reason only to store a pointer to the key in another collection
Poco::UInt32 getRaw(
const Key & key,
UInt32 hsh
) const;
Throws an exception if the value does not exist
bool getRaw(
const Key & key,
UInt32 hsh,
Poco::UInt32 & v
) const;
Sets v to the found value, returns false if no value was found
UInt32 hash(
const Key & key
) const;
Poco::UInt32 & index(
const Key & key,
const Poco::UInt32 newValue,
bool & valueExisted,
const Key * & pInternal
);
Poco::UInt32 & indexRaw(
const Key & key,
UInt32 hsh,
const Poco::UInt32 newValue,
bool & valueExisted,
const Key * & pInternal
);
Sets valueExisted to false if the value didn't exists and inserts newValue. pInternal will be set if valueExisted is true
UInt32 insert(
const Key & key,
const Poco::UInt32 value
);
Returns the hash value of the inserted item. Throws an exception if the entry was already inserted
Poco::UInt32 & insertRaw(
const Key & key,
UInt32 hsh,
const Poco::UInt32 value
);
Returns the hash value of the inserted item. Throws an exception if the entry was already inserted
const Key * insertRawRetKey(
const Key & key,
UInt32 hsh,
const Poco::UInt32 value
);
Returns the key pointer of the inserted item. Throws an exception if the entry was already inserted
Poco::UInt32 operator[] (
const Key & key
) const;
Poco::UInt32 & operator[] (
const Key & key
);
FISHashTable & operator = (
const FISHashTable & ht
);
void resize(
UInt32 newSize
);
Resizes the hashtable, rehashes all existing entries. Expensive!
std::size_t size() const;
Returns the number of elements already inserted into the FISHashTable
void swap(
FISHashTable & ht
);
UInt32 update(
const Key & key,
const Poco::UInt32 value
);
Returns the hash value of the inserted item. Replaces an existing entry if it finds one
void updateRaw(
const Key & key,
UInt32 hsh,
const Poco::UInt32 value
);
Returns the hash value of the inserted item. Replaces an existing entry if it finds one