676:d0680a23d850 | 677:b09aae58bba4 |
---|---|
35 */ | 35 */ |
36 | 36 |
37 #ifndef UCX_MAP_H | 37 #ifndef UCX_MAP_H |
38 #define UCX_MAP_H | 38 #define UCX_MAP_H |
39 | 39 |
40 #include "common.h" | 40 #include "collection.h" |
41 #include "allocator.h" | |
42 #include "iterator.h" | |
43 #include "hash_key.h" | 41 #include "hash_key.h" |
44 | 42 |
45 #ifdef __cplusplus | 43 #ifdef __cplusplus |
46 extern "C" { | 44 extern "C" { |
47 #endif | |
48 | |
49 #ifndef CX_STORE_POINTERS | |
50 /** | |
51 * Special constant used for creating collections that are storing pointers. | |
52 */ | |
53 #define CX_STORE_POINTERS 0 | |
54 #endif | 45 #endif |
55 | 46 |
56 /** Type for the UCX map. */ | 47 /** Type for the UCX map. */ |
57 typedef struct cx_map_s CxMap; | 48 typedef struct cx_map_s CxMap; |
58 | 49 |
71 /** The number of elements currently stored. */ | 62 /** The number of elements currently stored. */ |
72 size_t size; | 63 size_t size; |
73 /** | 64 /** |
74 * The size of an element. | 65 * The size of an element. |
75 */ | 66 */ |
76 size_t itemsize; | 67 size_t item_size; |
77 /** | 68 /** |
78 * True, if this map shall store pointers instead | 69 * True, if this map shall store pointers instead |
79 * of copies of objects. | 70 * of copies of objects. |
80 */ | 71 */ |
81 bool store_pointers; | 72 bool store_pointers; |
203 * @see cxMapStoreObjects() | 194 * @see cxMapStoreObjects() |
204 */ | 195 */ |
205 __attribute__((__nonnull__)) | 196 __attribute__((__nonnull__)) |
206 static inline void cxMapStorePointers(CxMap *map) { | 197 static inline void cxMapStorePointers(CxMap *map) { |
207 map->store_pointers = true; | 198 map->store_pointers = true; |
208 map->itemsize = sizeof(void *); | 199 map->item_size = sizeof(void *); |
209 } | 200 } |
210 | 201 |
211 | 202 |
212 /** | 203 /** |
213 * Deallocates the memory of the specified map. | 204 * Deallocates the memory of the specified map. |