Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
b59e0b1af21964a5d741d85c08bcc59012d182b9
[simgrid.git] / include / xbt / fifo.h
1 /* Authors: Arnaud Legrand                                                  */
2
3 /* This program is free software; you can redistribute it and/or modify it
4    under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef _XBT_FIFO_H
7 #define _XBT_FIFO_H
8
9 /* Bucket structure */
10 typedef struct xbt_fifo_item *xbt_fifo_item_t;
11
12 /* FIFO structure */
13 typedef struct xbt_fifo *xbt_fifo_t;
14
15 /* API */
16 xbt_fifo_t xbt_fifo_new(void);
17 void xbt_fifo_free(xbt_fifo_t);
18
19 void xbt_fifo_push(xbt_fifo_t, void *);
20 void *xbt_fifo_pop(xbt_fifo_t);
21 void xbt_fifo_unshift(xbt_fifo_t, void *);
22 void *xbt_fifo_shift(xbt_fifo_t);
23
24 void xbt_fifo_remove(xbt_fifo_t, void *);
25 void xbt_fifo_remove_item(xbt_fifo_t, xbt_fifo_item_t);
26
27 int xbt_fifo_is_in(xbt_fifo_t, void *);
28
29 void **xbt_fifo_to_array(xbt_fifo_t);
30 xbt_fifo_t xbt_fifo_copy(xbt_fifo_t);
31
32 xbt_fifo_item_t xbt_fifo_newitem(void);
33 void xbt_fifo_set_item_content(xbt_fifo_item_t, void *);
34 void *xbt_fifo_get_item_content(xbt_fifo_item_t);
35 void xbt_fifo_freeitem(xbt_fifo_item_t);
36
37 int xbt_fifo_size(xbt_fifo_t);
38
39 /* #define xbt_fifo_foreach(f,i,n,type)                  \ */
40 /*    for(i=xbt_fifo_getFirstitem(f);                    \ */
41 /*      ((i)?(n=(type)(i->content)):(NULL));             \ */
42 /*        i=xbt_fifo_getNextitem(i)) */
43
44
45 #endif                          /* _XBT_FIFO_H */