|
#define | CX_STORE_POINTERS 0 |
| Special constant used for creating collections that are storing pointers.
|
|
#define | CX_COLLECTION_BASE struct cx_collection_s collection |
| Use this macro to declare common members for a collection structure.
|
|
#define | cxCollectionSize(c) ((c)->collection.size) |
| Returns the number of elements currently stored.
|
|
#define | cxCollectionElementSize(c) ((c)->collection.elem_size) |
| Returns the size of one element.
|
|
#define | cxCollectionStoresPointers(c) ((c)->collection.store_pointer) |
| Indicates whether this collection only stores pointers instead of the actual data.
|
|
#define | cxCollectionSorted(c) ((c)->collection.sorted) |
| Indicates whether the collection can guarantee that the stored elements are currently sorted.
|
|
#define | cxDefineDestructor(c, destr) (c)->collection.simple_destructor = (cx_destructor_func) destr |
| Sets a simple destructor function for this collection.
|
|
#define | cxDefineAdvancedDestructor(c, destr, data) |
| Sets a simple destructor function for this collection.
|
|
#define | cx_invoke_simple_destructor(c, e) (c)->collection.simple_destructor((c)->collection.store_pointer ? (*((void **) (e))) : (e)) |
| Invokes the simple destructor function for a specific element.
|
|
#define | cx_invoke_advanced_destructor(c, e) |
| Invokes the advanced destructor function for a specific element.
|
|
#define | cx_invoke_destructor(c, e) |
| Invokes all available destructor functions for a specific element.
|
|
Common definitions for various collection implementations.
- Author
- Mike Becker
-
Olaf Wintermann
- Copyright
- 2-Clause BSD License
#define cx_invoke_advanced_destructor |
( |
| c, |
|
|
| e ) |
Value: (c)->collection.advanced_destructor((c)->collection.destructor_data, \
(c)->collection.store_pointer ? (*((void **) (e))) : (e))
Invokes the advanced destructor function for a specific element.
Usually only used by collection implementations. There should be no need to invoke this macro manually.
When the collection stores pointers, those pointers are directly passed to the destructor. Otherwise, a pointer to the element is passed.
- Parameters
-
c | a pointer to a struct that contains CX_COLLECTION_BASE |
e | the element (the type is void* or void** depending on context) |
#define cx_invoke_simple_destructor |
( |
| c, |
|
|
| e ) (c)->collection.simple_destructor((c)->collection.store_pointer ? (*((void **) (e))) : (e)) |
Invokes the simple destructor function for a specific element.
Usually only used by collection implementations. There should be no need to invoke this macro manually.
When the collection stores pointers, those pointers are directly passed to the destructor. Otherwise, a pointer to the element is passed.
- Parameters
-
c | a pointer to a struct that contains CX_COLLECTION_BASE |
e | the element (the type is void* or void** depending on context) |