16dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell/** 26dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell * \file hash.h 36dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell * Generic hash table. 46dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell */ 5afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg 6afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg/* 7afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg * Mesa 3-D graphics library 89f6798d6e1a59b8a0ca258d49d6afae128735f41Brian Paul * Version: 6.5.1 922144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes * 109f6798d6e1a59b8a0ca258d49d6afae128735f41Brian Paul * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. 1122144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes * 12afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg * Permission is hereby granted, free of charge, to any person obtaining a 13afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg * copy of this software and associated documentation files (the "Software"), 14afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg * to deal in the Software without restriction, including without limitation 15afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 16afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg * and/or sell copies of the Software, and to permit persons to whom the 17afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg * Software is furnished to do so, subject to the following conditions: 1822144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes * 19afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg * The above copyright notice and this permission notice shall be included 20afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg * in all copies or substantial portions of the Software. 2122144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes * 22afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 23afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 25afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 26afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 27afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg */ 29afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg 30afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg 31afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg#ifndef HASH_H 32afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg#define HASH_H 33afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg 34afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg 35fbd8f212c3866ec98c1d8c9d3db3ddb7e7c479a5Brian Paul#include "glheader.h" 36afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg 37afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg 38bb79790662f56eb71aafd3f020cd86ad810f56b2Brian Paulextern struct _mesa_HashTable *_mesa_NewHashTable(void); 39afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg 40bb79790662f56eb71aafd3f020cd86ad810f56b2Brian Paulextern void _mesa_DeleteHashTable(struct _mesa_HashTable *table); 41afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg 42107a2ec9eef53dee038c1bcc0d956c5667e0b68fBrian Paulextern void *_mesa_HashLookup(struct _mesa_HashTable *table, GLuint key); 43afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg 44bb79790662f56eb71aafd3f020cd86ad810f56b2Brian Paulextern void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data); 45afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg 46bb79790662f56eb71aafd3f020cd86ad810f56b2Brian Paulextern void _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key); 47afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg 489f6798d6e1a59b8a0ca258d49d6afae128735f41Brian Paulextern void 499f6798d6e1a59b8a0ca258d49d6afae128735f41Brian Paul_mesa_HashDeleteAll(struct _mesa_HashTable *table, 509f6798d6e1a59b8a0ca258d49d6afae128735f41Brian Paul void (*callback)(GLuint key, void *data, void *userData), 519f6798d6e1a59b8a0ca258d49d6afae128735f41Brian Paul void *userData); 529f6798d6e1a59b8a0ca258d49d6afae128735f41Brian Paul 539f6798d6e1a59b8a0ca258d49d6afae128735f41Brian Paulextern void 549f6798d6e1a59b8a0ca258d49d6afae128735f41Brian Paul_mesa_HashWalk(const struct _mesa_HashTable *table, 559f6798d6e1a59b8a0ca258d49d6afae128735f41Brian Paul void (*callback)(GLuint key, void *data, void *userData), 569f6798d6e1a59b8a0ca258d49d6afae128735f41Brian Paul void *userData); 579f6798d6e1a59b8a0ca258d49d6afae128735f41Brian Paul 589b8094a663f08b50f01e3bcce8d22e4415b253e4Brian Paulextern GLuint _mesa_HashFirstEntry(struct _mesa_HashTable *table); 59afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg 60c74ffb8266dc55914cba6a37143b38b5fd05b01cBrian Paulextern GLuint _mesa_HashNextEntry(const struct _mesa_HashTable *table, GLuint key); 61c74ffb8266dc55914cba6a37143b38b5fd05b01cBrian Paul 62bb79790662f56eb71aafd3f020cd86ad810f56b2Brian Paulextern void _mesa_HashPrint(const struct _mesa_HashTable *table); 63afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg 649b8094a663f08b50f01e3bcce8d22e4415b253e4Brian Paulextern GLuint _mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys); 65afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg 66f1b33c74dc11b97a86a7f0e9cbe4cb168b2b9540Brian Paulextern GLuint 67f1b33c74dc11b97a86a7f0e9cbe4cb168b2b9540Brian Paul_mesa_HashNumEntries(const struct _mesa_HashTable *table); 68f1b33c74dc11b97a86a7f0e9cbe4cb168b2b9540Brian Paul 69c74ffb8266dc55914cba6a37143b38b5fd05b01cBrian Paulextern void _mesa_test_hash_functions(void); 70c74ffb8266dc55914cba6a37143b38b5fd05b01cBrian Paul 71afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg 72afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cjtg#endif 73