Coconut Framework  beta
Classes | Functions
CNObjectList.h File Reference

Define CNObjectList data structure. More...

#include "CNList.h"
#include "CNObject.h"

Go to the source code of this file.

Classes

struct  CNObjectList
 List of CNObject. More...
 

Functions

static struct CNObjectList CNMakeEmptyObjectList (struct CNResource *resource)
 Initialize CNObjectList. More...
 
void CNDestroyObjectList (struct CNObjectList *dst)
 Destroy CNObject(s) in the list and list items. More...
 
static size_t CNCountOfObjectsInList (const struct CNObjectList *src)
 Get count of items in the object list. More...
 
static struct CNListItemCNFirstListObject (const struct CNObjectList *src)
 Get 1st item in the list. More...
 
static struct CNListItemCNLastListObject (const struct CNObjectList *src)
 Get last item in the list. More...
 
static struct CNListItemCNCentinelListObject (const struct CNObjectList *src)
 Get centinel item of the list. More...
 
static void CNAppendObjectToList (struct CNObjectList *dst, struct CNObject *src)
 Append object to the list. More...
 
static void CNPrependObjectToList (struct CNObjectList *dst, struct CNObject *src)
 Prepend object to the list. More...
 
struct CNObjectList CNCopyObjectList (const struct CNObjectList *src)
 Make the copy of source object list. More...
 
static void CNInsertObjectToList (struct CNObjectList *dst, struct CNListItem *prev, struct CNObject *src)
 Insert item to the list. More...
 
void CNInsertObjectsToList (struct CNObjectList *owner, struct CNListItem *prev, const struct CNObjectList *src)
 Insert objects to the list. More...
 
static struct CNObjectCNUnlinkObjectFromList (struct CNObjectList *owner, struct CNListItem *dst)
 Unlink an item from the list and return it's data. More...
 
static struct CNObjectCNUnlinkFirstObjectFromList (struct CNObjectList *dst)
 Get 1st object in the list. More...
 
static struct CNObjectCNUnlinkLastObjectFromList (struct CNObjectList *dst)
 Get last object in the list. More...
 
static void CNMoveObjectList (struct CNObjectList *dst, struct CNObjectList *src)
 Move objects from source to destination. More...
 
void CNAppendObjectsToList (struct CNObjectList *dst, struct CNObjectList *src)
 Copy objects from source to destination. More...
 
static struct CNListItemCNSearchObjectInList (const struct CNObjectList *list, struct CNObject *obj)
 Search list item which has source data reference. More...
 
static struct CNListItemCNSearchMatchedObjectInList (const struct CNObjectList *list, CNMatchDataFuncRef func, void *info)
 Search object which matched source data. More...
 
CNBoolean CNDeleteObjectInList (struct CNObjectList *dst, struct CNObject *obj)
 Delete object in the list. More...
 

Detailed Description

Define CNObjectList data structure.

Copyright
Copyright (C) 2012 Steel Wheels Project

Function Documentation

static struct CNObjectList CNMakeEmptyObjectList ( struct CNResource *  resource)
static

Initialize CNObjectList.

Returns
Initialized list
Parameters
resourceResource for the list

References CNMakeEmptyList(), and CNObjectList::objectList.

void CNDestroyObjectList ( struct CNObjectList dst)

Destroy CNObject(s) in the list and list items.

Parameters
dstDestination list

Referenced by CNDestroyContextOfNode().

static size_t CNCountOfObjectsInList ( const struct CNObjectList src)
inlinestatic

Get count of items in the object list.

Returns
Count of the object
Parameters
srcSource object list

References CNCountOfItemsInList(), and CNObjectList::objectList.

Referenced by CNCountOfConsumerEdges(), CNCountOfNodesInGraph(), and CNCountOfProducerEdges().

static struct CNListItem* CNFirstListObject ( const struct CNObjectList src)
static

Get 1st item in the list.

Returns
First item
Parameters
srcSource list

References CNFirstListItem(), and CNObjectList::objectList.

Referenced by CNFirstConsumerEdgeInNode(), CNFirstEdgeInGraph(), CNFirstNodeInGraph(), and CNFirstProducerEdgeInNode().

static struct CNListItem* CNLastListObject ( const struct CNObjectList src)
static

Get last item in the list.

Returns
Last item
Parameters
srcSource list

References CNLastListItem(), and CNObjectList::objectList.

static struct CNListItem* CNCentinelListObject ( const struct CNObjectList src)
static

Get centinel item of the list.

Returns
Centinel item
Parameters
srcSource list

References CNCentinelListItem(), and CNObjectList::objectList.

Referenced by CNCentinelConsumerEdgeInNode(), CNCentinelEdgeInGraph(), CNCentinelNodeInGraph(), and CNCentinelProducerEdgeInNode().

static void CNAppendObjectToList ( struct CNObjectList dst,
struct CNObject src 
)
inlinestatic

Append object to the list.

Parameters
dstDestination list
srcSource object

References CNAppendItemToList(), CNRetainObject(), and CNObjectList::objectList.

static void CNPrependObjectToList ( struct CNObjectList dst,
struct CNObject src 
)
inlinestatic

Prepend object to the list.

Parameters
dstDestination list
srcSource object

References CNPrependItemToList(), CNRetainObject(), and CNObjectList::objectList.

struct CNObjectList CNCopyObjectList ( const struct CNObjectList src)

Make the copy of source object list.

Returns
Copied list
Parameters
srcSource list
static void CNInsertObjectToList ( struct CNObjectList dst,
struct CNListItem prev,
struct CNObject src 
)
inlinestatic

Insert item to the list.

Parameters
dstDestination list
prevItem in the owner list, the source object will be linked as the next of this.
srcSource object

References CNInsertItemToList(), CNRetainObject(), and CNObjectList::objectList.

void CNInsertObjectsToList ( struct CNObjectList owner,
struct CNListItem prev,
const struct CNObjectList src 
)

Insert objects to the list.

Parameters
ownerDestination list
prevItem in the owner list, the source data will be linked as the next of this.
srcSource data list
static struct CNObject* CNUnlinkObjectFromList ( struct CNObjectList owner,
struct CNListItem dst 
)
static

Unlink an item from the list and return it's data.

Returns
Data for unlinked item
Parameters
ownerDestination list
dstDestination list item to be removed

References CNUnlinkItemFromList(), and CNObjectList::objectList.

static struct CNObject* CNUnlinkFirstObjectFromList ( struct CNObjectList dst)
static

Get 1st object in the list.

Return values
objPointer of the 1st object
NULLThere are not objects in the list
Parameters
dstSource and destination list After this operation, the 1st item is removed from list

References CNUnlinkFirstItemFromList(), and CNObjectList::objectList.

static struct CNObject* CNUnlinkLastObjectFromList ( struct CNObjectList dst)
static

Get last object in the list.

Return values
objPointer of the 1st object
NULLThere are not objects in the list
Parameters
dstSource and destination list After this operation, the last item is removed from list

References CNUnlinkLastItemFromList(), and CNObjectList::objectList.

static void CNMoveObjectList ( struct CNObjectList dst,
struct CNObjectList src 
)
inlinestatic

Move objects from source to destination.

Parameters
dstDestination list
srcSource list

References CNMoveList(), and CNObjectList::objectList.

void CNAppendObjectsToList ( struct CNObjectList dst,
struct CNObjectList src 
)

Copy objects from source to destination.

Parameters
dstDestination list
srcSource list
static struct CNListItem* CNSearchObjectInList ( const struct CNObjectList list,
struct CNObject obj 
)
static

Search list item which has source data reference.

Return values
listitemThe list item which has source data
NULLThere are no list item
Parameters
listList to be searched
objSource object

References CNSearchDataInList(), and CNObjectList::objectList.

static struct CNListItem* CNSearchMatchedObjectInList ( const struct CNObjectList list,
CNMatchDataFuncRef  func,
void *  info 
)
static

Search object which matched source data.

Return values
listitemThe list item which mached with source data
NULLThere are no list item
Parameters
listList to be searched
funcMaching function
infoMaching information

References CNSearchMatchedDataInList(), and CNObjectList::objectList.

CNBoolean CNDeleteObjectInList ( struct CNObjectList dst,
struct CNObject obj 
)

Delete object in the list.

Return values
TrueSource object is found in list and it is removed
FalseSource object is NOT found in the list
Parameters
dstSource list
objSource object