00001 00005 00006 #ifndef __COMM_LB_HEAP 00007 #define __COMM_LB_HEAP 00008 00009 class ObjectRecord { 00010 public: 00011 double val; // value on which the heap is built 00012 int pe; 00013 int pos; 00014 int id; // should replace other Ids. 00015 }; 00016 00017 class hRecord { 00018 public: 00019 short deleted; // boolean 00020 ObjectRecord *info; 00021 }; 00022 00023 class hIterator { 00024 public: 00025 int next; 00026 }; 00027 00028 class ObjectHeap { 00029 private: 00030 hRecord *h; 00031 int count; 00032 int size; 00033 00034 void swap(int i, int j) { 00035 hRecord temp = h[i]; 00036 h[i] = h[j]; 00037 h[j] = temp; 00038 } 00039 00040 public: 00041 ObjectHeap(int size); 00042 ~ObjectHeap() { delete [] h; } 00043 int numElements(); 00044 int insert(ObjectRecord *); 00045 ObjectRecord *deleteMax(); 00046 ObjectRecord *iterator(hIterator *); 00047 ObjectRecord *next(hIterator *); 00048 }; 00049 00050 #endif 00051