Detailed Description
Macros used to quickly define array structures.
Introduction
Array structures contain an array of fixed size items, along with the number of items and the capacity of the array. This makes passing it around much simpler as the extra information can be passed with it.
The macros also allow additional members to the added to the structure.
Collaboration diagram for Arrays:
Macros | |
| #define | FIFTYONE_DEGREES_ARRAY_TYPE(t, m) |
| Simple array structure definition macro used for generic types. | |
| #define | FIFTYONE_DEGREES_ARRAY_SIZE(t, c) |
| Works out the size of the array with a given capacity for the type. | |
| #define | FIFTYONE_DEGREES_ARRAY_CREATE(t, i, c) |
| Initialises the array. | |
Macro Definition Documentation
◆ FIFTYONE_DEGREES_ARRAY_CREATE
| #define FIFTYONE_DEGREES_ARRAY_CREATE | ( | t, | |
| i, | |||
| c ) |
Value:
i = (t##Array*)fiftyoneDegreesMalloc(FIFTYONE_DEGREES_ARRAY_SIZE(t,c)); \
if (i != NULL) { \
i->items = c ? (t*)(i + 1) : NULL; \
i->count = 0; \
i->capacity = c; \
}
#define FIFTYONE_DEGREES_ARRAY_SIZE(t, c)
Works out the size of the array with a given capacity for the type.
Definition array.h:67
EXTERNAL_VAR void *(* fiftyoneDegreesMalloc)(size_t __size)
Pointer to the method used to allocate memory.
Definition memory.h:186
Initialises the array.
◆ FIFTYONE_DEGREES_ARRAY_SIZE
| #define FIFTYONE_DEGREES_ARRAY_SIZE | ( | t, | |
| c ) |
Value:
(sizeof(t##Array) + (sizeof(t) * (c)))
Works out the size of the array with a given capacity for the type.
◆ FIFTYONE_DEGREES_ARRAY_TYPE
| #define FIFTYONE_DEGREES_ARRAY_TYPE | ( | t, | |
| m ) |
Value:
\
typedef struct fiftyone_degrees_array_##t##_t { \
uint32_t count; \
uint32_t capacity; \
t* items; \
m \
} t##Array;
Simple array structure definition macro used for generic types.
- Parameters
-
t type of item m additional members
