3 /* Copyright (c) 2004 Arnaud Legrand. All rights reserved. */
5 /* This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package. */
11 /* Bucket structure */
12 typedef struct xbt_fifo_item *xbt_fifo_item_t;
15 typedef struct xbt_fifo *xbt_fifo_t;
18 xbt_fifo_t xbt_fifo_new(void);
19 void xbt_fifo_free(xbt_fifo_t);
21 xbt_fifo_item_t xbt_fifo_push(xbt_fifo_t, void *);
22 void *xbt_fifo_pop(xbt_fifo_t);
23 xbt_fifo_item_t xbt_fifo_unshift(xbt_fifo_t, void *);
24 void *xbt_fifo_shift(xbt_fifo_t);
26 void xbt_fifo_push_item(xbt_fifo_t, xbt_fifo_item_t);
27 xbt_fifo_item_t xbt_fifo_pop_item(xbt_fifo_t);
28 void xbt_fifo_unshift_item(xbt_fifo_t, xbt_fifo_item_t);
29 xbt_fifo_item_t xbt_fifo_shift_item(xbt_fifo_t);
31 void xbt_fifo_remove(xbt_fifo_t, void *);
32 void xbt_fifo_remove_item(xbt_fifo_t, xbt_fifo_item_t);
34 int xbt_fifo_is_in(xbt_fifo_t, void *);
36 void **xbt_fifo_to_array(xbt_fifo_t);
37 xbt_fifo_t xbt_fifo_copy(xbt_fifo_t);
39 xbt_fifo_item_t xbt_fifo_newitem(void);
40 void xbt_fifo_set_item_content(xbt_fifo_item_t, void *);
41 void *xbt_fifo_get_item_content(xbt_fifo_item_t);
42 void xbt_fifo_freeitem(xbt_fifo_item_t);
44 int xbt_fifo_size(xbt_fifo_t);
46 xbt_fifo_item_t xbt_fifo_getFirstItem(xbt_fifo_t l);
47 xbt_fifo_item_t xbt_fifo_getNextItem(xbt_fifo_item_t i);
48 xbt_fifo_item_t xbt_fifo_getPrevItem(xbt_fifo_item_t i);
51 #define xbt_fifo_foreach(f,i,n,type) \
52 for(i=xbt_fifo_getFirstItem(f); \
53 ((i)?(n=(type)(xbt_fifo_get_item_content(i))):(NULL)); \
54 i=xbt_fifo_getNextItem(i))
57 #endif /* _XBT_FIFO_H */