Public Types | Public Member Functions | Protected Attributes
mbl_priority_bounded_queue< T, C, O > Class Template Reference

A bounded priority queue. More...

#include <mbl_priority_bounded_queue.h>

List of all members.

Public Types

typedef C::value_type value_type
typedef C::size_type size_type
typedef C::allocator_type allocator_type
typedef const value_typeITER

Public Member Functions

 mbl_priority_bounded_queue (unsigned bound_size=10, const O &comp=O())
 mbl_priority_bounded_queue (size_type bound_size, ITER first, ITER last, const O &comp=O(), const allocator_type &alloc=allocator_type())
 Construct a bounded priority queue from a controlled sequence.
size_type bound_size () const
 The largest size the queue can be before it starts throwing out data.
void set_bound_size (size_type bound_size)
 Set the largest size the queue can be before it starts throwing out data.
bool empty () const
size_type size () const
value_typetop ()
const value_typetop () const
void push (const value_type &x)
void pop ()

Protected Attributes

size_type b_size_
c_
comp_

Detailed Description

template<class T, class C = vcl_vector<T>, class O = vcl_less<typename C::value_type>>
class mbl_priority_bounded_queue< T, C, O >

A bounded priority queue.

This is identical to a vcl_priority_queue, but as more elements are added past the queue's bound size the largest values are thrown out. So this queue keeps the n smallest values that are passed to it.

To store the largest values, use vcl_more as the comparator O.

top() returns the value that is closest to being thrown out, which is the largest value in the case of the default predicate.

Definition at line 29 of file mbl_priority_bounded_queue.h.


Member Typedef Documentation

template<class T , class C = vcl_vector<T>, class O = vcl_less<typename C::value_type>>
typedef C::allocator_type mbl_priority_bounded_queue< T, C, O >::allocator_type

Definition at line 37 of file mbl_priority_bounded_queue.h.

template<class T , class C = vcl_vector<T>, class O = vcl_less<typename C::value_type>>
typedef const value_type* mbl_priority_bounded_queue< T, C, O >::ITER

Definition at line 47 of file mbl_priority_bounded_queue.h.

template<class T , class C = vcl_vector<T>, class O = vcl_less<typename C::value_type>>
typedef C::size_type mbl_priority_bounded_queue< T, C, O >::size_type

Definition at line 33 of file mbl_priority_bounded_queue.h.

template<class T , class C = vcl_vector<T>, class O = vcl_less<typename C::value_type>>
typedef C::value_type mbl_priority_bounded_queue< T, C, O >::value_type

Definition at line 32 of file mbl_priority_bounded_queue.h.


Constructor & Destructor Documentation

template<class T , class C = vcl_vector<T>, class O = vcl_less<typename C::value_type>>
mbl_priority_bounded_queue< T, C, O >::mbl_priority_bounded_queue ( unsigned  bound_size = 10,
const O &  comp = O() 
) [inline, explicit]

Definition at line 41 of file mbl_priority_bounded_queue.h.

template<class T , class C = vcl_vector<T>, class O = vcl_less<typename C::value_type>>
mbl_priority_bounded_queue< T, C, O >::mbl_priority_bounded_queue ( size_type  bound_size,
ITER  first,
ITER  last,
const O &  comp = O(),
const allocator_type alloc = allocator_type() 
) [inline]

Construct a bounded priority queue from a controlled sequence.

The bounded size will be the length of the sequence.

Definition at line 51 of file mbl_priority_bounded_queue.h.


Member Function Documentation

template<class T , class C = vcl_vector<T>, class O = vcl_less<typename C::value_type>>
size_type mbl_priority_bounded_queue< T, C, O >::bound_size ( ) const [inline]

The largest size the queue can be before it starts throwing out data.

Definition at line 58 of file mbl_priority_bounded_queue.h.

template<class T , class C = vcl_vector<T>, class O = vcl_less<typename C::value_type>>
bool mbl_priority_bounded_queue< T, C, O >::empty ( ) const [inline]

Definition at line 66 of file mbl_priority_bounded_queue.h.

template<class T , class C = vcl_vector<T>, class O = vcl_less<typename C::value_type>>
void mbl_priority_bounded_queue< T, C, O >::pop ( ) [inline]

Definition at line 87 of file mbl_priority_bounded_queue.h.

template<class T , class C = vcl_vector<T>, class O = vcl_less<typename C::value_type>>
void mbl_priority_bounded_queue< T, C, O >::push ( const value_type x) [inline]

Definition at line 74 of file mbl_priority_bounded_queue.h.

template<class T , class C = vcl_vector<T>, class O = vcl_less<typename C::value_type>>
void mbl_priority_bounded_queue< T, C, O >::set_bound_size ( size_type  bound_size) [inline]

Set the largest size the queue can be before it starts throwing out data.

If the bound_size is smaller that the current size, then data will be thrown out.

Definition at line 62 of file mbl_priority_bounded_queue.h.

template<class T , class C = vcl_vector<T>, class O = vcl_less<typename C::value_type>>
size_type mbl_priority_bounded_queue< T, C, O >::size ( ) const [inline]

Definition at line 68 of file mbl_priority_bounded_queue.h.

template<class T , class C = vcl_vector<T>, class O = vcl_less<typename C::value_type>>
value_type& mbl_priority_bounded_queue< T, C, O >::top ( ) [inline]

Definition at line 70 of file mbl_priority_bounded_queue.h.

template<class T , class C = vcl_vector<T>, class O = vcl_less<typename C::value_type>>
const value_type& mbl_priority_bounded_queue< T, C, O >::top ( ) const [inline]

Definition at line 72 of file mbl_priority_bounded_queue.h.


Member Data Documentation

template<class T , class C = vcl_vector<T>, class O = vcl_less<typename C::value_type>>
size_type mbl_priority_bounded_queue< T, C, O >::b_size_ [protected]

Definition at line 90 of file mbl_priority_bounded_queue.h.

template<class T , class C = vcl_vector<T>, class O = vcl_less<typename C::value_type>>
C mbl_priority_bounded_queue< T, C, O >::c_ [protected]

Definition at line 91 of file mbl_priority_bounded_queue.h.

template<class T , class C = vcl_vector<T>, class O = vcl_less<typename C::value_type>>
O mbl_priority_bounded_queue< T, C, O >::comp_ [protected]

Definition at line 92 of file mbl_priority_bounded_queue.h.


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