cr_hash.h revision 68da78527731dc05ee33b1083d8322adbef6aa5a
/* Copyright (c) 2001, Stanford University
* All rights reserved.
*
* See the file LICENSE.txt for information on redistributing this software.
*/
#ifndef CR_HASH_H
#define CR_HASH_H
#include "chromium.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct CRHashIdPool CRHashIdPool;
typedef struct CRHashTable CRHashTable;
typedef void (*CRHashtableCallback)(void *data);
/* Callback function used for walking through table entries */
/* @return GL_TRUE if the id is allocated, and GL_FALSE if the id was already allocated */
/* to ensure hash table pool id consistency, there is no crHashTableFreeKeys/UnregisterKey,
* one should call crHashtableDelete to free unneeded keys,
* which will also ensure there is no entry with the specified key left in the table */
/* @return GL_TRUE if the id is allocated, and GL_FALSE if the id was already allocated */
DECLEXPORT(void) crHashtableDelete( CRHashTable *h, unsigned long key, CRHashtableCallback deleteCallback );
DECLEXPORT(void) crHashtableDeleteBlock( CRHashTable *h, unsigned long key, GLsizei range, CRHashtableCallback deleteFunc );
DECLEXPORT(void) crHashtableReplace( CRHashTable *h, unsigned long key, void *data, CRHashtableCallback deleteFunc);
DECLEXPORT(void) crHashtableWalk( CRHashTable *hash, CRHashtableWalkCallback walkFunc , void *data);
/* walk the hashtable w/o holding the table lock */
DECLEXPORT(void) crHashtableWalkUnlocked( CRHashTable *hash, CRHashtableWalkCallback walkFunc , void *data);
/*Returns GL_TRUE if given hashtable hold the data, pKey is updated with key value for data in this case*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* CR_HASH_H */