Coconut Framework  beta
Classes | Functions
CNObjectArray.h File Reference

Define CNObjectArray data structure. More...

#include "CNArray.h"
#include "CNObject.h"

Go to the source code of this file.

Classes

struct  CNObjectArray
 Array of instances. More...
 

Functions

static void CNInitObjectArray (struct CNObjectArray *dst, struct CNResource *resource)
 Initialize instance array. More...
 
void CNDestroyObjectArray (struct CNObjectArray *dst)
 Destroy instance array. More...
 
static struct CNResource * CNResourceOfObjectArray (struct CNObjectArray *src)
 Get resource of object array. More...
 
static uint64_t CNCountOfObjectArray (const struct CNObjectArray *src)
 Get the count of elements in the array. More...
 
static void CNSetObjectToArray (struct CNObjectArray *dst, uint64_t index, struct CNObject *src)
 Set objectto the array at the given index. More...
 
static void CNAddObjectToArray (struct CNObjectArray *dst, struct CNObject *src)
 Add object as the last element of the array. More...
 
static struct CNObjectCNObjectInArray (const struct CNObjectArray *src, uint64_t index)
 Get object in the array. More...
 
struct CNObjectList CNElementListOfObjectArray (const struct CNObjectArray *src, struct CNResource *resource)
 Make object list of array. More...
 
static CNBoolean CNVisitElementOfObjectArray (const struct CNObjectArray *src, CNVisitElementOfArrayFuncRef visitfunc, void *info)
 Visit all elements in the array. More...
 

Detailed Description

Define CNObjectArray data structure.

Copyright
Copyright (C) 2011 Steel Wheels Project

Function Documentation

static void CNInitObjectArray ( struct CNObjectArray dst,
struct CNResource *  resource 
)
inlinestatic

Initialize instance array.

Parameters
dstDestination array
resourceResource to allocate the array

References CNInitArray(), and CNObjectArray::coreArray.

void CNDestroyObjectArray ( struct CNObjectArray dst)

Destroy instance array.

Parameters
dstDestination array
static struct CNResource* CNResourceOfObjectArray ( struct CNObjectArray src)
static

Get resource of object array.

Returns
Resource of object array
Parameters
srcSource object array

References CNResourceOfArray(), and CNObjectArray::coreArray.

static uint64_t CNCountOfObjectArray ( const struct CNObjectArray src)
inlinestatic

Get the count of elements in the array.

Returns
Count of elements
Parameters
srcSource array

References CNCountOfArray(), and CNObjectArray::coreArray.

Referenced by CNAddObjectToArray().

static void CNSetObjectToArray ( struct CNObjectArray dst,
uint64_t  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(), CNSetPointerToArray(), and CNObjectArray::coreArray.

static void CNAddObjectToArray ( struct CNObjectArray dst,
struct CNObject src 
)
inlinestatic

Add object as the last element of the array.

Parameters
dstDestination array
srcSource pointer

References CNCountOfObjectArray(), CNRetainObject(), CNSetPointerToArray(), and CNObjectArray::coreArray.

static struct CNObject* CNObjectInArray ( const struct CNObjectArray src,
uint64_t  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 CNPointerInArray(), and CNObjectArray::coreArray.

struct CNObjectList CNElementListOfObjectArray ( const struct CNObjectArray src,
struct CNResource *  resource 
)

Make object list of array.

Returns
List of elements
Parameters
srcSource object array
resourceResource to allocate the list
static CNBoolean CNVisitElementOfObjectArray ( const struct CNObjectArray src,
CNVisitElementOfArrayFuncRef  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 CNVisitElementOfArray(), and CNObjectArray::coreArray.