Main Page   Data Structures   File List   Data Fields   Globals  

ds_list.h

Go to the documentation of this file.
00001 #ifndef __DS_LIST_H__
00002 #define __DS_LIST_H__
00003 
00004 #include "ds_common.h"
00005 
00006 #ifdef __cplusplus
00007 extern "C" {
00008 #endif /* __cplusplus */
00009 
00011 typedef struct Node {
00012     struct Node *pNext; 
00013     struct Node *pPrev; 
00017     int index; 
00018     void *pData; 
00019 } Node;
00020 
00022 typedef struct ListWorkspace {
00023     Node *pNodes; 
00024     bool *pUsage; 
00025     int iNext; 
00026     int iSize; 
00027 } ListWorkspace;
00028 
00030 typedef struct List {
00031     long lSize; 
00032     ListWorkspace WS; 
00033     Node *pHead; 
00034     Node *pTail; 
00035 } List;
00036 
00056 List* ListCreate(int iWSSize);
00068 void ListDestroy(List *pList);
00080 Node* ListPushFront(List *pList, void *pData);
00092 Node* ListPushBack(List *pList, void *pData);
00105 Node* ListInsertBefore(List *pList, Node *pNode, void *pData);
00118 Node* ListInsertAfter(List *pList, Node *pNode, void *pData);
00144 Node* ListFind(Node *pStart, void *pData, bool bDirection);
00153 void ListRemove(List *pList, Node *pNode);
00154 
00158 #define ListPopBack(pList) ListRemove(pList, pList->pTail)
00159 
00162 #define ListPopFront(pList) ListRemove(pList, pList->pHead)
00163 
00164 #ifdef __cplusplus
00165 } /* extern "C" block */
00166 #endif /* __cplusplus */
00167 
00168 #endif /* __DS_LIST_H__ */

Generated at Sun Sep 30 00:21:33 2001 for DSLib by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001