view PrivateHash.h @ 13:c934e7d8ab55

include statements adapted to the new folder structure
author hausers
date Thu, 09 Feb 2012 15:51:22 +0100
parents 7c4d2bf121a9
children 5b89d57e5d10 093cad17d992
line source
1 /*
2 * Copyright 2009 OpenSourceStewardshipFoundation.org
3 * Licensed under GNU General Public License version 2
4 *
5 * Author: seanhalle@yahoo.com
6 */
8 #ifndef _PRIVATE_HASH_H
9 #define _PRIVATE_HASH_H
11 #include "../../VMS_Implementations/VMS_impl/VMS_primitive_data_types.h"
13 #define TRUE 1
14 #define FALSE 0
16 union hashkey_t{
17 char hashable[8];
18 int parts[2];
19 };
21 typedef union hashkey_t hashkey_t;
23 #define DEFAULT_HASHSIZE 1 << 10
25 typedef struct _HashEntry HashEntry;
27 struct _HashEntry
28 {
29 char *key;
30 void *content;
31 HashEntry *next;
32 };
34 typedef void (*FreeEntryContentFnPtr) ( void * );
36 typedef struct
37 { int tableSz;
38 int numEntries;
39 HashEntry* *entries;
40 FreeEntryContentFnPtr freeEntryContentFn;
41 }
42 HashTable;
45 //===========================================================================
46 // Public functions
47 HashTable *makeHashTable( int numHashSlots, FreeEntryContentFnPtr freeFn );
49 int putEntryIntoTable( HashEntry *entry, HashTable *table);
50 int addValueIntoTable( char* key, void *value, HashTable *table);
51 HashEntry *getEntryFromTable( char *key, HashTable *table );
52 void *getValueFromTable( char *key, HashTable *table );
54 bool8 deleteEntryFromTable( char *key, HashTable *table );
55 bool8 deleteThisEntryFromTable( HashEntry *entry, HashTable *table );
56 bool8 deleteEntrysValueInTable( char *key, HashTable *table );
57 bool8 deleteEntryFromTableAndFreeValue( char *key, HashTable *table );
58 void freeHashTable( HashTable *table );
59 //char *paramBagToString( ParamBag * bag )
61 //===========================================================================
62 // Internal functions
63 void freeHashEntryUsing( HashEntry *entry, HashTable *table );
64 unsigned int hashThisKey( char *s, int hashSz );
65 void nullOutTablesArray( HashTable *table );
66 void doubleTableSize( HashTable *table );
67 void freeHashEntryButNotContent( HashEntry *entry );
69 #endif /* _PRIVATE_HASH_H */