Stefan Scholz / ETL
Embed: (wiki syntax)

« Back to documentation index

priority_queue< T, SIZE, TContainer, TCompare > Class Template Reference

priority_queue< T, SIZE, TContainer, TCompare > Class Template Reference

A fixed capacity priority queue. More...

#include <priority_queue.h>

Inherits etl::ipriority_queue< T, TContainer, TCompare >.

Public Types

typedef T value_type
 The type stored in the queue.
typedef TContainer container_type
 The container type used for priority queue.
typedef TCompare compare_type
 The comparison type.
typedef T & reference
 A reference to the type used in the queue.
typedef const T & const_reference
 A const reference to the type used in the queue.
typedef TContainer::size_type size_type
 The type used for determining the size of the queue.

Public Member Functions

 priority_queue ()
 Default constructor.
 priority_queue (const priority_queue &rhs)
 Copy constructor.
template<typename TIterator >
 priority_queue (TIterator first, TIterator last)
 Constructor, from an iterator range.
 ~priority_queue ()
 Destructor.
priority_queueoperator= (const priority_queue &rhs)
 Assignment operator.
reference top ()
 Gets a reference to the highest priority value in the priority queue.
const_reference top () const
 Gets a const reference to the highest priority value in the priority queue.
void push (parameter_t value)
 Adds a value to the queue.
template<typename T1 >
void emplace (const T1 &value1)
 Emplaces a value to the queue.
template<typename T1 , typename T2 >
void emplace (const T1 &value1, const T2 &value2)
 Emplaces a value to the queue.
template<typename T1 , typename T2 , typename T3 >
void emplace (const T1 &value1, const T2 &value2, const T3 &value3)
 Emplaces a value to the queue.
template<typename T1 , typename T2 , typename T3 , typename T4 >
void emplace (const T1 &value1, const T2 &value2, const T3 &value3, const T4 &value4)
 Emplaces a value to the queue.
template<typename TIterator >
void assign (TIterator first, TIterator last)
 Assigns values to the priority queue.
void pop ()
 Removes the oldest value from the back of the priority queue.
void pop_into (reference destination)
 Gets the highest priority value in the priority queue and assigns it to destination and removes it from the queue.
size_type size () const
 Returns the current number of items in the priority queue.
size_type max_size () const
 Returns the maximum number of items that can be queued.
bool empty () const
 Checks to see if the priority queue is empty.
bool full () const
 Checks to see if the priority queue is full.
size_t available () const
 Returns the remaining capacity.
void clear ()
 Clears the queue to the empty state.

Protected Member Functions

void clone (const ipriority_queue &other)
 Make this a clone of the supplied priority queue.

Detailed Description

template<typename T, const size_t SIZE, typename TContainer = etl::vector<T, SIZE>, typename TCompare = std::less<typename TContainer::value_type>>
class etl::priority_queue< T, SIZE, TContainer, TCompare >

A fixed capacity priority queue.

This queue does not support concurrent access by different threads.

Template Parameters:
TThe type this queue should support.
SIZEThe maximum capacity of the queue.

Definition at line 367 of file priority_queue.h.


Member Typedef Documentation

typedef TCompare compare_type [inherited]

The comparison type.

Definition at line 123 of file priority_queue.h.

typedef const T& const_reference [inherited]

A const reference to the type used in the queue.

Definition at line 125 of file priority_queue.h.

typedef TContainer container_type [inherited]

The container type used for priority queue.

Definition at line 122 of file priority_queue.h.

typedef T& reference [inherited]

A reference to the type used in the queue.

Definition at line 124 of file priority_queue.h.

typedef TContainer::size_type size_type [inherited]

The type used for determining the size of the queue.

Definition at line 126 of file priority_queue.h.

typedef T value_type [inherited]

The type stored in the queue.

Definition at line 121 of file priority_queue.h.


Constructor & Destructor Documentation

Default constructor.

Definition at line 376 of file priority_queue.h.

priority_queue ( const priority_queue< T, SIZE, TContainer, TCompare > &  rhs )

Copy constructor.

Definition at line 384 of file priority_queue.h.

priority_queue ( TIterator  first,
TIterator  last 
)

Constructor, from an iterator range.

Template Parameters:
TIteratorThe iterator type.
Parameters:
firstThe iterator to the first element.
lastThe iterator to the last element + 1.

Definition at line 397 of file priority_queue.h.

Destructor.

Definition at line 406 of file priority_queue.h.


Member Function Documentation

void assign ( TIterator  first,
TIterator  last 
) [inherited]

Assigns values to the priority queue.

If asserts or exceptions are enabled, emits priority_queue_full if priority queue does not have enough free space. If asserts or exceptions are enabled, emits priority_iterator if the iterators are reversed.

Parameters:
firstThe iterator to the first element.
lastThe iterator to the last element + 1.

Definition at line 247 of file priority_queue.h.

size_t available (  ) const [inherited]

Returns the remaining capacity.

Returns:
The remaining capacity.

Definition at line 320 of file priority_queue.h.

void clear (  ) [inherited]

Clears the queue to the empty state.

Definition at line 328 of file priority_queue.h.

void clone ( const ipriority_queue< T, TContainer, TCompare > &  other ) [protected, inherited]

Make this a clone of the supplied priority queue.

Definition at line 338 of file priority_queue.h.

void emplace ( const T1 &  value1,
const T2 &  value2,
const T3 &  value3,
const T4 &  value4 
) [inherited]

Emplaces a value to the queue.

If asserts or exceptions are enabled, throws an etl::priority_queue_full is the priority queue is already full.

Parameters:
valueThe value to push to the queue.

Definition at line 227 of file priority_queue.h.

void emplace ( const T1 &  value1 ) [inherited]

Emplaces a value to the queue.

If asserts or exceptions are enabled, throws an etl::priority_queue_full is the priority queue is already full.

Parameters:
valueThe value to push to the queue.

Definition at line 176 of file priority_queue.h.

void emplace ( const T1 &  value1,
const T2 &  value2 
) [inherited]

Emplaces a value to the queue.

If asserts or exceptions are enabled, throws an etl::priority_queue_full is the priority queue is already full.

Parameters:
valueThe value to push to the queue.

Definition at line 193 of file priority_queue.h.

void emplace ( const T1 &  value1,
const T2 &  value2,
const T3 &  value3 
) [inherited]

Emplaces a value to the queue.

If asserts or exceptions are enabled, throws an etl::priority_queue_full is the priority queue is already full.

Parameters:
valueThe value to push to the queue.

Definition at line 210 of file priority_queue.h.

bool empty (  ) const [inherited]

Checks to see if the priority queue is empty.

Returns:
true if the queue is empty, otherwise false

Definition at line 302 of file priority_queue.h.

bool full (  ) const [inherited]

Checks to see if the priority queue is full.

Returns:
true if the priority queue is full, otherwise false

Definition at line 311 of file priority_queue.h.

size_type max_size (  ) const [inherited]

Returns the maximum number of items that can be queued.

Definition at line 293 of file priority_queue.h.

priority_queue& operator= ( const priority_queue< T, SIZE, TContainer, TCompare > &  rhs )

Assignment operator.

Definition at line 414 of file priority_queue.h.

void pop (  ) [inherited]

Removes the oldest value from the back of the priority queue.

Does nothing if the priority queue is already empty.

Definition at line 264 of file priority_queue.h.

void pop_into ( reference  destination ) [inherited]

Gets the highest priority value in the priority queue and assigns it to destination and removes it from the queue.

Definition at line 276 of file priority_queue.h.

void push ( parameter_t  value ) [inherited]

Adds a value to the queue.

If asserts or exceptions are enabled, throws an etl::priority_queue_full is the priority queue is already full.

Parameters:
valueThe value to push to the queue.

Definition at line 159 of file priority_queue.h.

size_type size (  ) const [inherited]

Returns the current number of items in the priority queue.

Definition at line 285 of file priority_queue.h.

reference top (  ) [inherited]

Gets a reference to the highest priority value in the priority queue.


Returns:
A reference to the highest priority value in the priority queue.

Definition at line 139 of file priority_queue.h.

const_reference top (  ) const [inherited]

Gets a const reference to the highest priority value in the priority queue.


Returns:
A const reference to the highest priority value in the priority queue.

Definition at line 148 of file priority_queue.h.