GRASS Programmer's Manual
6.4.2(2012)
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
heap.h
Go to the documentation of this file.
1
/* LIBDGL -- a Directed Graph Library implementation
2
* Copyright (C) 2002 Roberto Micarelli
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
*/
18
19
/* best view tabstop=4
20
*/
21
22
#ifndef _DGL_HEAP_H_
23
#define _DGL_HEAP_H_
24
25
typedef
union
_dglHeapData
26
{
27
void
*
pv
;
28
int
n
;
29
unsigned
int
un
;
30
long
l
;
31
unsigned
long
ul
;
32
33
}
dglHeapData_u
;
34
35
36
typedef
struct
_dglHeapNode
37
{
38
long
key
;
39
dglHeapData_u
value
;
40
unsigned
char
flags
;
41
42
}
dglHeapNode_s
;
43
44
typedef
struct
_dglHeap
45
{
46
47
long
index
;
/* last node / number of current nodes (complete-binary-tree array representation ...) */
48
long
count
;
/* number of allocated nodes in ->pnode array */
49
long
block
;
/* allocation block size expressed in number of nodes */
50
dglHeapNode_s
*
pnode
;
/* the node-array */
51
52
}
dglHeap_s
;
53
54
extern
void
dglHeapInit
(
dglHeap_s
* pheap);
55
56
57
typedef
void (*
dglHeapCancelItem_fn
) (
dglHeap_s
* pheap,
58
dglHeapNode_s
* pitem);
59
extern
void
dglHeapFree
(
dglHeap_s
* pheap,
60
dglHeapCancelItem_fn
pfnCancelItem);
61
62
extern
int
dglHeapInsertMax
(
dglHeap_s
* pheap,
63
long
key,
64
unsigned
char
flags,
dglHeapData_u
value);
65
66
extern
int
dglHeapExtractMax
(
dglHeap_s
* pheap,
dglHeapNode_s
* pnoderet);
67
68
extern
int
dglHeapInsertMin
(
dglHeap_s
* pheap,
69
long
key,
70
unsigned
char
flags,
dglHeapData_u
value);
71
72
extern
int
dglHeapExtractMin
(
dglHeap_s
* pheap,
dglHeapNode_s
* pnoderet);
73
74
#endif
lib
vector
dglib
heap.h
Generated on Sun Mar 16 2014 05:07:46 for GRASS Programmer's Manual by
1.8.1.2