home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / System / Mesa-3.1 / src-glu / tess_hash.h < prev    next >
C/C++ Source or Header  |  1999-11-30  |  2KB  |  75 lines

  1. /* $Id: tess_hash.h,v 1.7.2.2 1999/11/29 18:16:11 gareth Exp $ */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  3.1
  6.  *
  7.  * Copyright (C) 1999  Brian Paul   All Rights Reserved.
  8.  *
  9.  * Permission is hereby granted, free of charge, to any person obtaining a
  10.  * copy of this software and associated documentation files (the "Software"),
  11.  * to deal in the Software without restriction, including without limitation
  12.  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  13.  * and/or sell copies of the Software, and to permit persons to whom the
  14.  * Software is furnished to do so, subject to the following conditions:
  15.  *
  16.  * The above copyright notice and this permission notice shall be included
  17.  * in all copies or substantial portions of the Software.
  18.  *
  19.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  20.  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21.  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  22.  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  23.  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24.  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25.  */
  26.  
  27. /*****************************************************************************
  28.  *
  29.  * GLU 1.3 Polygon Tessellation - Implementation of hash table
  30.  *
  31.  * Gareth Hughes <garethh@bell-labs.com>, August 1999
  32.  *
  33.  *****************************************************************************/
  34.  
  35. #ifndef __GLU_TESS_HASH_H__
  36. #define __GLU_TESS_HASH_H__
  37.  
  38. #include "tess_typedefs.h"
  39.  
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43.  
  44. #define HT_DEFAULT_SIZE        9
  45.  
  46. #define HASH_VERTEX( v )    ((tess_vertex_t *) (v)->ptr)
  47.  
  48. typedef struct hashtable_elt_s
  49. {
  50.     GLint        key;
  51.     void        *ptr;
  52.     struct hashtable_elt_s *prev, *next;
  53. } hashtable_elt_t;
  54.  
  55. typedef struct hashtable_s
  56. {
  57.     GLint        size;
  58.     GLint        num_elements;
  59.     hashtable_elt_t    **elements;
  60. } hashtable_t;
  61.  
  62. hashtable_t    *hashtable_init( GLint size );
  63. void        hashtable_insert( hashtable_t *table, GLint key, void *ptr );
  64. GLboolean    hashtable_search( hashtable_t *table, GLint key );
  65. void        *hashtable_element( hashtable_t *table, GLint key );
  66. void        *hashtable_delete( hashtable_t *table, GLint key );
  67.  
  68. void        hashtable_cleanup( hashtable_t **table );
  69.  
  70. #ifdef __cplusplus
  71. }
  72. #endif
  73.  
  74. #endif /* __GLU_TESS_HASH_H__ */
  75.