|
(Note that these are not member functions.)
|
PascalHashTable * | PHNew (OPHeap *heap, uint64_t num_objects, double load, size_t key_inline_size, size_t valsize) |
| Constructor for PascalHashTable. More...
|
|
void | PHDestroy (PascalHashTable *rhh) |
| Destructor for PascalHashTable. More...
|
|
bool | PHInsertCustom (PascalHashTable *rhh, OPHash hasher, void *key, size_t keysize, void *val) |
| Associates the specified key and value with custom hash function. More...
|
|
bool | PHUpsertCustom (PascalHashTable *rhh, OPHash hasher, void *key, size_t keysize, void **val_ref, bool *is_duplicate) |
| Update or insert depends on whether the key already exists in the hash table using custom hash function. More...
|
|
void * | PHGetCustom (PascalHashTable *rhh, OPHash hasher, void *key, size_t keysize) |
| Obtain the value associated with the key and hash function. Returns NULL if the key was not found. More...
|
|
void * | PHDeleteCustom (PascalHashTable *rhh, OPHash hasher, void *key, size_t keysize) |
| Deletes the key-value entry with specified hash function. More...
|
|
static bool | PHInsert (PascalHashTable *rhh, void *key, size_t keysize, void *val) |
| Associates the specified key and value using default hash function. More...
|
|
static bool | PHUpsert (PascalHashTable *rhh, void *key, size_t keysize, void **val_ref, bool *is_duplicate) |
| Update or insert depends on whether the key already exists in the hash table. More...
|
|
static void * | PHGet (PascalHashTable *rhh, void *key, size_t keysize) |
| Obtain the value associated with the key using default hash function. Returns NULL if the key was not found. More...
|
|
static void * | PHDelete (PascalHashTable *rhh, void *key, size_t keysize) |
| Deletes the key-value entry using default hash function. More...
|
|
uint64_t | PHObjcnt (PascalHashTable *rhh) |
| Obtain the number of objects stored in this hash table.
|
|
uint64_t | PHCapacity (PascalHashTable *rhh) |
| Obtain the number of objects can be stored in this hash table.
|
|
size_t | PHKeyInlineSize (PascalHashTable *rhh) |
| Obtain the size of the key that can be stored inline in the hash table. If the size of the key is larger than this size, the key would not be inline but allocated somewhere in the OPHeap.
|
|
size_t | PHValSize (PascalHashTable *rhh) |
| Obtain the size of the value configured for this hash table.
|
|
void | PHIterate (PascalHashTable *rhh, OPHashIterator iterator, void *context) |
| Iterates over all key-value pairs in this hash table with user specified context. More...
|
|
void | PHPrintStat (PascalHashTable *rhh) |
| Prints the accumulated count for each probing number.
|
|
An opaque object that manages associations of key-value pairs.
This object is not thread safe.
Associates the specified key and value with custom hash function.
- Parameters
-
rhh | PascalHashTable instance. |
hasher | hash function. |
key | pointer the the key |
keysize | length of key data, measured in bytes. |
val | pointer to the value. |
- Returns
- true if the operation succeeded, false otherwise.
The content pointed by key and val will be copied into the hash table. If the value size were 0, only the key get copied. When there's a key collision, the coresponding value get replaced.
If the inserted key-value pairs exceeded the original size user configured, the hash table will resized with a larger capacity. If the resize failed, false is returned.
bool PHUpsertCustom |
( |
PascalHashTable * |
rhh, |
|
|
OPHash |
hasher, |
|
|
void * |
key, |
|
|
size_t |
keysize, |
|
|
void ** |
val_ref, |
|
|
bool * |
is_duplicate |
|
) |
| |
|
related |
Update or insert depends on whether the key already exists in the hash table using custom hash function.
- Parameters
-
rhh | RobinHoodHash instance. |
hasher | hash function. |
key | pointer to the key. |
keysize | length of the key data, measured in bytes. |
val_ref | reference of value pointer. |
is_duplicate | reference of duplication boolean variable. |
- Returns
- true if the operation succeeded, false otherwise.
This method does not insert the value automatically, instead it provides the pointer to the address where value can be inserted or overriden.
If the inserted key-value pairs exceeded the original size user configured, the hash table will resized with a larger capacity. If the resize failed, false is returned.
static bool PHInsert |
( |
PascalHashTable * |
rhh, |
|
|
void * |
key, |
|
|
size_t |
keysize, |
|
|
void * |
val |
|
) |
| |
|
related |
Associates the specified key and value using default hash function.
- Parameters
-
rhh | PascalHashTable instance. |
key | pointer the the key |
keysize | length of key data, measured in bytes. |
val | pointer to the value. |
- Returns
- true if the operation succeeded, false otherwise.
The content pointed by key and val will be copied into the hash table. If the value size were 0, only the key get copied. When there's a key collision, the coresponding value get replaced.
If the inserted key-value pairs exceeded the original size user configured, the hash table will resized with a larger capacity. If the resize failed, false is returned.
Definition at line 177 of file pascal_hash_table.h.
static bool PHUpsert |
( |
PascalHashTable * |
rhh, |
|
|
void * |
key, |
|
|
size_t |
keysize, |
|
|
void ** |
val_ref, |
|
|
bool * |
is_duplicate |
|
) |
| |
|
related |
Update or insert depends on whether the key already exists in the hash table.
- Parameters
-
rhh | RobinHoodHash instance. |
key | pointer to the key. |
keysize | length of the key data, measured in bytes. |
val_ref | reference of value pointer. |
is_duplicate | reference of duplication boolean variable. |
- Returns
- true if the operation succeeded, false otherwise.
This method does not insert the value automatically, instead it provides the pointer to the address where value can be inserted or overriden.
If the inserted key-value pairs exceeded the original size user configured, the hash table will resized with a larger capacity. If the resize failed, false is returned.
Definition at line 202 of file pascal_hash_table.h.