Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Formers simgrid fifo : when real O(1) is needed... The way I'm gonna use
[simgrid.git] / src / xbt / fifo_private.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_PRIVATE_H
7 #define _XBT_FIFO_PRIVATE_H
8 #include "xbt_fifo.h"
9
10 /* Bucket structure */
11 typedef struct xbt_fifo_item {
12   void *content;
13   struct xbt_fifo_item *next;
14   struct xbt_fifo_item *prev;
15 } s_xbt_fifo_item_t;
16
17 /* FIFO structure */
18 typedef struct xbt_fifo {
19   int count;
20   xbt_fifo_item_t head;
21   xbt_fifo_item_t tail;
22 } s_xbt_fifo_t;
23
24
25 #define xbt_fifo_getFirstitem(l) ((l)?(l)->head:NULL)
26 #define xbt_fifo_getNextitem(i) ((i)?(i)->next:NULL)
27 #define xbt_fifo_getPrevitem(i) ((i)?(i)->prev:NULL)
28 #define xbt_fifo_getItemcontent(i) ((i)?(i)->content:NULL)
29 #define xbt_fifo_setItemcontent(i,v) (i->content=v)
30
31
32 /* static __inline__ xbt_fifo_item_t xbt_fifo_getFirstitem(xbt_fifo_t l) */
33 /* { */
34 /*   return l->head; */
35 /* } */
36 /* static __inline__ xbt_fifo_item_t xbt_fifo_getNextitem(xbt_fifo_item_t i)  */
37 /* { */
38 /*   if(i) return i->next; */
39 /*   return NULL; */
40 /* } */
41 /* static __inline__ xbt_fifo_item_t xbt_fifo_getPrevitem(xbt_fifo_item_t i) */
42 /* { */
43 /*   if(i) return i->prev; */
44 /*   return NULL; */
45 /* } */
46
47 #endif                          /* _XBT_FIFO_PRIVATE_H */