Public Types | Public Member Functions

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 addressable_priority_queue< KeyType, PriorityType, Cmp >:
Inheritance graph
[legend]

List of all members.

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.
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.

Detailed Description

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

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

Template Parameters:
KeyType Type of contained elements.
PriorityType Type of Priority.

Member Typedef Documentation

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

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


Constructor & Destructor Documentation

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

Create an empty queue.


Member Function Documentation

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

Check if queue is empty.

Returns:
If queue is empty.

Referenced by addressable_priority_queue< swappable_block_identifier_type, priority >::pop().

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

Erase element from the queue.

Parameters:
i Iterator to element to remove.
template<typename KeyType, typename PriorityType, class Cmp = std::less<PriorityType>>
bool addressable_priority_queue< KeyType, PriorityType, Cmp >::erase ( const KeyType &  e  )  [inline]

Erase element from the queue.

Parameters:
e Element to remove.
Returns:
If element was in.
template<typename KeyType, typename PriorityType, class Cmp = std::less<PriorityType>>
std::pair<handle, bool> 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:
e Element to insert.
o Priority of element.
Returns:
pair<handle, bool> Iterator to element; if element was newly inserted.
template<typename KeyType, typename PriorityType, class Cmp = std::less<PriorityType>>
KeyType addressable_priority_queue< KeyType, PriorityType, Cmp >::pop (  )  [inline]

Remove top (= min) element from the queue.

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

Access top (= min) element in the queue.

Returns:
Const reference to top element.

Referenced by addressable_priority_queue< swappable_block_identifier_type, priority >::pop().


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