| 1 |
/* roadmap_hash.h - the API for the roadmap hash index.
|
| 2 |
*
|
| 3 |
* LICENSE:
|
| 4 |
*
|
| 5 |
* Copyright 2002 Pascal F. Martin
|
| 6 |
*
|
| 7 |
* This file is part of RoadMap.
|
| 8 |
*
|
| 9 |
* RoadMap is free software; you can redistribute it and/or modify
|
| 10 |
* it under the terms of the GNU General Public License as published by
|
| 11 |
* the Free Software Foundation; either version 2 of the License, or
|
| 12 |
* (at your option) any later version.
|
| 13 |
*
|
| 14 |
* RoadMap is distributed in the hope that it will be useful,
|
| 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 |
* GNU General Public License for more details.
|
| 18 |
*
|
| 19 |
* You should have received a copy of the GNU General Public License
|
| 20 |
* along with RoadMap; if not, write to the Free Software
|
| 21 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
| 22 |
*/
|
| 23 |
|
| 24 |
#ifndef _ROADMAP_HASH__H_
|
| 25 |
#define _ROADMAP_HASH__H_
|
| 26 |
|
| 27 |
#define ROADMAP_HASH_MODULO 4093
|
| 28 |
|
| 29 |
struct roadmap_hash_struct {
|
| 30 |
|
| 31 |
char *name;
|
| 32 |
|
| 33 |
struct roadmap_hash_struct *next_hash;
|
| 34 |
|
| 35 |
int head[ROADMAP_HASH_MODULO];
|
| 36 |
|
| 37 |
int size;
|
| 38 |
int *next;
|
| 39 |
void **values;
|
| 40 |
|
| 41 |
/* Statistics: */
|
| 42 |
int count_add_first;
|
| 43 |
int count_add_next;
|
| 44 |
int count_get_first;
|
| 45 |
int count_get_next;
|
| 46 |
|
| 47 |
};
|
| 48 |
|
| 49 |
typedef struct roadmap_hash_struct RoadMapHash;
|
| 50 |
|
| 51 |
|
| 52 |
RoadMapHash *roadmap_hash_new (char *name, int size);
|
| 53 |
|
| 54 |
void roadmap_hash_add (RoadMapHash *hash, int key, int index);
|
| 55 |
int roadmap_hash_get_first (RoadMapHash *hash, int key);
|
| 56 |
int roadmap_hash_get_next (RoadMapHash *hash, int index);
|
| 57 |
void roadmap_hash_resize (RoadMapHash *hash, int size);
|
| 58 |
|
| 59 |
void roadmap_hash_free (RoadMapHash *hash);
|
| 60 |
|
| 61 |
void roadmap_hash_set_value (RoadMapHash *hash, int index, void *value);
|
| 62 |
void *roadmap_hash_get_value (RoadMapHash *hash, int index);
|
| 63 |
|
| 64 |
void roadmap_hash_summary (void);
|
| 65 |
void roadmap_hash_reset (void);
|
| 66 |
|
| 67 |
#endif // _ROADMAP_HASH__H_
|
| 68 |
|