#ifndef __List__H
#define __List__H

#include "WimpLib:std.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct ListNode ListNode;
typedef struct List List;

List*     New_List           (void) throws(mem);
void      Delete_List        (List*);

int       List_Count         (const List*);

ListNode* List_InsertAfter   (List*, ListNode* pNode, const void* pData) throws(mem);
ListNode* List_InsertBefore  (List*, ListNode* pNode, const void* pData) throws(mem);
void      List_SetNodeData   (List*, ListNode* pNode, const void* pData) throws(null);
void      List_RemoveNode    (List*, ListNode* pNode);

ListNode* List_Insert        (List*, int index, const void* pData) throws(mem index);
void      List_Set           (List*, int index, const void* pData) throws(index);
void      List_Remove        (List*, int index) throws(index);
void      List_Clear         (List*);

int       List_GetNodeIndex  (const List*, const ListNode* pNode) throws(null);
void*     List_GetNodeData   (const List*, const ListNode* pNode) throws(null);
ListNode* List_GetSuccessor  (const List*, const ListNode* pNode);
ListNode* List_GetPredecessor(const List*, const ListNode* pNode);
ListNode* List_FindNode      (const List*, const ListNode* pNode, const void* pData);

void*     List_Get           (const List*, int index) throws(index);
ListNode* List_GetNode       (const List*, int index) throws(index);
int       List_Find          (const List*, int start, const void* pData) throws(index);

#ifdef __cplusplus
}
#endif

#endif
