summaryrefslogtreecommitdiff
path: root/src/VBox/GuestHost/OpenGL/include/cr_hash.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/GuestHost/OpenGL/include/cr_hash.h')
-rw-r--r--src/VBox/GuestHost/OpenGL/include/cr_hash.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/VBox/GuestHost/OpenGL/include/cr_hash.h b/src/VBox/GuestHost/OpenGL/include/cr_hash.h
index 9bda7454..0f28c798 100644
--- a/src/VBox/GuestHost/OpenGL/include/cr_hash.h
+++ b/src/VBox/GuestHost/OpenGL/include/cr_hash.h
@@ -15,17 +15,36 @@
extern "C" {
#endif
+typedef struct CRHashIdPool CRHashIdPool;
typedef struct CRHashTable CRHashTable;
/* Callback function used for freeing/deleting table entries */
typedef void (*CRHashtableCallback)(void *data);
/* Callback function used for walking through table entries */
typedef void (*CRHashtableWalkCallback)(unsigned long key, void *data1, void *data2);
+/* Callback function used for walking through allocated keys */
+typedef void (*CRHashIdWalkKeys)(unsigned long firstKey, unsigned long count, void *data);
+
+DECLEXPORT(CRHashIdPool *) crAllocHashIdPool( void );
+DECLEXPORT(CRHashIdPool *) crAllocHashIdPoolEx( GLuint min, GLuint max );
+DECLEXPORT(void) crFreeHashIdPool( CRHashIdPool *pool );
+DECLEXPORT(GLboolean) crHashIdPoolIsIdFree( const CRHashIdPool *pool, GLuint id );
+DECLEXPORT(GLuint) crHashIdPoolAllocBlock( CRHashIdPool *pool, GLuint count );
+DECLEXPORT(void) crHashIdPoolFreeBlock( CRHashIdPool *pool, GLuint first, GLuint count );
+/* @return GL_TRUE if the id is allocated, and GL_FALSE if the id was already allocated */
+DECLEXPORT(GLboolean) crHashIdPoolAllocId( CRHashIdPool *pool, GLuint id );
+DECLEXPORT(void) crHashIdWalkKeys( CRHashIdPool *pool, CRHashIdWalkKeys walkFunc , void *data);
DECLEXPORT(CRHashTable *) crAllocHashtable( void );
+DECLEXPORT(CRHashTable *) crAllocHashtableEx( GLuint min, GLuint max );
DECLEXPORT(void) crFreeHashtable( CRHashTable *hash, CRHashtableCallback deleteCallback );
DECLEXPORT(void) crHashtableAdd( CRHashTable *h, unsigned long key, void *data );
+/* 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 */
DECLEXPORT(GLuint) crHashtableAllocKeys( CRHashTable *h, GLsizei range );
+/* @return GL_TRUE if the id is allocated, and GL_FALSE if the id was already allocated */
+DECLEXPORT(GLboolean) crHashtableAllocRegisterKey( CRHashTable *h, GLuint key);
DECLEXPORT(void) crHashtableDelete( CRHashTable *h, unsigned long key, CRHashtableCallback deleteCallback );
DECLEXPORT(void) crHashtableDeleteBlock( CRHashTable *h, unsigned long key, GLsizei range, CRHashtableCallback deleteFunc );
DECLEXPORT(void *) crHashtableSearch( const CRHashTable *h, unsigned long key );
@@ -33,10 +52,13 @@ DECLEXPORT(void) crHashtableReplace( CRHashTable *h, unsigned long key, void *da
DECLEXPORT(unsigned int) crHashtableNumElements( const CRHashTable *h) ;
DECLEXPORT(GLboolean) crHashtableIsKeyUsed( const CRHashTable *h, GLuint id );
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*/
DECLEXPORT(GLboolean) crHashtableGetDataKey(CRHashTable *pHash, void *pData, unsigned long *pKey);
DECLEXPORT(void) crHashtableLock(CRHashTable *h);
DECLEXPORT(void) crHashtableUnlock(CRHashTable *h);
+DECLEXPORT(void) crHashtableWalkKeys(CRHashTable *hash, CRHashIdWalkKeys walkFunc , void *data);
#ifdef __cplusplus
} /* extern "C" */