1.1 --- a/ucx/map.h Wed Aug 14 16:07:49 2013 +0200 1.2 +++ b/ucx/map.h Fri Aug 16 13:40:10 2013 +0200 1.3 @@ -67,10 +67,13 @@ 1.4 1.5 /** Type for the UCX map. @see UcxMap */ 1.6 typedef struct UcxMap UcxMap; 1.7 + 1.8 /** Type for a key of an UcxMap. @see UcxKey */ 1.9 typedef struct UcxKey UcxKey; 1.10 + 1.11 /** Type for an element of an UcxMap. @see UcxMapElement */ 1.12 typedef struct UcxMapElement UcxMapElement; 1.13 + 1.14 /** Type for an iterator over an UcxMap. @see UcxMapIterator */ 1.15 typedef struct UcxMapIterator UcxMapIterator; 1.16 1.17 @@ -100,8 +103,10 @@ 1.18 struct UcxMapElement { 1.19 /** The value data. */ 1.20 void *data; 1.21 + 1.22 /** A pointer to the next element in the current list. */ 1.23 UcxMapElement *next; 1.24 + 1.25 /** The corresponding key. */ 1.26 UcxKey key; 1.27 }; 1.28 @@ -110,8 +115,10 @@ 1.29 struct UcxMapIterator { 1.30 /** The map to iterate over. */ 1.31 UcxMap *map; 1.32 + 1.33 /** The current map element. */ 1.34 UcxMapElement *cur; 1.35 + 1.36 /** 1.37 * The current index of the element list array. 1.38 * <b>Attention: </b> this is <b>NOT</b> the element index! Do <b>NOT</b> 1.39 @@ -235,6 +242,7 @@ 1.40 */ 1.41 #define ucx_map_sstr_put(map, key, value) \ 1.42 ucx_map_put(map, ucx_key(key.ptr, key.length), (void*)value) 1.43 + 1.44 /** 1.45 * Shorthand for putting data with a C string key into the map. 1.46 * @param map the map 1.47 @@ -245,6 +253,7 @@ 1.48 */ 1.49 #define ucx_map_cstr_put(map, key, value) \ 1.50 ucx_map_put(map, ucx_key((void*)key, strlen(key)), (void*)value) 1.51 + 1.52 /** 1.53 * Shorthand for putting data with an integer key into the map. 1.54 * @param map the map 1.55 @@ -256,7 +265,6 @@ 1.56 #define ucx_map_int_put(map, key, value) \ 1.57 ucx_map_put(map, ucx_key((void*)&key, sizeof(key)), (void*)value) 1.58 1.59 - 1.60 /** 1.61 * Shorthand for getting data from the map with a sstr_t key. 1.62 * @param map the map 1.63 @@ -266,6 +274,7 @@ 1.64 */ 1.65 #define ucx_map_sstr_get(map, key) \ 1.66 ucx_map_get(map, ucx_key(key.ptr, key.length)) 1.67 + 1.68 /** 1.69 * Shorthand for getting data from the map with a C string key. 1.70 * @param map the map 1.71 @@ -275,6 +284,7 @@ 1.72 */ 1.73 #define ucx_map_cstr_get(map, key) \ 1.74 ucx_map_get(map, ucx_key((void*)key, strlen(key))) 1.75 + 1.76 /** 1.77 * Shorthand for getting data from the map with an integer key. 1.78 * @param map the map 1.79 @@ -284,6 +294,7 @@ 1.80 */ 1.81 #define ucx_map_int_get(map, key) \ 1.82 ucx_map_get(map, ucx_key((void*)&key, sizeof(int))) 1.83 + 1.84 /** 1.85 * Shorthand for removing data from the map with a sstr_t key. 1.86 * @param map the map 1.87 @@ -293,6 +304,7 @@ 1.88 */ 1.89 #define ucx_map_sstr_remove(map, key) \ 1.90 ucx_map_remove(map, ucx_key(key.ptr, key.length)) 1.91 + 1.92 /** 1.93 * Shorthand for removing data from the map with a C string key. 1.94 * @param map the map 1.95 @@ -302,6 +314,7 @@ 1.96 */ 1.97 #define ucx_map_cstr_remove(map, key) \ 1.98 ucx_map_remove(map, ucx_key((void*)key, strlen(key))) 1.99 + 1.100 /** 1.101 * Shorthand for removing data from the map with an integer key. 1.102 * @param map the map