Coconut Framework  beta
Classes | Typedefs | Functions
CNFixedArray.h File Reference

Define CNFixedArray data structure. More...

#include "CNForwarders.h"
#include "CNType.h"
#include <stdint.h>

Go to the source code of this file.


struct  CNFixedArray
 Array of fixed number of pointers. More...


typedef CNBoolean(* CNVisitElementOfFixedArrayFuncRef )(uint64_t index, void *src, void *info)


void CNInitFixedArray (struct CNFixedArray *dst, uint64_t maxnum, struct CNResource *resource)
 Initialize pointer array. More...
void CNDestroyFixedArray (struct CNFixedArray *dst)
 Release all resource the fixed array. More...
static struct CNResource * CNResourceOfFixedArray (const struct CNFixedArray *src)
 Get resource of fixed array. More...
static uint64_t CNCountOfFixedArray (const struct CNFixedArray *src)
 Get the count of elements in the fixed array. More...
void * CNSetPointerToFixedArray (struct CNFixedArray *dst, uint64_t index, void *src)
 Set pointer to the array at the given index. More...
void * CNPointerInFixedArray (const struct CNFixedArray *src, uint64_t index)
 Get element in the fixed array. More...
struct CNList CNElementListOfFixedArray (const struct CNFixedArray *src, struct CNResource *resource)
 Make element list of array. More...
CNBoolean CNVisitElementOfFixedArray (const struct CNFixedArray *src, CNVisitElementOfFixedArrayFuncRef visitfunc, void *info)
 Visit all elements in the fixed array. More...

Detailed Description

Define CNFixedArray data structure.

Copyright (C) 2013 Steel Wheels Project

Typedef Documentation

typedef CNBoolean(* CNVisitElementOfFixedArrayFuncRef)(uint64_t index, void *src, void *info)

The function to visit the element in CNArray

Function Documentation

void CNInitFixedArray ( struct CNFixedArray dst,
uint64_t  maxnum,
struct CNResource *  resource 

Initialize pointer array.

dstDestination fixed array
maxnumMax number of elements
resourceResource to allocate array

Referenced by CNInitFixedObjectArray().

void CNDestroyFixedArray ( struct CNFixedArray dst)

Release all resource the fixed array.

dstDestination fixed array
static struct CNResource* CNResourceOfFixedArray ( const struct CNFixedArray src)

Get resource of fixed array.

Resource of fixed array
srcSource array

References CNFixedArray::resource.

static uint64_t CNCountOfFixedArray ( const struct CNFixedArray src)

Get the count of elements in the fixed array.

Count of elements
srcSource fixed array

References CNFixedArray::maxNum.

Referenced by CNCountOfFixedObjectArray().

void* CNSetPointerToFixedArray ( struct CNFixedArray dst,
uint64_t  index,
void *  src 

Set pointer to the array at the given index.

Original value in the element
dstDestination fixed array
indexIndex to set the source
srcSource pointer

Referenced by CNSetObjectToFixedObjectArray().

void* CNPointerInFixedArray ( const struct CNFixedArray src,
uint64_t  index 

Get element in the fixed array.

Return values
ptrElement of the fixed array.
NULLThe element has NULL pointer or the index is out of range
srcSource pointer array
indexIndex for array access

Referenced by CNObjectInFixedObjectArray().

struct CNList CNElementListOfFixedArray ( const struct CNFixedArray src,
struct CNResource *  resource 

Make element list of array.

List of elements
srcSource object array
resourceResource to allocate the list
CNBoolean CNVisitElementOfFixedArray ( const struct CNFixedArray src,
CNVisitElementOfFixedArrayFuncRef  visitfunc,
void *  info 

Visit all elements in the fixed array.

Return values
TRUEAll elements are visited
FALSEAll elements are NOT visited
srcSource array
visitfuncFunction which is called foreach elements
infoAdditiona parameter for visit function

Referenced by CNVisitElementOfFixedObjectArray().