Coconut Framework  beta
Classes | Functions
CNFixedObjectArray.h File Reference

Define CNFixedObjectArray data structure. More...

#include "CNFixedArray.h"
#include "CNObject.h"

Go to the source code of this file.

Classes

struct  CNFixedObjectArray
 Array of instances. More...
 

Functions

static void CNInitFixedObjectArray (struct CNFixedObjectArray *dst, uint64_t maxnum, struct CNResource *resource)
 Initialize instance array. More...
 
void CNDestroyFixedObjectArray (struct CNFixedObjectArray *dst)
 Destroy instance array. More...
 
static uint64_t CNCountOfFixedObjectArray (const struct CNFixedObjectArray *src)
 Get the count of elements in the array. More...
 
static void CNSetObjectToFixedObjectArray (struct CNFixedObjectArray *dst, unsigned int index, struct CNObject *src)
 Set objectto the array at the given index. More...
 
static struct CNObjectCNObjectInFixedObjectArray (const struct CNFixedObjectArray *src, unsigned int index)
 Get object in the array. More...
 
struct CNObjectList CNElementListOfFixedObjectArray (const struct CNFixedObjectArray *src, struct CNResource *resource)
 Make object list of array. More...
 
static CNBoolean CNVisitElementOfFixedObjectArray (const struct CNFixedObjectArray *src, CNVisitElementOfFixedArrayFuncRef visitfunc, void *info)
 Visit all elements in the array. More...
 

Detailed Description

Define CNFixedObjectArray data structure.

Copyright
Copyright (C) 2013 Steel Wheels Project

Function Documentation

static void CNInitFixedObjectArray ( struct CNFixedObjectArray dst,
uint64_t  maxnum,
struct CNResource *  resource 
)
inlinestatic

Initialize instance array.

Parameters
dstDestination array
maxnumMax number of elements
resourceResource to allocate the array

References CNInitFixedArray(), and CNFixedObjectArray::coreArray.

void CNDestroyFixedObjectArray ( struct CNFixedObjectArray dst)

Destroy instance array.

Parameters
dstDestination array
static uint64_t CNCountOfFixedObjectArray ( const struct CNFixedObjectArray src)
inlinestatic

Get the count of elements in the array.

Returns
Count of elements
Parameters
srcSource array

References CNCountOfFixedArray(), and CNFixedObjectArray::coreArray.

static void CNSetObjectToFixedObjectArray ( struct CNFixedObjectArray dst,
unsigned int  index,
struct CNObject src 
)
inlinestatic

Set objectto the array at the given index.

Parameters
dstDestination array
indexIndex of the array to set
srcSouce object to be set
Note
The source object is retained in this function

References CNReleaseObject(), CNRetainObject(), CNSetPointerToFixedArray(), and CNFixedObjectArray::coreArray.

static struct CNObject* CNObjectInFixedObjectArray ( const struct CNFixedObjectArray src,
unsigned int  index 
)
static

Get object in the array.

Return values
insanceInstance in the array
nullNo instance at the given index
Parameters
srcSource instance array
indexIndex to choose element

References CNPointerInFixedArray(), and CNFixedObjectArray::coreArray.

struct CNObjectList CNElementListOfFixedObjectArray ( const struct CNFixedObjectArray src,
struct CNResource *  resource 
)

Make object list of array.

Returns
List of elements
Parameters
srcSource object array
resourceResource to allocate the list
static CNBoolean CNVisitElementOfFixedObjectArray ( const struct CNFixedObjectArray src,
CNVisitElementOfFixedArrayFuncRef  visitfunc,
void *  info 
)
inlinestatic

Visit all elements in the 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

References CNVisitElementOfFixedArray(), and CNFixedObjectArray::coreArray.