1 | /* Copyright (c) 2001, Stanford University
|
---|
2 | * All rights reserved.
|
---|
3 | *
|
---|
4 | * See the file LICENSE.txt for information on redistributing this software.
|
---|
5 | */
|
---|
6 |
|
---|
7 | #ifndef CR_HASH_H
|
---|
8 | #define CR_HASH_H
|
---|
9 |
|
---|
10 | #include "chromium.h"
|
---|
11 |
|
---|
12 | #include <iprt/cdefs.h>
|
---|
13 |
|
---|
14 | #ifdef __cplusplus
|
---|
15 | extern "C" {
|
---|
16 | #endif
|
---|
17 |
|
---|
18 | typedef struct CRHashIdPool CRHashIdPool;
|
---|
19 | typedef struct CRHashTable CRHashTable;
|
---|
20 |
|
---|
21 | /* Callback function used for freeing/deleting table entries */
|
---|
22 | typedef void (*CRHashtableCallback)(void *data);
|
---|
23 | /* Callback function used for walking through table entries */
|
---|
24 | typedef void (*CRHashtableWalkCallback)(unsigned long key, void *data1, void *data2);
|
---|
25 |
|
---|
26 | DECLEXPORT(CRHashIdPool *) crAllocHashIdPool( void );
|
---|
27 | DECLEXPORT(void) crFreeHashIdPool( CRHashIdPool *pool );
|
---|
28 | DECLEXPORT(GLboolean) crHashIdPoolIsIdFree( const CRHashIdPool *pool, GLuint id );
|
---|
29 | DECLEXPORT(GLuint) crHashIdPoolAllocBlock( CRHashIdPool *pool, GLuint count );
|
---|
30 | DECLEXPORT(void) crHashIdPoolFreeBlock( CRHashIdPool *pool, GLuint first, GLuint count );
|
---|
31 | DECLEXPORT(GLboolean) crHashIdPoolAllocId( CRHashIdPool *pool, GLuint id );
|
---|
32 |
|
---|
33 | DECLEXPORT(CRHashTable *) crAllocHashtable( void );
|
---|
34 | DECLEXPORT(void) crFreeHashtable( CRHashTable *hash, CRHashtableCallback deleteCallback );
|
---|
35 | DECLEXPORT(void) crHashtableAdd( CRHashTable *h, unsigned long key, void *data );
|
---|
36 | DECLEXPORT(GLuint) crHashtableAllocKeys( CRHashTable *h, GLsizei range );
|
---|
37 | DECLEXPORT(GLboolean) crHashtableAllocRegisterKey( CRHashTable *h, GLuint key);
|
---|
38 | DECLEXPORT(void) crHashtableDelete( CRHashTable *h, unsigned long key, CRHashtableCallback deleteCallback );
|
---|
39 | DECLEXPORT(void) crHashtableDeleteBlock( CRHashTable *h, unsigned long key, GLsizei range, CRHashtableCallback deleteFunc );
|
---|
40 | DECLEXPORT(void *) crHashtableSearch( const CRHashTable *h, unsigned long key );
|
---|
41 | DECLEXPORT(void) crHashtableReplace( CRHashTable *h, unsigned long key, void *data, CRHashtableCallback deleteFunc);
|
---|
42 | DECLEXPORT(unsigned int) crHashtableNumElements( const CRHashTable *h) ;
|
---|
43 | DECLEXPORT(GLboolean) crHashtableIsKeyUsed( const CRHashTable *h, GLuint id );
|
---|
44 | DECLEXPORT(void) crHashtableWalk( CRHashTable *hash, CRHashtableWalkCallback walkFunc , void *data);
|
---|
45 | /*Returns GL_TRUE if given hashtable hold the data, pKey is updated with key value for data in this case*/
|
---|
46 | DECLEXPORT(GLboolean) crHashtableGetDataKey(CRHashTable *pHash, void *pData, unsigned long *pKey);
|
---|
47 | DECLEXPORT(void) crHashtableLock(CRHashTable *h);
|
---|
48 | DECLEXPORT(void) crHashtableUnlock(CRHashTable *h);
|
---|
49 |
|
---|
50 | #ifdef __cplusplus
|
---|
51 | } /* extern "C" */
|
---|
52 | #endif
|
---|
53 |
|
---|
54 | #endif /* CR_HASH_H */
|
---|