MP7 MapReduce
libdictionary.h
00001 /* 
00002  * CS 241
00003  * The University of Illinois
00004  */
00005 
00006 #ifndef _LIBDICTIONRY_H_
00007 #define _LIBDICTIONRY_H_
00008 
00009 #include <pthread.h>
00010 
00011 #define KEY_EXISTS 1
00012 #define NO_KEY_EXISTS 2
00013 
00014 
00015 typedef struct _dictionary_entry_t
00016 {
00017         const char *key, *value;
00018 } dictionary_entry_t;
00019 
00020 typedef struct _dictionary_t
00021 {
00022         void *root;
00023         pthread_mutex_t mutex;
00024 } dictionary_t;
00025 
00026 
00027 void dictionary_init(dictionary_t *d);
00028 
00029 int dictionary_add(dictionary_t *d, const char *key, const char *value);
00030 
00031 const char *dictionary_get(dictionary_t *d, const char *key);
00032 
00033 int dictionary_remove(dictionary_t *d, const char *key);
00034 int dictionary_remove_free(dictionary_t *d, const char *key);
00035 
00036 void dictionary_destroy(dictionary_t *d);
00037 void dictionary_destroy_free(dictionary_t *d);
00038 
00039 
00040 #endif
 All Data Structures Files Functions