clist.h File Reference

#include <cybergarage/typedef.h>

Data Structures

struct  _CgList
 The generic list interface in CyberLinkC. More...

Defines

#define cg_list_gets(headList)   cg_list_next(headList)

Typedefs

typedef void(*) CG_LIST_DESTRUCTORFUNC (void *)
typedef _CgList CgList
 The generic list interface in CyberLinkC.

Functions

void cg_list_header_init (CgList *list)
void cg_list_node_init (CgList *list)
void cg_list_insert (CgList *prevList, CgList *list)
void cg_list_add (CgList *headList, CgList *list)
void cg_list_remove (CgList *list)
int cg_list_size (CgList *headList)
CgListcg_list_get (CgList *headList, int index)
CgListcg_list_prev_circular (CgList *list)
CgListcg_list_prev (CgList *list)
CgListcg_list_next_circular (CgList *list)
CgListcg_list_next (CgList *list)
void cg_list_clear (CgList *headList, CG_LIST_DESTRUCTORFUNC destructorFunc)

Define Documentation

#define cg_list_gets ( headList   )     cg_list_next(headList)

Get the first actual item from a list for iteration

Parameters:
headList List header


Typedef Documentation

typedef void(*) CG_LIST_DESTRUCTORFUNC(void *)

Prototype for individual list node destructor functions

typedef struct _CgList CgList

The generic list interface in CyberLinkC.

Each struct in CyberLinkC, that is designed to be a part of a list, must have these elements in their definition before the actual struct definition. The struct pointers are then cast to CgList* and operated with cg_list_* functions.


Function Documentation

void cg_list_add ( CgList headList,
CgList list 
)

Todo:
This works essentially like insert, although it is more error-prone?!

There might be a bug in this function.

void cg_list_clear ( CgList headList,
CG_LIST_DESTRUCTORFUNC  destructorFunc 
)

Clear the list and delete all of its contents with CG_LIST_DESTRUCTORFUNC

Parameters:
headList List header
destructorFunc Function pointer that clears the contents of individual nodes

CgList* cg_list_get ( CgList headList,
int  index 
)

Get an item from the list by the item's index

Parameters:
headList List header
index The index of the item to get

void cg_list_header_init ( CgList list  ) 

Initialize a list node to act as the first node

Parameters:
list List node

void cg_list_insert ( CgList prevList,
CgList list 
)

Insert a list node or a complete list structure after the given node

Parameters:
prevList Insert after this node
list List node or list structure to insert

CgList* cg_list_next ( CgList list  ) 

Get the next node. Returns NULL if end has been reached.

Parameters:
list Current node

CgList* cg_list_next_circular ( CgList list  ) 

Get the next node. Wrap around if the end has been reached.

Parameters:
list Current node

void cg_list_node_init ( CgList list  ) 

Initialize a list node to act as a regular node, part of a list.

Parameters:
list List node

CgList* cg_list_prev ( CgList list  ) 

Get the previous node. Returns NULL if beginning has been reached

Parameters:
list Current node

CgList* cg_list_prev_circular ( CgList list  ) 

Get the previous node. Wrap around if the beginning has been reached.

Parameters:
list Current node

void cg_list_remove ( CgList list  ) 

Remove a node from a list. Does not free any memory, but only removes the next and previous link associations regarding the given node.

Parameters:
list List node to remove

int cg_list_size ( CgList headList  ) 

Get the number of nodes in the current list structure. Counts forwards from the given node, so if you want to get the complete size, give a header node as the parameter.

Parameters:
headList List header


Generated on Tue Aug 8 14:56:29 2006 for CyberLinkC by  doxygen 1.4.7