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.

Classes

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

Typedefs

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

Functions

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
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.

Parameters
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.

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

Get resource of fixed array.

Returns
Resource of fixed array
Parameters
srcSource array

References CNFixedArray::resource.

static uint64_t CNCountOfFixedArray ( const struct CNFixedArray src)
inlinestatic

Get the count of elements in the fixed array.

Returns
Count of elements
Parameters
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.

Returns
Original value in the element
Parameters
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
Parameters
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.

Returns
List of elements
Parameters
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
Parameters
srcSource array
visitfuncFunction which is called foreach elements
infoAdditiona parameter for visit function

Referenced by CNVisitElementOfFixedObjectArray().