[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

MappedBucketQueue< ValueType, PriorityFunctor, Ascending > Class Template Reference

Priority queue implemented using bucket sort (STL compatible). More...

`#include <vigra/priority_queue.hxx>`

Inheritance diagram for MappedBucketQueue< ValueType, PriorityFunctor, Ascending >:

## Public Member Functions

| MappedBucketQueue (unsigned int bucket_count=256, PriorityFunctor const &priority=PriorityFunctor())
| Create a queue with.
void | push (value_type const &v)
| Insert new element.
Public Member Functions inherited from BucketQueue< ValueType, Ascending >
| BucketQueue (size_type bucket_count=256)
| Create bucket queue with.
bool | empty () const
| Queue contains no elements. Equivalent to `size() == 0`.
priority_type | maxIndex () const
| Maximum index (i.e. priority) allowed in this queue. Equivalent to `bucket_count - 1`.
void | pop ()
| Remove the current top element.
void | push (value_type const &v, priority_type priority)
| Insert new element.
size_type | size () const
| Number of elements in this queue.
const_reference | top () const
| The current top element.
priority_type | topPriority () const
| Priority of the current top element.

## Detailed Description

template<class ValueType, class PriorityFunctor, bool Ascending = false>
class vigra::MappedBucketQueue< ValueType, PriorityFunctor, Ascending >

Priority queue implemented using bucket sort (STL compatible).

This template is compatible to `std::priority_queue`, but uses a more efficient algorithm based on bucket sort. It us used like vigra::BucketQueue, but has an additional `PriorityFunctor` which extracts the priority value of an element of type `ValueType`. Thus functor is called within `push` so that it does not need an extra argument.

#include <vigra/priority_queue.hxx>
Namespace: vigra

## Constructor & Destructor Documentation

## ◆ MappedBucketQueue()

template<class ValueType , class PriorityFunctor , bool Ascending = false>

MappedBucketQueue | ( | unsigned int | bucket_count = `256`,
|  | PriorityFunctor const & | priority = `PriorityFunctor()`
| ) |  |

Create a queue with.

- bucket_count entries. Priorities will be computed by the `PriorityFunctor` given in
- priority (i.e. `priority(v)` must result in an integer, where `v` is an instance of `ValueType`).

## Member Function Documentation

## ◆ push()

template<class ValueType , class PriorityFunctor , bool Ascending = false>

void push | ( | value_type const & | v | ) |

Insert new element.

- v. Its priority is calculated by `priority(v)`, where `priority` is an instance of the `PriorityFunctor` passed in the constructor. If the priority is outside the range `[0, ..., bucket_count-1]`, it is clamped to the range borders.

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

- vigra/priority_queue.hxx

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python vigra 1.12.1