TPIE

11a2c2d
tpie::pq_overflow_heap< T, Comparator > Class Template Reference

Overflow Priority Queue, based on a simple Heap. More...

#include <tpie/pq_overflow_heap.h>

Public Member Functions

 pq_overflow_heap (memory_size_type maxsize, Comparator c=Comparator())
 Constructor. More...
 
void push (const T &x)
 Insert an element into the priority queue. More...
 
void pop ()
 Remove the top element from the priority queue. More...
 
const T & top ()
 See what's on the top of the priority queue. More...
 
stream_size_type size () const
 Returns the size of the queue. More...
 
bool empty () const
 Return true if queue is empty otherwise false. More...
 
bool full () const
 Returns whether the overflow heap is full or not. More...
 
T * sorted_array ()
 Sorts the underlying array and returns a pointer to it, this operation invalidates the heap. More...
 
memory_size_type sorted_size () const
 Return size of sorted array. More...
 
void sorted_pop ()
 Remove all elements from queue. More...
 

Static Public Attributes

static const double sorted_factor = 1.0
 The factor of the size, total, which is returned sorted. More...
 

Detailed Description

template<typename T, typename Comparator = std::less<T>>
class tpie::pq_overflow_heap< T, Comparator >

Overflow Priority Queue, based on a simple Heap.

Author
Lars Hvam Petersen

Definition at line 39 of file pq_overflow_heap.h.

Constructor & Destructor Documentation

◆ pq_overflow_heap()

template<typename T , typename Comparator = std::less<T>>
tpie::pq_overflow_heap< T, Comparator >::pq_overflow_heap ( memory_size_type  maxsize,
Comparator  c = Comparator() 
)

Constructor.

Parameters
maxsizeMaximal size of queue.

Member Function Documentation

◆ empty()

template<typename T , typename Comparator = std::less<T>>
bool tpie::pq_overflow_heap< T, Comparator >::empty ( ) const

Return true if queue is empty otherwise false.

Returns
Boolean - empty or not.

◆ full()

template<typename T , typename Comparator = std::less<T>>
bool tpie::pq_overflow_heap< T, Comparator >::full ( ) const

Returns whether the overflow heap is full or not.

Returns
Boolean - full or not.

◆ pop()

template<typename T , typename Comparator = std::less<T>>
void tpie::pq_overflow_heap< T, Comparator >::pop ( )

Remove the top element from the priority queue.

◆ push()

template<typename T , typename Comparator = std::less<T>>
void tpie::pq_overflow_heap< T, Comparator >::push ( const T &  x)

Insert an element into the priority queue.

Parameters
xThe item.

◆ size()

template<typename T , typename Comparator = std::less<T>>
stream_size_type tpie::pq_overflow_heap< T, Comparator >::size ( ) const

Returns the size of the queue.

Returns
Queue size.

◆ sorted_array()

template<typename T , typename Comparator = std::less<T>>
T* tpie::pq_overflow_heap< T, Comparator >::sorted_array ( )

Sorts the underlying array and returns a pointer to it, this operation invalidates the heap.

Returns
A pointer to the sorted underlying array.

◆ sorted_pop()

template<typename T , typename Comparator = std::less<T>>
void tpie::pq_overflow_heap< T, Comparator >::sorted_pop ( )

Remove all elements from queue.

◆ sorted_size()

template<typename T , typename Comparator = std::less<T>>
memory_size_type tpie::pq_overflow_heap< T, Comparator >::sorted_size ( ) const

Return size of sorted array.

Returns
Size.

◆ top()

template<typename T , typename Comparator = std::less<T>>
const T& tpie::pq_overflow_heap< T, Comparator >::top ( )

See what's on the top of the priority queue.

Returns
Top element.

Member Data Documentation

◆ sorted_factor

template<typename T , typename Comparator >
const double tpie::pq_overflow_heap< T, Comparator >::sorted_factor = 1.0
static

The factor of the size, total, which is returned sorted.

Definition at line 84 of file pq_overflow_heap.h.


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