Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Correction of a badly-written macro
[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 xbt_fifo_item_t xbt_fifo_push(xbt_fifo_t, void *);
20 void *xbt_fifo_pop(xbt_fifo_t);
21 xbt_fifo_item_t xbt_fifo_unshift(xbt_fifo_t, void *);
22 void *xbt_fifo_shift(xbt_fifo_t);
23
24 void xbt_fifo_push_item(xbt_fifo_t, xbt_fifo_item_t);
25 xbt_fifo_item_t xbt_fifo_pop_item(xbt_fifo_t);
26 void xbt_fifo_unshift_item(xbt_fifo_t, xbt_fifo_item_t);
27 xbt_fifo_item_t xbt_fifo_shift_item(xbt_fifo_t);
28
29 void xbt_fifo_remove(xbt_fifo_t, void *);
30 void xbt_fifo_remove_item(xbt_fifo_t, xbt_fifo_item_t);
31
32 int xbt_fifo_is_in(xbt_fifo_t, void *);
33
34 void **xbt_fifo_to_array(xbt_fifo_t);
35 xbt_fifo_t xbt_fifo_copy(xbt_fifo_t);
36
37 xbt_fifo_item_t xbt_fifo_newitem(void);
38 void xbt_fifo_set_item_content(xbt_fifo_item_t, void *);
39 void *xbt_fifo_get_item_content(xbt_fifo_item_t);
40 void xbt_fifo_freeitem(xbt_fifo_item_t);
41
42 int xbt_fifo_size(xbt_fifo_t);
43
44 /* #define xbt_fifo_foreach(f,i,n,type)                  \ */
45 /*    for(i=xbt_fifo_getFirstitem(f);                    \ */
46 /*      ((i)?(n=(type)(i->content)):(NULL));             \ */
47 /*        i=xbt_fifo_getNextitem(i)) */
48
49
50 #endif                          /* _XBT_FIFO_H */