TPIE

2362a60
tpie::ami::merge_heap_obj< REC, Compare > Class Template Reference

Inherits tpie::ami::merge_heap_op< REC, Compare >.

Public Member Functions

 merge_heap_obj (Compare cmp)
 
size_t sizeofheap ()
 Reports the size of Heap (number of elements). More...
 
size_t get_min_run_id ()
 Returns the run with the minimum key. More...
 
void allocate (size_t size)
 Allocates space for the heap. More...
 
void insert (const REC *ptr, size_t run_id)
 Copies an (initial) element into the heap array/. More...
 
void extract_min (REC &el, size_t &run_id)
 Extracts minimum element from heap array. More...
 
void deallocate ()
 Deallocates the space used by the heap. More...
 
void initialize (void)
 Heapifies an initial array of elements. More...
 
void delete_min_and_insert (const REC *nextelement_same_run)
 
size_t space_per_item (void)
 Returns the main memory space usage per item. More...
 
size_t space_overhead (void)
 Returns the fixed main memory space overhead, regardless of item count. More...
 

Detailed Description

template<class REC, class Compare>
class tpie::ami::merge_heap_obj< REC, Compare >

Definition at line 249 of file mergeheap.h.

Member Function Documentation

void tpie::ami::merge_heap_op< REC, Compare >::allocate ( size_t  size)
inlineinherited

Allocates space for the heap.

Definition at line 194 of file mergeheap.h.

Referenced by tpie::ami::merge_sorted().

194 {pq.resize(size);}
void tpie::ami::merge_heap_op< REC, Compare >::deallocate ( void  )
inlineinherited

Deallocates the space used by the heap.

Definition at line 215 of file mergeheap.h.

215 {pq.resize(0);}
void tpie::ami::merge_heap_op< REC, Compare >::extract_min ( REC &  el,
size_t &  run_id 
)
inlineinherited

Extracts minimum element from heap array.

If you follow this with an immediate insert, consider using delete_min_and_insert().

Definition at line 206 of file mergeheap.h.

206  {
207  el=pq.top().key;
208  run_id=pq.top().run_id;
209  pq.pop();
210  }
size_t tpie::ami::merge_heap_op< REC, Compare >::get_min_run_id ( )
inlineinherited

Returns the run with the minimum key.

Definition at line 189 of file mergeheap.h.

189 {return pq.top().run_id;};
void tpie::ami::merge_heap_op< REC, Compare >::initialize ( void  )
inlineinherited

Heapifies an initial array of elements.

Definition at line 220 of file mergeheap.h.

220 {pq.make_safe();}
void tpie::ami::merge_heap_op< REC, Compare >::insert ( const REC *  ptr,
size_t  run_id 
)
inlineinherited

Copies an (initial) element into the heap array/.

Definition at line 199 of file mergeheap.h.

199 {pq.unsafe_push(heap_element<REC>(*ptr, run_id));}
size_t tpie::ami::merge_heap_op< REC, Compare >::sizeofheap ( )
inlineinherited

Reports the size of Heap (number of elements).

Definition at line 184 of file mergeheap.h.

184 {return pq.size();}
size_t tpie::ami::merge_heap_op< REC, Compare >::space_overhead ( void  )
inlineinherited

Returns the fixed main memory space overhead, regardless of item count.

Definition at line 241 of file mergeheap.h.

241 {return static_cast<size_t>(pq.memory_overhead());}
size_t tpie::ami::merge_heap_op< REC, Compare >::space_per_item ( void  )
inlineinherited

Returns the main memory space usage per item.

Definition at line 236 of file mergeheap.h.

236 {return static_cast<size_t>(pq.memory_coefficient());}

The documentation for this class was generated from the following file: