TORCS  1.3.9
The Open Racing Car Simulator
Hash Tables API

Hash tables API. More...

Functions

void * GfHashCreate (int type)
 Create a new hash table. More...
 
int GfHashAddStr (void *hash, const char *key, const void *data)
 Add an element with a string key to a hash table. More...
 
const void * GfHashRemStr (void *hash, char *key)
 Remove an element with a string key from a hash table. More...
 
const void * GfHashGetStr (void *hash, const char *key)
 Get the user data associated with a string key. More...
 
void GfHashAddBuf (void *hash, char *key, size_t sz, void *data)
 Add an element with a memory buffer key to a hash table. More...
 
const void * GfHashRemBuf (void *hash, char *key, size_t sz)
 Remove an element with a memory buffer key from a hash table. More...
 
const void * GfHashGetBuf (void *hash, char *key, size_t sz)
 Get the user data associated with a memory buffer key. More...
 
void GfHashRelease (void *hash, tfHashFree hashFree)
 Release a hash table. More...
 
const void * GfHashGetFirst (void *hash)
 Get the first user data of a hash table, this is used for table scans. More...
 
const void * GfHashGetNext (void *hash)
 Get the next user data of a hash table, this is used for table scans. More...
 

Detailed Description

Hash tables API.

Function Documentation

◆ GfHashAddBuf()

void GfHashAddBuf ( void *  hash,
char *  key,
size_t  sz,
void *  data 
)

Add an element with a memory buffer key to a hash table.

Parameters
hashCurrent hash table handle
keyKey buffer to hash
szSize of the buffer
dataUser data

Definition at line 271 of file hash.cpp.

Here is the call graph for this function:

◆ GfHashAddStr()

int GfHashAddStr ( void *  hash,
const char *  key,
const void *  data 
)

Add an element with a string key to a hash table.

Parameters
hashCurrent hash table handle
keyKey string to hash
dataUser data
Returns
0 OK, 1 NOK

Definition at line 170 of file hash.cpp.

Here is the call graph for this function:

◆ GfHashCreate()

void* GfHashCreate ( int  type)

Create a new hash table.

Parameters
typeType of key used (GF_HASH_TYPE_STR or GF_HASH_TYPE_BUF)
Returns
Handle on new hash table
0 if Error
See also
GF_HASH_TYPE_STR
GF_HASH_TYPE_BUF

Definition at line 98 of file hash.cpp.

◆ GfHashGetBuf()

const void* GfHashGetBuf ( void *  hash,
char *  key,
size_t  sz 
)

Get the user data associated with a memory buffer key.

Parameters
hashCurrent hash table handle
keyKey buffer to hash
szSize of the buffer
Returns
User data or NULL if not found

Definition at line 330 of file hash.cpp.

Here is the call graph for this function:

◆ GfHashGetFirst()

const void* GfHashGetFirst ( void *  hash)

Get the first user data of a hash table, this is used for table scans.

Parameters
hashCurrent hash table handle
Returns
User data or NULL if empty
See also
GfHashGetNext

Definition at line 379 of file hash.cpp.

Here is the call graph for this function:

◆ GfHashGetNext()

const void* GfHashGetNext ( void *  hash)

Get the next user data of a hash table, this is used for table scans.

Parameters
hashCurrent hash table handle
Returns
User data or NULL if we have reached the end
See also
GfHashGetFirst

Definition at line 396 of file hash.cpp.

◆ GfHashGetStr()

const void* GfHashGetStr ( void *  hash,
const char *  key 
)

Get the user data associated with a string key.

Parameters
hashCurrent hash table handle.
keyKey string to hash.
Returns
User data or NULL if not found

Definition at line 245 of file hash.cpp.

Here is the call graph for this function:

◆ GfHashRelease()

void GfHashRelease ( void *  hash,
tfHashFree  hashFree 
)

Release a hash table.

Parameters
hashCurrent hash table handle
hashFreePointer on user function used to free the user data (NULL if not used)

Definition at line 353 of file hash.cpp.

Here is the call graph for this function:

◆ GfHashRemBuf()

const void* GfHashRemBuf ( void *  hash,
char *  key,
size_t  sz 
)

Remove an element with a memory buffer key from a hash table.

Parameters
hashCurrent hash table handle
keyKey buffer to hash
szSize of the buffer
Returns
User data or NULL if not found

Definition at line 303 of file hash.cpp.

Here is the call graph for this function:

◆ GfHashRemStr()

const void* GfHashRemStr ( void *  hash,
char *  key 
)

Remove an element with a string key from a hash table.

Parameters
hashCurrent hash table handle
keyKey string to hash
Returns
User data or NULL if not found

Definition at line 219 of file hash.cpp.

Here is the call graph for this function: