CrystalSpace

Public API Reference

CS::Utility::PriorityQueue< T, Container > Class Template Reference

An implementation of a priority queue. More...

#include <csutil/priorityqueue.h>

List of all members.

Public Member Functions

template<typename T2>
bool Delete (const T2 &what)
 Remove largest item that is equal to what.
void Insert (const T &what)
 Insert an item.
bool IsEmpty () const
 Return whether items are still in the queue.
Pop ()
 Return and remove the largest item.
const T & Top () const
 Return, but don't remove, the largest item.


Detailed Description

template<typename T, class Container = csArray<T>>
class CS::Utility::PriorityQueue< T, Container >

An implementation of a priority queue.

T must be comparable with csComparator<>. Larger items are returned first.

Definition at line 39 of file priorityqueue.h.


Member Function Documentation

template<typename T, class Container = csArray<T>>
template<typename T2>
bool CS::Utility::PriorityQueue< T, Container >::Delete ( const T2 &  what  )  [inline]

Remove largest item that is equal to what.

The contained type T and the type T2 of what must be comparable with csComparator<>.

Returns:
Whether item was found and deleted.
Remarks:
Does a linear search - slow.

Definition at line 135 of file priorityqueue.h.

template<typename T, class Container = csArray<T>>
void CS::Utility::PriorityQueue< T, Container >::Insert ( const T &  what  )  [inline]

Insert an item.

Definition at line 103 of file priorityqueue.h.

template<typename T, class Container = csArray<T>>
bool CS::Utility::PriorityQueue< T, Container >::IsEmpty (  )  const [inline]

Return whether items are still in the queue.

Definition at line 150 of file priorityqueue.h.

template<typename T, class Container = csArray<T>>
T CS::Utility::PriorityQueue< T, Container >::Pop (  )  [inline]

Return and remove the largest item.

Definition at line 111 of file priorityqueue.h.

template<typename T, class Container = csArray<T>>
const T& CS::Utility::PriorityQueue< T, Container >::Top (  )  const [inline]

Return, but don't remove, the largest item.

Definition at line 122 of file priorityqueue.h.


The documentation for this class was generated from the following file:
Generated for Crystal Space 1.2.1 by doxygen 1.5.3