LHash

Description Dictionary data structure, hash-based
Header file LHash.h
Author Stefano Emiliozzi
Created Dec 28, 2002
Last updated Sep 25, 2003

 

Contents


Introduction

The component LHash provides support for maintaining a dictionary data structure based on a hash table. Each void* item stored in the table is associated with a unique ui4 key. Member functions allow it to insert, remove, and find items according to their keys.


Interface

Constants

LHash_ID
LHash_OBJECT_NULL_POINTER

Types

LHash

Functions

LHash* LHash_New                   ()
void   LHash_Delete                (LHash** ThisA)
void   LHash_InsertItem            (LHash* This, void* inItem, ui4 inKey)
void   LHash_RemoveItem            (LHash* This, ui4 inKey)
Bool   LHash_IsInTable             (LHash* This, ui4 inKey)
void   LHash_RemoveAllItems        (LHash* This)
void*  LHash_GetItemByKey          (LHash* This, ui4 inKey)
ui4    LHash_GetUsedMem            (LHash* This)
ui4    LHash_GetItemsCount         (LHash* This)
ui4    LHash_GetCollisionKeysCount (LHash* This)


API Reference

Function Arguments Description Returns Throws
New - Creates object containing an empty hash table. Caller is responsible of dellocating the created object using LHash_Delete.

LHash*

pointer to newly created object

-
Delete LHash** ThisA Releases object *ThisA. *ThisA is set to NULL. void OBJECT_NULL_POINTER
if ThisA or *ThisA are NULL
InsertItem
LHash* This
void*  inItem
ui4    inKey
Inserts the item in the table, using key inKey. void OBJECT_NULL_POINTER
if This is NULL
RemoveItem
LHash* This
ui4    inKey
Removes the item from the table, using key inKey to locate it. void OBJECT_NULL_POINTER
if This is NULL
IsInTable
LHash* This
ui4    inKey
Returns TRUE if the item with key inKey is in the table. Bool OBJECT_NULL_POINTER
if This is NULL
RemoveAllItems LHash* This Removes all the items from the table. void OBJECT_NULL_POINTER
if This is NULL
GetItemByKey
LHash* This
ui4    inKey
Returns the item having key inKey. void* OBJECT_NULL_POINTER
if This is NULL
GetUsedMem LHash* This Returns the memory usage (in bytes) of the whole structure. ui4 OBJECT_NULL_POINTER
if This is NULL
GetItemsCount LHash* This Returns the number of items in the table. ui4 OBJECT_NULL_POINTER
if This is NULL
GetCollisionKeysCount LHash* This Returns the number of unique (i.e. at least one collision) collision keys. ui4 OBJECT_NULL_POINTER
if This is NULL


Revision history