Thrill  0.1
addressable_priority_queue< KeyType, PriorityType, Cmp > Class Template Reference

Detailed Description

template<typename KeyType, typename PriorityType, class Cmp = std::less<PriorityType>>
class foxxll::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 113 of file addressable_queues.hpp.

+ Inheritance diagram for addressable_priority_queue< KeyType, PriorityType, Cmp >:

#include <addressable_queues.hpp>

Classes

struct  cmp
 

Public Types

using handle = meta_iterator
 Type of handle to an entry. For use with insert and remove. More...
 

Public Member Functions

 addressable_priority_queue ()
 Create an empty queue. More...
 
 ~addressable_priority_queue ()
 
bool empty () const
 
bool erase (const KeyType &e)
 
void erase (handle i)
 
std::pair< handle, bool > insert (const KeyType &e, const PriorityType o)
 
KeyType pop ()
 
const KeyType & top () const
 

Private Types

using container_iterator = typename container_type::iterator
 
using container_type = std::set< std::pair< PriorityType, KeyType >, cmp >
 
using meta_iterator = typename meta_type::iterator
 
using meta_type = std::map< KeyType, container_iterator >
 

Private Attributes

meta_type meta
 
container_type vals
 

Member Typedef Documentation

◆ container_iterator

using container_iterator = typename container_type::iterator
private

Definition at line 127 of file addressable_queues.hpp.

◆ container_type

using container_type = std::set<std::pair<PriorityType, KeyType>, cmp>
private

Definition at line 126 of file addressable_queues.hpp.

◆ handle

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

Definition at line 136 of file addressable_queues.hpp.

◆ meta_iterator

using meta_iterator = typename meta_type::iterator
private

Definition at line 129 of file addressable_queues.hpp.

◆ meta_type

using meta_type = std::map<KeyType, container_iterator>
private

Definition at line 128 of file addressable_queues.hpp.

Constructor & Destructor Documentation

◆ addressable_priority_queue()

Create an empty queue.

Definition at line 139 of file addressable_queues.hpp.

◆ ~addressable_priority_queue()

Definition at line 140 of file addressable_queues.hpp.

Member Function Documentation

◆ empty()

◆ erase() [1/2]

bool erase ( const KeyType &  e)
inline

◆ erase() [2/2]

void erase ( handle  i)
inline

Erase element from the queue.

Parameters
iIterator to element to remove.

Definition at line 179 of file addressable_queues.hpp.

◆ insert()

std::pair<handle, bool> 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 151 of file addressable_queues.hpp.

Referenced by block_scheduler_algorithm_offline_lfd< SwappableBlockType >::init(), and block_scheduler_algorithm_offline_lfd< SwappableBlockType >::release().

◆ pop()

◆ top()

const KeyType& top ( ) const
inline

Access top (= min) element in the queue.

Returns
Const reference to top element.

Definition at line 187 of file addressable_queues.hpp.

Member Data Documentation

◆ meta

meta_type meta
private

Definition at line 132 of file addressable_queues.hpp.

◆ vals

container_type vals
private

Definition at line 131 of file addressable_queues.hpp.


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