Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fixed licence and copyright. No more reference to da GRAS possee or the
[simgrid.git] / include / xbt / fifo.h
1 /*      $Id$     */
2
3 /* Copyright (c) 2004 Arnaud Legrand. All rights reserved.                  */
4
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. */
7
8 #ifndef _XBT_FIFO_H
9 #define _XBT_FIFO_H
10
11 /* Bucket structure */
12 typedef struct xbt_fifo_item *xbt_fifo_item_t;
13
14 /* FIFO structure */
15 typedef struct xbt_fifo *xbt_fifo_t;
16
17 /* API */
18 xbt_fifo_t xbt_fifo_new(void);
19 void xbt_fifo_free(xbt_fifo_t);
20
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);
25
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);
30
31 void xbt_fifo_remove(xbt_fifo_t, void *);
32 void xbt_fifo_remove_item(xbt_fifo_t, xbt_fifo_item_t);
33
34 int xbt_fifo_is_in(xbt_fifo_t, void *);
35
36 void **xbt_fifo_to_array(xbt_fifo_t);
37 xbt_fifo_t xbt_fifo_copy(xbt_fifo_t);
38
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);
43
44 int xbt_fifo_size(xbt_fifo_t);
45
46 /* #define xbt_fifo_foreach(f,i,n,type)                  \ */
47 /*    for(i=xbt_fifo_getFirstitem(f);                    \ */
48 /*      ((i)?(n=(type)(i->content)):(NULL));             \ */
49 /*        i=xbt_fifo_getNextitem(i)) */
50
51
52 #endif                          /* _XBT_FIFO_H */