Stefan Scholz / ETL
Embed: (wiki syntax)

« Back to documentation index

ipriority_queue< T, TContainer, TCompare > Class Template Reference

ipriority_queue< T, TContainer, TCompare > Class Template Reference
[queue]

This is the base for all priority queues that contain a particular type. More...

#include <priority_queue.h>

Inherited by priority_queue< T, SIZE, 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

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.
 ipriority_queue ()
 The constructor that is called from derived classes.

Detailed Description

template<typename T, typename TContainer, typename TCompare>
class etl::ipriority_queue< T, TContainer, TCompare >

This is the base for all priority queues that contain a particular type.

Normally a reference to this type will be taken from a derived queue. The TContainer specified must provide the front, push_back, pop_back, and assign methods to work correctly with priority_queue.

      etl::priority_queue<int, 10> myPriorityQueue;
      etl::ipriority_queue<int>& iQueue = myPriorityQueue;
Warning:
This priority queue cannot be used for concurrent access from multiple threads.
Template Parameters:
TThe type of value that the queue holds.
TContainerto hold the T queue values
TCompareto use in comparing T values

Definition at line 117 of file priority_queue.h.


Member Typedef Documentation

typedef TCompare compare_type

The comparison type.

Definition at line 123 of file priority_queue.h.

typedef const T& const_reference

A const reference to the type used in the queue.

Definition at line 125 of file priority_queue.h.

typedef TContainer container_type

The container type used for priority queue.

Definition at line 122 of file priority_queue.h.

typedef T& reference

A reference to the type used in the queue.

Definition at line 124 of file priority_queue.h.

typedef TContainer::size_type size_type

The type used for determining the size of the queue.

Definition at line 126 of file priority_queue.h.

typedef T value_type

The type stored in the queue.

Definition at line 121 of file priority_queue.h.


Constructor & Destructor Documentation

ipriority_queue (  ) [protected]

The constructor that is called from derived classes.

Definition at line 346 of file priority_queue.h.


Member Function Documentation

void assign ( TIterator  first,
TIterator  last 
)

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

Returns the remaining capacity.

Returns:
The remaining capacity.

Definition at line 320 of file priority_queue.h.

void clear (  )

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]

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 
)

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 )

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 
)

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 
)

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

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

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

Returns the maximum number of items that can be queued.

Definition at line 293 of file priority_queue.h.

void pop (  )

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 )

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 )

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

Returns the current number of items in the priority queue.

Definition at line 285 of file priority_queue.h.

reference top (  )

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

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.