|
1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * Header for list.cpp. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef _LIST_H_ |
|
22 #define _LIST_H_ |
|
23 |
|
24 |
|
25 /* |
|
26 * Defines |
|
27 */ |
|
28 |
|
29 #define LST_ITEM_SKELETON \ |
|
30 void *next; |
|
31 |
|
32 /* |
|
33 * Typedefs |
|
34 */ |
|
35 |
|
36 /* A skeleton of a list item type. |
|
37 Each real list item type must include these definitions in the beginning |
|
38 of the structure. This structure has no use as such outside this module. */ |
|
39 typedef struct lstListItem_s { |
|
40 void *next; |
|
41 } lstListItem_t; |
|
42 |
|
43 /* FIFO list */ |
|
44 typedef struct { |
|
45 lstListItem_t *head; |
|
46 lstListItem_t *tail; |
|
47 int numItems; |
|
48 } fifo_t; |
|
49 |
|
50 /* LIFO list (stack) */ |
|
51 typedef struct { |
|
52 lstListItem_t *head; |
|
53 } lifo_t; |
|
54 |
|
55 /* General linked list */ |
|
56 typedef struct { |
|
57 lstListItem_t *head; |
|
58 lstListItem_t *prev; |
|
59 lstListItem_t *curr; |
|
60 int numItems; |
|
61 } lst_t; |
|
62 |
|
63 |
|
64 /* |
|
65 * Function prototypes |
|
66 */ |
|
67 |
|
68 /* FIFO list functions */ |
|
69 int fifoOpen(fifo_t *list); |
|
70 int fifoClose(fifo_t *list); |
|
71 int fifoPut(fifo_t *list, void *item); |
|
72 int fifoGet(fifo_t *list, void **item); |
|
73 int fifoPeek(fifo_t *list, void **item); |
|
74 #define fifoNumItems(list) ((list)->numItems) |
|
75 |
|
76 /* LIFO list functions */ |
|
77 int lifoOpen(lifo_t *list); |
|
78 int lifoClose(lifo_t *list); |
|
79 int lifoPut(lifo_t *list, void *item); |
|
80 int lifoGet(lifo_t *list, void **item); |
|
81 |
|
82 /* General linked list functions */ |
|
83 int lstOpen(lst_t *list); |
|
84 int lstClose(lst_t *list); |
|
85 int lstHead(lst_t *list, void **item); |
|
86 int lstTail(lst_t *list, void **item); |
|
87 int lstEnd(lst_t *list); |
|
88 int lstCurr(lst_t *list, void **item); |
|
89 int lstNext(lst_t *list, void **item); |
|
90 int lstNextExists(lst_t *list); |
|
91 int lstAdd(lst_t *list, void *item); |
|
92 int lstRemove(lst_t *list, void **item); |
|
93 #define lstNumItems(list) ((list)->numItems) |
|
94 |
|
95 #endif |
|
96 // End of File |