Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

vhash.h

Go to the documentation of this file.
00001 
00008 #ifndef VHASH_H
00009 #define VHASH_H
00010 
00011 #include <stdlib.h>
00012 
00013 #include "vlist.h"
00014 
00015 #ifdef _WIN32_WCE
00016 #define VHASH_CDECL __cdecl
00017 #else
00018 #define VHASH_CDECL 
00019 #endif
00020 
00021 
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif /* __cplusplus */
00025 
00039 typedef struct hash_node_s{
00040     V_POINTER_SIZED_INT key;
00041     void * item;
00042     unsigned char state;
00043 } vhash_node_t;
00044 
00045 typedef struct vhash_s {
00046         struct hash_node_s * table;
00047         unsigned long count;
00048         unsigned long table_size;
00049         long key_length;
00050         char * key_string;
00051         void *(VHASH_CDECL *malloc) (size_t);
00052         void (VHASH_CDECL *free) (void*);
00053 } vhash_t;
00054 
00058 #define VHASH_STATUS_FAILED 0
00059 
00062 #define VHASH_STATUS_SUCCESS 1
00063 
00066 #define VHASH_STATUS_INSERTED 2
00067 
00071 typedef int vhash_status_t;
00072 
00080 vhash_t * new_vhash(
00081     unsigned long table_size,
00082     void *(VHASH_CDECL *vhash_malloc) (size_t),
00083     void (VHASH_CDECL *vhash_free) (void *));
00084 
00089 void delete_vhash(vhash_t * vhash);
00090 
00097 vhash_status_t vhash_rebuild_table(
00098     vhash_t * vhash,
00099     unsigned long table_size);
00100 
00106 unsigned long vhash_count(vhash_t* vhash);
00107 
00116 void vhash_map_function(
00117     vhash_t * v,
00118     void(*function)(void*, void*, void*),
00119     void * user_data);
00120 
00124 typedef struct vhash_pair_s {
00125     void * key;
00126     void * item;
00127 } vhash_pair_t;
00128 
00132 typedef struct vhash_string_key_pair_s {
00133     const char * key;
00134     void * item;
00135 } vhash_string_key_pair_t;
00136 
00144 vhash_status_t vhash_to_vlist(
00145     vhash_t * vhash,
00146     vlist_t * vlist,
00147     void *(VHASH_CDECL *vhash_pair_malloc) (size_t));
00148 
00149 
00158 vhash_status_t vhash_replace_item(
00159     vhash_t * v,
00160     void * in_key, 
00161     void * new_item,
00162     void ** replaced_item);
00163 
00171 vhash_status_t vhash_insert_item(
00172     vhash_t * v,
00173     void * in_key,
00174     void * item);
00175 
00183 vhash_status_t vhash_remove_item(
00184     vhash_t * v,
00185     void * in_key,
00186     void ** removed_item);
00187 
00195 vhash_status_t vhash_lookup_item(
00196     const vhash_t * v,
00197     void * in_key,
00198     void ** out_item);
00199 
00209 void vhash_string_key_map_function(
00210     vhash_t * v,
00211     void(*function)(void*, const char *, void*),
00212     void * user_data);
00213 
00225 vhash_status_t vhash_replace_string_key_item(
00226     vhash_t * v,
00227     const char * string_key, 
00228     void * new_item,
00229     void ** replaced_item);
00230 
00239 vhash_status_t vhash_insert_string_key_item(
00240     vhash_t * v,
00241     const char * string_key, 
00242     void * item);
00243 
00252 vhash_status_t vhash_remove_string_key_item(
00253     vhash_t * v,
00254     const char * string_key,
00255     void ** removed_item);
00256 
00265 vhash_status_t vhash_lookup_string_key_item(
00266     vhash_t * v,
00267     const char * string_key,
00268     void ** out_item);
00269 
00277 vhash_status_t vhash_string_keys_to_vlist(
00278     vhash_t * vhash,
00279     vlist_t * vlist,
00280     void *(VHASH_CDECL *vhash_pair_malloc) (size_t));
00281 
00282 
00283 /*THIS IS OBSOLETE*/
00284 void vhash_insert(
00285     vhash_t * vhash,
00286     void * key, void * item);
00287 
00288 /*THIS IS OBSOLETE*/
00289 void * vhash_remove(
00290     vhash_t * vhash,
00291     void * key);
00292 
00293 /*THIS IS OBSOLETE*/
00294 void * vhash_lookup(
00295     vhash_t * vhash,
00296     void * key);
00297 
00298 
00299 /*THIS IS OBSOLETE*/
00300 void vhash_insert_string_key(
00301         vhash_t * v,
00302         const char * string, 
00303         void * item);
00304 
00305 /*THIS IS OBSOLETE*/
00306 void * vhash_remove_string_key(
00307         vhash_t * v,
00308         const char * string);
00309 
00310 /*THIS IS OBSOLETE*/
00311 void * vhash_lookup_string_key(
00312         vhash_t * v,
00313         const char * string);
00314 
00315 #ifdef __cplusplus
00316 } /* extern "C" */
00317 #endif /* __cplusplus */
00318 
00319 #endif /*VHASH_H*/
00320 
00321 

Generated on Tue May 17 12:06:00 2005 for Autodesk DWF 3D Toolkit by  doxygen 1.4.1