📄 hash.h
字号:
/* -*- c-file-style: "img" -*-
<module>
* Name : hash.c
* Title : Self scaling hash tables.
* Author : Marcus Shawcroft
* Created : 14 May 2003
*
* Copyright : 2003 by Imagination Technologies Limited.
* All rights reserved. No part of this software, either
* material or conceptual may be copied or distributed,
* transmitted, transcribed, stored in a retrieval system
* or translated into any human or computer language in any
* form by any means, electronic, mechanical, manual or
* other-wise, or disclosed to third parties without the
* express written permission of Imagination Technologies
* Limited, Unit 8, HomePark Industrial Estate,
* King's Langley, Hertfordshire, WD4 8LZ, U.K.
*
* Description :
*
* Implements simple self scaling hash tables.
*
* Platform : ALL
*
</module>
*/
#ifndef _HASH_H_
#define _HASH_H_
#include "img_types.h"
#include "hostfunc.h"
typedef struct _HASH_STATE_ HASH_STATE;
typedef struct _HASH_TABLE_ HASH_TABLE;
/*----------------------------------------------------------------------------
<function>
FUNCTION: HASH_Initialise
PURPOSE: To initialise the hash module.
PARAMETERS: Out: pHashState - receives hash state pointer
RETURNS: IMG_TRUE Success
IMG_FALSE Failed
</function>
-----------------------------------------------------------------------------*/
IMG_BOOL
HASH_Initialise (HASH_STATE **pHashState);
/*----------------------------------------------------------------------------
<function>
FUNCTION: HASH_Finalise
PURPOSE: To finalise the hash module. All allocated hash tables should
be deleted before calling this function.
PARAMETERS: In: pHashState - hash state pointer (from HASH_Initialise())
RETURNS: None
</function>
-----------------------------------------------------------------------------*/
void
HASH_Finalise (HASH_STATE *pHashState);
/*----------------------------------------------------------------------------
<function>
FUNCTION: HASH_Create
PURPOSE: Create a self scaling hash table.
PARAMETERS: In: pHashState - hash module state (from HASH_Initialise)
In: uInitialSize - initial and minimum size of the hash table.
RETURNS: IMG_NULL or hash table handle.
</function>
-----------------------------------------------------------------------------*/
HASH_TABLE *
HASH_Create (HASH_STATE *pHashState, IMG_UINT32 uInitialSize);
/*----------------------------------------------------------------------------
<function>
FUNCTION: HASH_Delete
PURPOSE: To delete a hash table, all entries in the table should be
removed before calling this function.
PARAMETERS: In: pHash - hash table
RETURNS: None
</function>
-----------------------------------------------------------------------------*/
void
HASH_Delete (HASH_TABLE *pHash);
/*----------------------------------------------------------------------------
<function>
FUNCTION: HASH_Insert
PURPOSE: To insert a key value pair into a hash table.
PARAMETERS: In: pHash - the hash table.
In: k - the key value.
In: v - the value associated with the key.
RETURNS: IMG_TRUE Success
IMG_FALSE Failed
</function>
-----------------------------------------------------------------------------*/
IMG_BOOL
HASH_Insert (HASH_TABLE *pHash, IMG_UINTPTR_T k, IMG_UINTPTR_T v);
/*----------------------------------------------------------------------------
<function>
FUNCTION: HASH_Remove
PURPOSE: To remove a key value pair from a hash table.
PARAMETERS: In: pHash - the hash table
In: k - the key
RETURNS: 0 if the key is missing or the value associated with the key.
</function>
-----------------------------------------------------------------------------*/
IMG_UINTPTR_T
HASH_Remove (HASH_TABLE *pHash, IMG_UINTPTR_T k);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -