src/cx/map.h

changeset 685
2dd841e364af
parent 681
502105523db7
child 686
64919f63f059
equal deleted inserted replaced
684:380bd45bc94a 685:2dd841e364af
54 /** Type for map class definitions. */ 54 /** Type for map class definitions. */
55 typedef struct cx_map_class_s cx_map_class; 55 typedef struct cx_map_class_s cx_map_class;
56 56
57 /** Structure for the UCX map. */ 57 /** Structure for the UCX map. */
58 struct cx_map_s { 58 struct cx_map_s {
59 CX_COLLECTION_MEMBERS
59 /** The map class definition. */ 60 /** The map class definition. */
60 cx_map_class *cl; 61 cx_map_class *cl;
61 /** An allocator that is used for the map elements. */
62 CxAllocator *allocator;
63 /** The number of elements currently stored. */
64 size_t size;
65 /**
66 * The size of an element.
67 */
68 size_t item_size;
69 /**
70 * True, if this map shall store pointers instead
71 * of copies of objects.
72 */
73 bool store_pointers;
74 }; 62 };
75 63
76 /** 64 /**
77 * The class definition for arbitrary maps. 65 * The class definition for arbitrary maps.
78 */ 66 */
177 * @param map the map 165 * @param map the map
178 * @see cxMapStorePointers() 166 * @see cxMapStorePointers()
179 */ 167 */
180 __attribute__((__nonnull__)) 168 __attribute__((__nonnull__))
181 static inline void cxMapStoreObjects(CxMap *map) { 169 static inline void cxMapStoreObjects(CxMap *map) {
182 map->store_pointers = false; 170 map->store_pointer = false;
183 } 171 }
184 172
185 /** 173 /**
186 * Advises the map to only store pointers to the objects. 174 * Advises the map to only store pointers to the objects.
187 * 175 *
194 * @param map the map 182 * @param map the map
195 * @see cxMapStoreObjects() 183 * @see cxMapStoreObjects()
196 */ 184 */
197 __attribute__((__nonnull__)) 185 __attribute__((__nonnull__))
198 static inline void cxMapStorePointers(CxMap *map) { 186 static inline void cxMapStorePointers(CxMap *map) {
199 map->store_pointers = true; 187 map->store_pointer = true;
200 map->item_size = sizeof(void *); 188 map->item_size = sizeof(void *);
201 } 189 }
202 190
203 191
204 /** 192 /**

mercurial