pqueue Class Template Reference

#include <pqueue.hpp>

Inheritance diagram for pqueue:

Inheritance graph
[legend]
Collaboration diagram for pqueue:

Collaboration graph
[legend]

List of all members.


Detailed Description

template<typename T, typename I>
class gsgl::data::pqueue< T, I >

A priority queue. Should only be used with simple types, as it copies around chunks of memory.

Definition at line 53 of file pqueue.hpp.


Public Member Functions

virtual bool contains_index (const I &) const =0
virtual bool is_empty () const
 Returns true if the collection is empty.
virtual T & item (const I &index)=0
virtual const T & item (const I &index) const =0
pqueueoperator= (const pqueue &)
T & operator[] (const I &index)
const T & operator[] (const I &index) const
 pqueue (const pqueue &)
 pqueue ()
virtual ~pqueue ()
Other Useful Functions
virtual void append (const iterable< T, IBase > &)
 Append all members of a collection to this one.
virtual iterator find_value (const T &)
virtual const_iterator find_value (const T &) const
 A generic find function that iterates over the collection to find a particular value.
Iterable Implementation
virtual void append (const T &)
 Add an item to the end of the collection.
virtual void insert (const iterator &, const T &)
 Insert an item before the one specified by the iterator.
virtual void remove (const iterator &)
 Remove the item specified by the iterator.
Countable Implementation
virtual void clear ()
 Clears the contents of the collection.
virtual gsgl::index_t size () const
 A generic count function that iterates over the collection.
Indexable Implementation
virtual bool contains_index (const gsgl::index_t &) const
virtual T & item (const gsgl::index_t &)
virtual const T & item (const gsgl::index_t &) const
Priority Queue Functionality
T & get_head ()
const T & get_head () const
void pop ()
void push (const T &, const I &)
Iterators
iterator iter ()
const_iterator iter () const

Private Attributes

data::simple_array< I > priorities
data::simple_array< T > values

Constructor & Destructor Documentation

pqueue (  )  [inline]

Definition at line 101 of file pqueue.hpp.

pqueue ( const pqueue< T, I > &  pq  )  [inline]

Definition at line 108 of file pqueue.hpp.

~pqueue (  )  [inline, virtual]

Definition at line 124 of file pqueue.hpp.


Member Function Documentation

void append ( const iterable< T, IBase > &  a  )  [inline, virtual, inherited]

Append all members of a collection to this one.

Definition at line 145 of file iterable.hpp.

void append ( const T &   )  [inline, virtual]

Add an item to the end of the collection.

Implements iterable.

Definition at line 173 of file pqueue.hpp.

References pqueue::push().

void clear (  )  [inline, virtual]

Clears the contents of the collection.

Implements countable.

Definition at line 140 of file pqueue.hpp.

References simple_array::clear(), pqueue::priorities, and pqueue::values.

virtual bool contains_index ( const I &   )  const [pure virtual, inherited]

Implemented in dictionary.

bool contains_index ( const gsgl::index_t index  )  const [inline, virtual]

Definition at line 164 of file pqueue.hpp.

References pqueue::values.

iterable< T, IBase >::iterator find_value ( const T &  item  )  [inline, virtual, inherited]

Definition at line 168 of file iterable.hpp.

References iterable::iterator::is_valid().

iterable< T, IBase >::const_iterator find_value ( const T &  item  )  const [inline, virtual, inherited]

A generic find function that iterates over the collection to find a particular value.

Note:
Not efficient; should be overridden if possible.

Definition at line 153 of file iterable.hpp.

References iterable::const_iterator::is_valid().

Referenced by gsgl::data::global_unregister_resource_aux().

T & get_head (  )  [inline]

Definition at line 209 of file pqueue.hpp.

References pqueue::values.

const T & get_head (  )  const [inline]

Definition at line 195 of file pqueue.hpp.

References pqueue::values.

void insert ( const iterator ,
const T &   
) [inline, virtual]

Insert an item before the one specified by the iterator.

Implements iterable.

Definition at line 180 of file pqueue.hpp.

References pqueue::priorities, and pqueue::push().

virtual bool is_empty (  )  const [inline, virtual, inherited]

virtual T& item ( const I &  index  )  [pure virtual, inherited]

Implemented in dictionary.

virtual const T& item ( const I &  index  )  const [pure virtual, inherited]

T & item ( const gsgl::index_t index  )  [inline, virtual]

Definition at line 157 of file pqueue.hpp.

References pqueue::values.

const T & item ( const gsgl::index_t index  )  const [inline, virtual]

Definition at line 150 of file pqueue.hpp.

References pqueue::values.

iterator iter (  )  [inline, inherited]

Returns:
An iterator pointing to the first item in the collection.

Definition at line 101 of file iterable.hpp.

const_iterator iter (  )  const [inline, inherited]

pqueue< T, I > & operator= ( const pqueue< T, I > &  pq  )  [inline]

Definition at line 115 of file pqueue.hpp.

References pqueue::priorities, and pqueue::values.

T& operator[] ( const I &  index  )  [inline, inherited]

Definition at line 58 of file indexable.hpp.

const T& operator[] ( const I &  index  )  const [inline, inherited]

Definition at line 57 of file indexable.hpp.

void pop (  )  [inline]

Definition at line 237 of file pqueue.hpp.

References pqueue::priorities, simple_array::remove(), and pqueue::values.

void push ( const T &  item,
const I &  priority 
) [inline]

Definition at line 223 of file pqueue.hpp.

References simple_array::insert(), pqueue::priorities, and pqueue::values.

Referenced by pqueue::append(), and pqueue::insert().

void remove ( const iterator  )  [inline, virtual]

Remove the item specified by the iterator.

Implements iterable.

Definition at line 187 of file pqueue.hpp.

References pqueue::priorities, simple_array::remove(), and pqueue::values.

gsgl::index_t size (  )  const [inline, virtual]

A generic count function that iterates over the collection.

Note:
Not very efficient; should be overridden if possible.

Reimplemented from iterable.

Definition at line 132 of file pqueue.hpp.

References assert, pqueue::priorities, simple_array::size(), and pqueue::values.


Member Data Documentation

data::simple_array<T> values [private]


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

Generated on Sat Mar 1 13:50:06 2008 for Periapsis Project by  doxygen 1.5.5