Rev | Line | |
---|
[13] | 1 | /** |
---|
| 2 | @file list.h |
---|
| 3 | @brief ENet list management |
---|
| 4 | */ |
---|
| 5 | #ifndef __ENET_LIST_H__ |
---|
| 6 | #define __ENET_LIST_H__ |
---|
| 7 | |
---|
| 8 | #include <stdlib.h> |
---|
| 9 | |
---|
| 10 | typedef struct _ENetListNode |
---|
| 11 | { |
---|
| 12 | struct _ENetListNode * next; |
---|
| 13 | struct _ENetListNode * previous; |
---|
| 14 | } ENetListNode; |
---|
| 15 | |
---|
| 16 | typedef ENetListNode * ENetListIterator; |
---|
| 17 | |
---|
| 18 | typedef struct _ENetList |
---|
| 19 | { |
---|
| 20 | ENetListNode sentinel; |
---|
| 21 | } ENetList; |
---|
| 22 | |
---|
| 23 | extern void enet_list_clear (ENetList *); |
---|
| 24 | |
---|
| 25 | extern ENetListIterator enet_list_insert (ENetListIterator, void *); |
---|
| 26 | extern void * enet_list_remove (ENetListIterator); |
---|
| 27 | |
---|
| 28 | extern size_t enet_list_size (ENetList *); |
---|
| 29 | |
---|
| 30 | #define enet_list_begin(list) ((list) -> sentinel.next) |
---|
| 31 | #define enet_list_end(list) (& (list) -> sentinel) |
---|
| 32 | |
---|
| 33 | #define enet_list_empty(list) (enet_list_begin (list) == enet_list_end (list)) |
---|
| 34 | |
---|
| 35 | #define enet_list_next(iterator) ((iterator) -> next) |
---|
| 36 | #define enet_list_previous(iterator) ((iterator) -> previous) |
---|
| 37 | |
---|
| 38 | #define enet_list_front(list) ((void *) (list) -> sentinel.next) |
---|
| 39 | #define enet_list_back(list) ((void *) (list) -> sentinel.previous) |
---|
| 40 | |
---|
| 41 | #endif /* __ENET_LIST_H__ */ |
---|
| 42 | |
---|
Note: See
TracBrowser
for help on using the repository browser.