Coconut Framework
beta
|
Define CNArray data structure. More...
Go to the source code of this file.
Classes | |
struct | CNArray |
Array of pointers. More... | |
Typedefs | |
typedef CNBoolean(* | CNVisitElementOfArrayFuncRef )(uint64_t index, void *src, void *info) |
Functions | |
void | CNInitArray (struct CNArray *dst, struct CNResource *resource) |
Initialize array. More... | |
void | CNDestroyArray (struct CNArray *dst) |
Release all resource the array. More... | |
static struct CNResource * | CNResourceOfArray (const struct CNArray *src) |
Get resource of array. More... | |
static uint64_t | CNCountOfArray (const struct CNArray *src) |
Get the count of elements in the array. More... | |
void * | CNSetPointerToArray (struct CNArray *dst, uint64_t index, void *src) |
Set pointer to the array at the given index. More... | |
static void | CNAddPointerToArray (struct CNArray *dst, void *src) |
Add pointer as the last element of the array. More... | |
void * | CNPointerInArray (const struct CNArray *src, uint64_t index) |
Get element in the array. More... | |
CNBoolean | CNVisitElementOfArray (const struct CNArray *src, CNVisitElementOfArrayFuncRef visitfunc, void *info) |
Visit all elements in the array. More... | |
Define CNArray data structure.
typedef CNBoolean(* CNVisitElementOfArrayFuncRef)(uint64_t index, void *src, void *info) |
The function to visit the element in CNArray
void CNInitArray | ( | struct CNArray * | dst, |
struct CNResource * | resource | ||
) |
Initialize array.
dst | Destination array |
resource | Resource to allocate array |
Referenced by CNInitObjectArray().
void CNDestroyArray | ( | struct CNArray * | dst | ) |
Release all resource the array.
dst | Destination array |
|
static |
Get resource of array.
src | Source array |
References CNArray::resource.
Referenced by CNResourceOfObjectArray().
|
inlinestatic |
Get the count of elements in the array.
src | Source array |
References CNArray::currentNum.
Referenced by CNCountOfObjectArray().
void* CNSetPointerToArray | ( | struct CNArray * | dst, |
uint64_t | index, | ||
void * | src | ||
) |
Set pointer to the array at the given index.
dst | Destination array |
index | Index to set the source |
src | Source pointer |
Referenced by CNAddObjectToArray(), CNAddPointerToArray(), and CNSetObjectToArray().
|
inlinestatic |
Add pointer as the last element of the array.
dst | Destination array |
src | Source pointer |
References CNSetPointerToArray(), and CNArray::currentNum.
void* CNPointerInArray | ( | const struct CNArray * | src, |
uint64_t | index | ||
) |
Get element in the array.
ptr | Element of the array. |
NULL | The element has NULL pointer or the index is out of range |
src | Source array |
index | Index for array access |
Referenced by CNObjectInArray().
CNBoolean CNVisitElementOfArray | ( | const struct CNArray * | src, |
CNVisitElementOfArrayFuncRef | visitfunc, | ||
void * | info | ||
) |
Visit all elements in the array.
TRUE | All elements are visited |
FALSE | All elements are NOT visited |
src | Source array |
visitfunc | Function which is called foreach elements |
info | Additiona parameter for visit function |
Referenced by CNVisitElementOfObjectArray().