ucx/cx/collection.h

changeset 38
27fadadaae31
parent 31
287484519844
equal deleted inserted replaced
37:81dfb9a43a38 38:27fadadaae31
38 38
39 #include "allocator.h" 39 #include "allocator.h"
40 #include "iterator.h" 40 #include "iterator.h"
41 #include "compare.h" 41 #include "compare.h"
42 42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46
47 /** 43 /**
48 * Special constant used for creating collections that are storing pointers. 44 * Special constant used for creating collections that are storing pointers.
49 */ 45 */
50 #define CX_STORE_POINTERS 0 46 #define CX_STORE_POINTERS 0
51 47
314 */ 310 */
315 #define cx_invoke_destructor(c, e) \ 311 #define cx_invoke_destructor(c, e) \
316 if ((c)->collection.simple_destructor) cx_invoke_simple_destructor(c,e); \ 312 if ((c)->collection.simple_destructor) cx_invoke_simple_destructor(c,e); \
317 if ((c)->collection.advanced_destructor) cx_invoke_advanced_destructor(c,e) 313 if ((c)->collection.advanced_destructor) cx_invoke_advanced_destructor(c,e)
318 314
319 #ifdef __cplusplus 315 /**
320 } // extern "C" 316 * Invokes all available destructor functions for a specific element.
321 #endif 317 *
318 * Usually only used by collection implementations. There should be no need
319 * to invoke this macro manually.
320 *
321 * In contrast to cx_invoke_destructor(), this macro does not automatically
322 * dereference pointers to the elements when cxCollectionStoresPointers()
323 * returns true.
324 *
325 * @param c a pointer to a struct that contains #CX_COLLECTION_BASE
326 * @param e pointer to the element
327 */
328 #define cx_invoke_destructor_raw(c, e) \
329 if ((c)->collection.simple_destructor) (c)->collection.simple_destructor(e); \
330 if ((c)->collection.advanced_destructor) (c)->collection.advanced_destructor((c)->collection.destructor_data, e)
331
322 332
323 #endif // UCX_COLLECTION_H 333 #endif // UCX_COLLECTION_H

mercurial