\r\n

51Degrees Device Detection C/C++  4.4

A device detection library that is used natively or by 51Degrees products

Arrays

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. More...
#define  FIFTYONE_DEGREES_ARRAY_SIZE(t, c)   (sizeof(t##Array) + (sizeof(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. More...

Macro Definition Documentation

◆ FIFTYONE_DEGREES_ARRAY_CREATE

#define FIFTYONE_DEGREES_ARRAY_CREATE (   t,
  i,
  c  
)
Value:
i = (t##Array*)Malloc(FIFTYONE_DEGREES_ARRAY_SIZE(t,c)); \
if (i != NULL) { \
i->items = (t*)(i + 1); \
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:61
#define Malloc
Synonym for fiftyoneDegreesMalloc function.
Definition: fiftyone.h:227

Initialises the array.

◆ 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
On This Page