gft_hashtable.h
Go to the documentation of this file.
1 #ifndef _GFT_HASHTABLE_H_
2 #define _GFT_HASHTABLE_H_
3 
4 #include "gft_common.h"
5 
6 namespace gft{
7  namespace HashTable{
8 
12  typedef struct _hashnode {
13  char *key;
14  void *value;
15  struct _hashnode *next;
16  } HashNode;
17 
18 
19  typedef struct _hashtable {
21  int size;
22  } HashTable;
23 
24 
28  HashTable *Create(int size);
29 
33  void Destroy(HashTable **ht);
34 
38  void Insert(HashTable *ht, char *key, void *value);
39 
43  void *Search(HashTable *ht, char *key);
44 
45 
46  } //end HashTable namespace
47 } //end gft namespace
48 
49 #endif
void * Search(HashTable *ht, char *key)
Search for the value associated with a key.
Definition: gft_hashtable.cpp:74
void Insert(HashTable *ht, char *key, void *value)
Insert the pair (key, value) in the hash table.
Definition: gft_hashtable.cpp:61
A hashing table node.
Definition: gft_hashtable.h:12
void Destroy(HashTable **ht)
A destructor.
Definition: gft_hashtable.cpp:30
int size
Definition: gft_hashtable.h:21
Definition: gft_hashtable.h:19
Header file for common definitions and function prototypes.
char * key
Search key.
Definition: gft_hashtable.h:13
HashNode ** data
Definition: gft_hashtable.h:20
struct _hashnode * next
Pointer to next node.
Definition: gft_hashtable.h:15
struct gft::HashTable::_hashtable HashTable
HashTable * Create(int size)
A constructor.
Definition: gft_hashtable.cpp:8
void * value
Associated value.
Definition: gft_hashtable.h:14
struct gft::HashTable::_hashnode HashNode
A hashing table node.