|
| HashMap (HashProc pHashFunction=SDBMHashFunctor) noexcept |
| Default constructor.
|
|
| HashMap (HashProc pHashFunction, TestProc pTestProc) noexcept |
| Default constructor with hash and equality function declarations.
|
|
| HashMap (HashProc pHashFunction, uintptr_t uDefault) noexcept |
| Default constructor with a set number of preallocated entries.
|
|
| HashMap (const HashMap< T, U > &rHashMap) noexcept |
| Copy constructor.
|
|
| ~HashMap () |
| Destructor.
|
|
HashMap< T, U > & | operator= (const HashMap< T, U > &rHashMap) noexcept |
| Copy operator.
|
|
U & | operator[] (const T &rKey) noexcept |
| Index operator.
|
|
void | Set (const T &rKey, const U &rValue) noexcept |
| Set a key/data pair in the hash.
|
|
void | add (const T &rKey, const U &rValue) noexcept |
| Add a key/data pair to the hash.
|
|
U * | GetData (const T &rKey) noexcept |
| Get data by looking it up by a hash key.
|
|
const U * | GetData (const T &rKey) const noexcept |
| Get data by looking it up by a hash key.
|
|
uint_t | GetData (const T &rKey, U *pOutput) const noexcept |
| Get a copy of data by looking it up by a hash key.
|
|
iterator | begin (void) noexcept |
| Set an iterator to the start of the hash.
|
|
const_iterator | begin (void) const noexcept |
| Set an const_iterator to the start of the hash.
|
|
iterator | end (void) noexcept |
| Set an iterator to the end of the hash.
|
|
const_iterator | end (void) const noexcept |
| Set an const_iterator to the end of the hash.
|
|
iterator | find (const T &rKey) noexcept |
| Set an iterator to a specific entry in the hash.
|
|
const_iterator | find (const T &rKey) const noexcept |
| Set an iterator to a specific entry in the hash.
|
|
void | erase (const iterator &it) noexcept |
| Erase a specific entry in the hash indexed by an iterator.
|
|
void | erase (const T &rKey) noexcept |
| Erase a specific entry in the hash.
|
|
Entry * | GetEntry (uintptr_t uIndex) noexcept |
| Return the pointer to an Entry.
|
|
const Entry * | GetEntry (uintptr_t uIndex) const noexcept |
| Return a constant pointer to an Entry.
|
|
void | Clear (void) noexcept |
| Purge all allocated data.
|
|
void | Resize (uintptr_t uNewSize) noexcept |
| Sets a specific capacity to the hash.
|
|
void | SetCapacity (uintptr_t uNewSize) noexcept |
| Sets a comfortable capacity of the hash.
|
|
uintptr_t | GetEntryCount (void) const noexcept |
| Returns the number of valid entries in the hash.
|
|
uintptr_t | GetSizeMask (void) const noexcept |
| Returns the mask used by the hash for rounding.
|
|
uint_t | IsEmpty (void) const noexcept |
| Returns TRUE if the hash is empty.
|
|
uintptr_t | GetEntrySize (void) const noexcept |
| Returns the size of each entry in bytes.
|
|
|
static const uintptr_t | INVALID_HASH = UINTPTR_MAX |
| Invalid hash value for marking an Entry as uninitialized.
|
|
static const uintptr_t | INVALID_INDEX = UINTPTR_MAX |
| Error value for invalid indexes.
|
|
static const uintptr_t | END_OF_CHAIN = UINTPTR_MAX |
| Constant to mark the end of a hash chain.
|
|
static const uintptr_t | EMPTY_RECORD = UINTPTR_MAX - 1 |
| Constant to mark an unused hash record.
|
|
typedef uintptr_t(*) | HashProc(const void *pData, uintptr_t uDataSize) |
| Function prototype for user supplied hash generator.
|
|
typedef uint_t(*) | TestProc(const void *pA, const void *pB) |
| Function prototype for testing keys.
|
|
typedef void(*) | EntryConstructProc(Entry *pEntry) |
| Function prototype for destroying entries.
|
|
typedef void(*) | EntryCopyProc(Entry *pEntry, const void *pT, const void *pU) |
| Function prototype for destroying entries.
|
|
typedef void(*) | EntryInvalidateProc(Entry *pEntry) |
| Function prototype for destroying entries.
|
|
| HashMapShared (uintptr_t uEntrySize, uintptr_t uFirstSize, uintptr_t uSecondOffset, TestProc pTestFunction, EntryConstructProc pEntryConstructFunction, EntryCopyProc pEntryCopyFunction, EntryInvalidateProc pEntryInvalidationFunction, HashProc pHashFunction=SDBMHashFunctor) noexcept |
| Default constructor.
|
|
uintptr_t | FindIndex (const void *pKey) const noexcept |
| Locate an entry in the hash.
|
|
void | CreateBuffer (uintptr_t uCount, uintptr_t uEntrySize) noexcept |
| Create a buffer to store all of the data entries.
|
|
void | CreateHashBuffer (uintptr_t uNewSize) noexcept |
| Function to change the size of the buffer.
|
|
void | Erase (uintptr_t uIndex) noexcept |
| Erase a specific hash entry.
|
|
void | Erase (const void *pKey) noexcept |
| Erase a hash entry by searching for it.
|
|
uintptr_t | FindFirst (void) const noexcept |
| Find the index for the first valid entry.
|
|
uintptr_t | ComputeHash (const void *pKey) const noexcept |
| Calculate the hash for a key.
|
|
void | Copy (const HashMapShared *pInput) noexcept |
| Replace the contents of this hash with a copy of another.
|
|
void | Add (const void *pT, const void *pU) noexcept |
| Add a new key data pair into the hash.
|
|
const void * | GetData (const void *pT) const noexcept |
| Get the pointer to the data index by a key.
|
|
void * | m_pEntries |
| Pointer to the hash table Burger::Alloc(m_uEntrySize*(m_uSizeMask+1))
|
|
uintptr_t | m_uEntrySize |
| Size in bytes of each entry in the table.
|
|
uintptr_t | m_uFirstSize |
| Size of the key in bytes.
|
|
uintptr_t | m_uSecondOffset |
| Offset in bytes to the start of the data chunk.
|
|
uintptr_t | m_uEntryCount |
| Number of valid entries in the hash.
|
|
uintptr_t | m_uSizeMask |
| (Power of 2)-1 size mask used for masking indexes for instant table rounding
|
|
HashProc | m_pHashFunction |
| Pointer to the hash function.
|
|
TestProc | m_pTestFunction |
| Pointer to the equality test function.
|
|
EntryConstructProc | m_pEntryConstructFunction |
| Pointer to function to construct Entry data.
|
|
EntryCopyProc | m_pEntryCopyFunction |
| Pointer to function to copy construct Entry data.
|
|
EntryInvalidateProc | m_pEntryInvalidationFunction |
| Pointer to function to destroy data in an Entry.
|
|
template<class T, class U>
class Burger::HashMap< T, U >
Key / data pair hash for quick lookup and retrieval.
HashMap is a template class to quickly look up data chunks using a key value. To cut down on compile time and reduce code bloat, a majority of the runtime it contained in a parent class HashMapShared and the template creates a front end with only the minimum amount of code to support the class.
From a users point of view, HashMap is a 100% template based class, from a code point of view, HashMap is a dispatcher to HashMapShared.
- See also
- HashMapShared