Coverage Report

Created: 2026-10-28 17:42

/home/runner/work/charm/charm/src/ck-ldb/ckheap.h
Line
Count
Source (jump to first uncovered line)
1
/**
2
 * \addtogroup CkLdb
3
*/
4
/*@{*/
5
6
#ifndef _HEAP_H_
7
#define _HEAP_H_
8
9
class InfoRecord;
10
11
class heapRecord
12
{ public:
13
  short deleted; // boolean
14
  InfoRecord *info;
15
};
16
17
class heapIterator{
18
public:
19
  int next;
20
};
21
22
class minHeap
23
{
24
private:
25
  heapRecord *h;
26
  int count;
27
  int size;
28
134
  void swap(int i, int j) {
29
134
    heapRecord temp = h[i];
30
134
    h[i] = h[j];
31
134
    h[j] = temp;
32
134
  }
33
  
34
public:
35
  minHeap(int size);
36
  ~minHeap();
37
0
  int numElements() { return count; }
38
  int insert(InfoRecord *);
39
  InfoRecord *deleteMin();
40
  InfoRecord *iterator(heapIterator *);
41
  InfoRecord *next(heapIterator *);
42
  void update(InfoRecord *);
43
private:
44
  int least(int a, int b, int c);
45
  void update(int index);
46
};
47
48
class maxHeap
49
{
50
private:
51
  heapRecord *h;
52
  int count;
53
  int size;
54
55
0
  void swap(int i, int j) {
56
0
    heapRecord temp = h[i];
57
0
    h[i] = h[j];
58
0
    h[j] = temp;
59
0
  }
60
  
61
public:  
62
  maxHeap(int size);
63
  ~maxHeap();
64
  int numElements();
65
  int insert(InfoRecord *);
66
  InfoRecord *deleteMax();
67
  InfoRecord *iterator(heapIterator *);
68
  InfoRecord *next(heapIterator *);
69
};
70
71
72
#endif /* _HEAP_H_ */
73
74
/*@}*/