String key / data pair hash for quick lookup and retrieval. More...
Public Member Functions | |
HashMapStringCase () noexcept | |
Default constructor. | |
Public Member Functions inherited from Burger::HashMap< String, U > | |
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< String, U > &rHashMap) noexcept | |
Copy constructor. | |
~HashMap () | |
Destructor. | |
HashMap< String, U > & | operator= (const HashMap< String, U > &rHashMap) noexcept |
Copy operator. | |
U & | operator[] (const String &rKey) noexcept |
Index operator. | |
void | Set (const String &rKey, const U &rValue) noexcept |
Set a key/data pair in the hash. | |
void | add (const String &rKey, const U &rValue) noexcept |
Add a key/data pair to the hash. | |
U * | GetData (const String &rKey) noexcept |
Get data by looking it up by a hash key. | |
const U * | GetData (const String &rKey) const noexcept |
Get data by looking it up by a hash key. | |
uint_t | GetData (const String &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 String &rKey) noexcept |
Set an iterator to a specific entry in the hash. | |
const_iterator | find (const String &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 String &rKey) noexcept |
Erase a specific entry in the hash. | |
Public Member Functions inherited from Burger::HashMapShared | |
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. | |
Additional Inherited Members | |
Static Public Attributes inherited from Burger::HashMapShared | |
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. | |
Protected Types inherited from Burger::HashMapShared | |
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. | |
Protected Member Functions inherited from Burger::HashMapShared | |
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. | |
Protected Attributes inherited from Burger::HashMapShared | |
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. | |
String key / data pair hash for quick lookup and retrieval.
HashMapStringCase is a template class to quickly look up data chunks using a String as a key value.
Unlike the standard HashMap which applies a hash to the class contents, this HashMap will use the string contained in the String class as the key data.
From a users point of view, HashMapStringCase is a 100% template based class, from a code point of view, HashMapStringCase is a dispatcher to HashMapShared.
|
inlinenoexcept |
Default constructor.
Create an empty hash and select to a case insensitive String hash algorithm.