(no commit message)
[geda-pcb/pcjc2.git] / src / heap.h
blob85e6a532e1faaa1ecf678907fbca100c5b994059
1 /*
2 * COPYRIGHT
4 * PCB, interactive printed circuit board design
5 * Copyright (C) 1994,1995,1996 Thomas Nau
6 * Copyright (C) 1998,1999,2000,2001 harry eaton
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 * Contact addresses for paper mail and Email:
23 * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA
24 * haceaton@aplcomm.jhuapl.edu
28 /* this file, heap.h, was written and is
29 * Copyright (c) 2001 C. Scott Ananian.
32 /* prototypes for heap routines.
35 #ifndef PCB_HEAP_H
36 #define PCB_HEAP_H
38 #include "global.h"
40 /* type of heap costs */
41 typedef double cost_t;
42 /* what a heap looks like */
43 typedef struct heap_struct heap_t;
45 /* create an empty heap */
46 heap_t *heap_create ();
47 /* destroy a heap */
48 void heap_destroy (heap_t ** heap);
49 /* free all elements in a heap */
50 void heap_free (heap_t * heap, void (*funcfree) (void *));
52 /* -- mutation -- */
53 void heap_insert (heap_t * heap, cost_t cost, void *data);
54 void *heap_remove_smallest (heap_t * heap);
55 /* replace the smallest item with a new item and return the smallest item.
56 * (if the new item is the smallest, than return it, instead.) */
57 void *heap_replace (heap_t * heap, cost_t cost, void *data);
59 /* -- interrogation -- */
60 int heap_is_empty (heap_t * heap);
61 int heap_size (heap_t * heap);
63 #endif /* PCB_HEAP_H */