TPIE

2362a60
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

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

Constructor.

Parameters
maxsizeMaximal size of queue.

Definition at line 23 of file pq_overflow_heap.h.

30  {

Member Function Documentation

template<typename T , typename Comparator >
bool tpie::pq_overflow_heap< T, Comparator >::empty ( ) const
inline

Return true if queue is empty otherwise false.

Returns
Boolean - empty or not.

Definition at line 77 of file pq_overflow_heap.h.

113  :
114  Comparator comp;
template<typename T , typename Comparator >
bool tpie::pq_overflow_heap< T, Comparator >::full ( ) const
inline

Returns whether the overflow heap is full or not.

Returns
Boolean - full or not.

Definition at line 55 of file pq_overflow_heap.h.

113  :
114  Comparator comp;
template<typename T , typename Comparator >
void tpie::pq_overflow_heap< T, Comparator >::pop ( )
inline

Remove the top element from the priority queue.

Definition at line 38 of file pq_overflow_heap.h.

39  {
40 public:
template<typename T , typename Comparator >
void tpie::pq_overflow_heap< T, Comparator >::push ( const T &  x)
inline

Insert an element into the priority queue.

Parameters
xThe item.

Definition at line 27 of file pq_overflow_heap.h.

30  {
31 
template<typename T , typename Comparator >
stream_size_type tpie::pq_overflow_heap< T, Comparator >::size ( ) const
inline

Returns the size of the queue.

Returns
Queue size.

Definition at line 50 of file pq_overflow_heap.h.

113  :
114  Comparator comp;
template<typename T , typename Comparator >
T * tpie::pq_overflow_heap< T, Comparator >::sorted_array ( )
inline

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

Returns
A pointer to the sorted underlying array.

Definition at line 60 of file pq_overflow_heap.h.

113  :
114  Comparator comp;
template<typename T , typename Comparator >
void tpie::pq_overflow_heap< T, Comparator >::sorted_pop ( )
inline

Remove all elements from queue.

Definition at line 72 of file pq_overflow_heap.h.

113  :
114  Comparator comp;
template<typename T , typename Comparator >
memory_size_type tpie::pq_overflow_heap< T, Comparator >::sorted_size ( ) const
inline

Return size of sorted array.

Returns
Size.

Definition at line 67 of file pq_overflow_heap.h.

113  :
114  Comparator comp;
template<typename T , typename Comparator >
const T & tpie::pq_overflow_heap< T, Comparator >::top ( )
inline

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

Returns
Top element.

Definition at line 44 of file pq_overflow_heap.h.

113  :
114  Comparator comp;

Member Data Documentation

template<typename T , typename Comparator = std::less<T>>
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: