TORCS  1.3.10
The Open Racing Car Simulator
Loading...
Searching...
No Matches
hash.cpp File Reference


Hash API More...

#include <tgf.h>
Include dependency graph for hash.cpp:

Go to the source code of this file.

Classes

struct  HashElem
struct  HashHeader

Macros

#define HASH_BYTE(x, y)
#define DEFAULT_SIZE   32

Typedefs

typedef struct HashElem tHashElem
typedef struct HashHeader tHashHeader

Functions

 GF_TAILQ_HEAD (HashHead, tHashElem)
static unsigned int hash_str (tHashHeader *hash, const char *sstr)
static unsigned int hash_buf (tHashHeader *hash, char *sdata, int len)
void * GfHashCreate (int type)
 Create a new hash table.
static void gfIncreaseHash (tHashHeader *curHeader)
 Double the size of the hash table.
int GfHashAddStr (void *hash, const char *key, const void *data)
 Add an element with a string key to a hash table.
static const void * gfRemElem (tHashHead *hashHead, tHashElem *elem)
 Remove a table element.
const void * GfHashRemStr (void *hash, char *key)
 Remove an element with a string key from a hash table.
const void * GfHashGetStr (void *hash, const char *key)
 Get the user data associated with a string key.
void GfHashAddBuf (void *hash, char *key, size_t sz, void *data)
 Add an element with a memory buffer key to a hash table.
const void * GfHashRemBuf (void *hash, char *key, size_t sz)
 Remove an element with a memory buffer key from a hash table.
const void * GfHashGetBuf (void *hash, char *key, size_t sz)
 Get the user data associated with a memory buffer key.
void GfHashRelease (void *hash, tfHashFree hashFree)
 Release a hash table.
const void * GfHashGetFirst (void *hash)
 Get the first user data of a hash table, this is used for table scans.
const void * GfHashGetNext (void *hash)
 Get the next user data of a hash table, this is used for table scans.

Detailed Description


Hash API

Author
Bernhard Wymann, Eric Espie
Version
$Id$

Definition in file hash.cpp.

Macro Definition Documentation

◆ DEFAULT_SIZE

#define DEFAULT_SIZE   32

Definition at line 51 of file hash.cpp.

◆ HASH_BYTE

#define HASH_BYTE ( x,
y )
Value:
(((y) + ((x) << 4) + ((x) >> 4)) * 11)
static Vector y[4]
Definition Convex.cpp:56

Definition at line 50 of file hash.cpp.

Typedef Documentation

◆ tHashElem

typedef struct HashElem tHashElem

◆ tHashHeader

typedef struct HashHeader tHashHeader

Function Documentation

◆ GF_TAILQ_HEAD()

GF_TAILQ_HEAD ( HashHead ,
tHashElem  )

◆ gfIncreaseHash()

void gfIncreaseHash ( tHashHeader * curHeader)
static

Double the size of the hash table.

Definition at line 122 of file hash.cpp.

Here is the call graph for this function:

◆ gfRemElem()

const void * gfRemElem ( tHashHead * hashHead,
tHashElem * elem )
static

Remove a table element.

Definition at line 201 of file hash.cpp.

◆ hash_buf()

unsigned int hash_buf ( tHashHeader * hash,
char * sdata,
int len )
static

Definition at line 74 of file hash.cpp.

◆ hash_str()

unsigned int hash_str ( tHashHeader * hash,
const char * sstr )
static

Definition at line 54 of file hash.cpp.