/** * This routine is similar to FreeHeap in that it * deallocates the memory consumed by the heap. However, it * also calls Deallocator for each item in the heap so that * this data is also deallocated. * * @param Heap heap whose data is to be freed * @param destructor function to be used to deallocate data * * Globals: * - None * * @note Exceptions: none * @note History: Tue May 15 08:52:04 1990, DSJ, Created. */ void FreeHeapData(HEAP *Heap, void_dest destructor) { HEAPENTRY Entry; while (GetTopOfHeap (Heap, &Entry) != EMPTY) destructor (Entry.Data); FreeHeap(Heap); } /* FreeHeapData */
/** * @name pop_queue * * Get this state from the priority queue. It should be the state that * has the greatest urgency to be evaluated. */ STATE *Wordrec::pop_queue(HEAP *queue) { HEAPENTRY entry; if (GetTopOfHeap (queue, &entry) == TESS_HEAP_OK) { #ifndef GRAPHICS_DISABLED if (wordrec_display_segmentations) { cprintf ("eval state: %8.3f ", entry.Key); print_state ("", (STATE *) entry.Data, num_joints); } #endif return ((STATE *) entry.Data); } else { return (NULL); } }