Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
please sonar
[simgrid.git] / src / xbt / heap_private.h
1 /* Copyright (c) 2004-2005, 2007, 2009-2014. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef _XBT_HEAP_PRIVATE_H
8 #define _XBT_HEAP_PRIVATE_H
9
10 #include "xbt/dynar.h"          /* void_f_pvoid_t */
11 #include "xbt/heap.h"
12 #include <float.h>
13
14 typedef struct xbt_heap_item {
15   void *content;
16   double key;
17 } s_xbt_heap_item_t, *xbt_heap_item_t;
18
19 typedef struct xbt_heap {
20   int size;
21   int count;
22   s_xbt_heap_item_t* items; /* array of structs */
23   void_f_pvoid_t free;
24   void (*update_callback) (void *, int);
25 } s_xbt_heap_t;
26
27 #define PARENT(i)  (i >> 1)
28 #define LEFT(i)    (i << 1)
29 #define RIGHT(i)   ((i << 1) + 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 -DBL_MAX
35
36 #endif                          /* _XBT_HEAP_PRIVATE_H */