Stxxl  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Classes | Public Types | Public Member Functions | Private Types | Private Attributes
stxxl::addressable_priority_queue< KeyType, PriorityType, Cmp > Class Template Reference

An internal priority queue that allows removing elements addressed with (a copy of) themselves. More...

#include <addressable_queues.h>

Inheritance diagram for stxxl::addressable_priority_queue< KeyType, PriorityType, Cmp >:
Inheritance graph
[legend]

List of all members.

Classes

struct  cmp

Public Types

typedef meta_iter_t handle
 Type of handle to an entry. For use with insert and remove.

Public Member Functions

 addressable_priority_queue ()
 Create an empty queue.
 ~addressable_priority_queue ()
bool empty () const
 Check if queue is empty.
std::pair< handle, bool > insert (const KeyType &e, const PriorityType o)
 Insert new element. If the element is already in, it's priority is updated.
bool erase (const KeyType &e)
 Erase element from the queue.
void erase (handle i)
 Erase element from the queue.
const KeyType & top () const
 Access top (= min) element in the queue.
KeyType pop ()
 Remove top (= min) element from the queue.

Private Types

typedef std::set< std::pair
< PriorityType, KeyType >, cmp
container_t
typedef container_t::iterator container_iter_t
typedef std::map< KeyType,
container_iter_t
meta_t
typedef meta_t::iterator meta_iter_t

Private Attributes

container_t vals
meta_t meta

Detailed Description

template<typename KeyType, typename PriorityType, class Cmp = std::less<PriorityType>>
class stxxl::addressable_priority_queue< KeyType, PriorityType, Cmp >

An internal priority queue that allows removing elements addressed with (a copy of) themselves.

Template Parameters:
KeyTypeType of contained elements.
PriorityTypeType of Priority.

Definition at line 108 of file addressable_queues.h.


Member Typedef Documentation

template<typename KeyType, typename PriorityType, class Cmp = std::less<PriorityType>>
typedef container_t::iterator stxxl::addressable_priority_queue< KeyType, PriorityType, Cmp >::container_iter_t [private]

Definition at line 122 of file addressable_queues.h.

template<typename KeyType, typename PriorityType, class Cmp = std::less<PriorityType>>
typedef std::set<std::pair<PriorityType, KeyType>, cmp> stxxl::addressable_priority_queue< KeyType, PriorityType, Cmp >::container_t [private]

Definition at line 121 of file addressable_queues.h.

template<typename KeyType, typename PriorityType, class Cmp = std::less<PriorityType>>
typedef meta_iter_t stxxl::addressable_priority_queue< KeyType, PriorityType, Cmp >::handle

Type of handle to an entry. For use with insert and remove.

Definition at line 131 of file addressable_queues.h.

template<typename KeyType, typename PriorityType, class Cmp = std::less<PriorityType>>
typedef meta_t::iterator stxxl::addressable_priority_queue< KeyType, PriorityType, Cmp >::meta_iter_t [private]

Definition at line 124 of file addressable_queues.h.

template<typename KeyType, typename PriorityType, class Cmp = std::less<PriorityType>>
typedef std::map<KeyType, container_iter_t> stxxl::addressable_priority_queue< KeyType, PriorityType, Cmp >::meta_t [private]

Definition at line 123 of file addressable_queues.h.


Constructor & Destructor Documentation

template<typename KeyType, typename PriorityType, class Cmp = std::less<PriorityType>>
stxxl::addressable_priority_queue< KeyType, PriorityType, Cmp >::addressable_priority_queue ( ) [inline]

Create an empty queue.

Definition at line 134 of file addressable_queues.h.

template<typename KeyType, typename PriorityType, class Cmp = std::less<PriorityType>>
stxxl::addressable_priority_queue< KeyType, PriorityType, Cmp >::~addressable_priority_queue ( ) [inline]

Definition at line 135 of file addressable_queues.h.


Member Function Documentation

template<typename KeyType, typename PriorityType, class Cmp = std::less<PriorityType>>
bool stxxl::addressable_priority_queue< KeyType, PriorityType, Cmp >::empty ( ) const [inline]

Check if queue is empty.

Returns:
If queue is empty.

Definition at line 139 of file addressable_queues.h.

template<typename KeyType, typename PriorityType, class Cmp = std::less<PriorityType>>
bool stxxl::addressable_priority_queue< KeyType, PriorityType, Cmp >::erase ( const KeyType &  e) [inline]

Erase element from the queue.

Parameters:
eElement to remove.
Returns:
If element was in.

Definition at line 162 of file addressable_queues.h.

template<typename KeyType, typename PriorityType, class Cmp = std::less<PriorityType>>
void stxxl::addressable_priority_queue< KeyType, PriorityType, Cmp >::erase ( handle  i) [inline]

Erase element from the queue.

Parameters:
iIterator to element to remove.

Definition at line 174 of file addressable_queues.h.

template<typename KeyType, typename PriorityType, class Cmp = std::less<PriorityType>>
std::pair<handle, bool> stxxl::addressable_priority_queue< KeyType, PriorityType, Cmp >::insert ( const KeyType &  e,
const PriorityType  o 
) [inline]

Insert new element. If the element is already in, it's priority is updated.

Parameters:
eElement to insert.
oPriority of element.
Returns:
pair<handle, bool> Iterator to element; if element was newly inserted.

Definition at line 146 of file addressable_queues.h.

template<typename KeyType, typename PriorityType, class Cmp = std::less<PriorityType>>
KeyType stxxl::addressable_priority_queue< KeyType, PriorityType, Cmp >::pop ( ) [inline]

Remove top (= min) element from the queue.

Returns:
Top element.

Definition at line 187 of file addressable_queues.h.

template<typename KeyType, typename PriorityType, class Cmp = std::less<PriorityType>>
const KeyType& stxxl::addressable_priority_queue< KeyType, PriorityType, Cmp >::top ( ) const [inline]

Access top (= min) element in the queue.

Returns:
Const reference to top element.

Definition at line 182 of file addressable_queues.h.


Member Data Documentation

template<typename KeyType, typename PriorityType, class Cmp = std::less<PriorityType>>
meta_t stxxl::addressable_priority_queue< KeyType, PriorityType, Cmp >::meta [private]

Definition at line 127 of file addressable_queues.h.

template<typename KeyType, typename PriorityType, class Cmp = std::less<PriorityType>>
container_t stxxl::addressable_priority_queue< KeyType, PriorityType, Cmp >::vals [private]

Definition at line 126 of file addressable_queues.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines