Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
conditions are not semaphores. signals can get lost if delivered before you are waiti...
[simgrid.git] / src / xbt / heap_private.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_HEAP_PRIVATE_H
9 #define _XBT_HEAP_PRIVATE_H
10
11 #include "xbt/dynar.h"          /* void_f_pvoid_t */
12 #include "xbt/heap.h"
13
14 typedef struct xbt_heapItem {
15   void *content;
16   double key;
17 } s_xbt_heapItem_t, *xbt_heapItem_t;
18
19 typedef struct xbt_heap {
20   int size;
21   int count;
22   xbt_heapItem_t items;
23   void_f_pvoid_t free;
24   void (*update_callback) (void *, int);
25 } s_xbt_heap_t;
26
27 #define PARENT(i)  i/2
28 #define LEFT(i)    2*i
29 #define RIGHT(i)   2*i+1
30
31 #define KEY(H,i)     ((H->items)[i]).key
32 #define CONTENT(H,i) ((H->items)[i]).content
33
34 #define MIN_KEY_VALUE -10000
35
36 static void xbt_heap_maxHeapify(xbt_heap_t H);
37 static void xbt_heap_increaseKey(xbt_heap_t H, int i);
38
39 #endif /* _XBT_HEAP_PRIVATE_H */