eyBuildLib API Reference : eyBuildLib

ebhash

NAME

ebhash - eybuild hash table

ROUTINES

ebHashCreate( ) - create a hash table
ebHashCount( ) - get the number of elements in hash table
ebHashAdd( ) - add an key-value pair into hash table
ebHashGet( ) - get the value by key from hash table
ebHashDelete( ) - delete an key-value pair from hash table
ebHashDestroy( ) - destroy a hash table

DESCRIPTION

eybuild hash table operation library

INCLUDE

ebhash.h


eyBuildLib : Routines

ebHashCreate( )

NAME

ebHashCreate( ) - create a hash table

SYNOPSIS

EBHASH * ebHashCreate
    (
    size_t minsize
    )

DESCRIPTION

This routine is to create a hash table. Parameter minsize is the minimal size of the hash table.

RETURNS

pointer to new created hash table, or NULL if lack memory

SEE ALSO

ebhash


eyBuildLib : Routines

ebHashCount( )

NAME

ebHashCount( ) - get the number of elements in hash table

SYNOPSIS

unsigned int ebHashCount
    (
    EBHASH * hash
    )

DESCRIPTION

This routine is to get the number of elements in hash table.

RETURNS

number of elements in hash table

SEE ALSO

ebhash


eyBuildLib : Routines

ebHashAdd( )

NAME

ebHashAdd( ) - add an key-value pair into hash table

SYNOPSIS

int ebHashAdd
    (
    EBHASH *     hash,
    const char * key,
    void *       value
    )

DESCRIPTION

This routine is to add an key-value pair into hash table. The key must be \0 terminaled string.

RETURNS

OK, or ERROR if lack memory

SEE ALSO

ebhash


eyBuildLib : Routines

ebHashGet( )

NAME

ebHashGet( ) - get the value by key from hash table

SYNOPSIS

void * ebHashGet
    (
    EBHASH *     hash,
    const char * key
    )

DESCRIPTION

This routine is to add an key-value pair into hash table. The key must be \0 terminaled string.

RETURNS

pointer to value, or NULL if not found

SEE ALSO

ebhash


eyBuildLib : Routines

ebHashDelete( )

NAME

ebHashDelete( ) - delete an key-value pair from hash table

SYNOPSIS

void * ebHashDelete
    (
    EBHASH *     hash,
    const char * key
    )

DESCRIPTION

This routine is to delete an key-value pair from hash table. The key must be \0 terminaled string.

RETURNS

OK, or ERROR if lack memory

SEE ALSO

ebhash


eyBuildLib : Routines

ebHashDestroy( )

NAME

ebHashDestroy( ) - destroy a hash table

SYNOPSIS

void ebHashDestroy
    (
    EBHASH * hash,
    BOOL     free_values
    )

DESCRIPTION

This routine is to destroy a hash table. Parameter free_values specifis automatically free values of key-value pair or not internally.

RETURNS

N/A

SEE ALSO

ebhash