BWAPI
Public Member Functions
Heap< _Tp, _Val > Class Template Reference

#include <Heap.h>

List of all members.

Public Member Functions

 Heap (bool isMinHeap=false)
 ~Heap ()
void push (std::pair< _Tp, _Val > x)
void pop ()
const std::pair< _Tp, _Val > & top () const
bool set (_Tp &x, _Val &v)
const _Val & get (_Tp &x) const
bool contains (_Tp &x) const
bool empty () const
int size () const
void clear ()
bool erase (_Tp &x)

Detailed Description

template<class _Tp, class _Val>
class Heap< _Tp, _Val >

An associated heap class with the ability to read and change the values of arbitrary objects in the heap. Note: Objects in the heap must be unique, however any number of objects can have the same value


Constructor & Destructor Documentation

template<class _Tp, class _Val>
Heap< _Tp, _Val >::Heap ( bool  isMinHeap = false) [inline]
template<class _Tp, class _Val>
Heap< _Tp, _Val >::~Heap ( ) [inline]

Member Function Documentation

template<class _Tp , class _Val >
void Heap< _Tp, _Val >::clear ( )

Removes all of the elements in the heap

template<class _Tp , class _Val >
bool Heap< _Tp, _Val >::contains ( _Tp &  x) const

Returns true if the heap contains the given element, false otherwise

template<class _Tp , class _Val >
bool Heap< _Tp, _Val >::empty ( ) const

Returns true if the heap has no elements, false otherwise

Here is the caller graph for this function:

template<class _Tp , class _Val >
bool Heap< _Tp, _Val >::erase ( _Tp &  x)

Deletes the given object from the heap

Parameters:
anobject that already exists in the heap
Returns:
boolean based on the success of the deletion
template<class _Tp , class _Val >
const _Val & Heap< _Tp, _Val >::get ( _Tp &  x) const

Looks up the given object and returns its value

Parameters:
objectto look up
Returns:
the value of the object
template<class _Tp , class _Val >
void Heap< _Tp, _Val >::pop ( )

Pops the top of the heap

Here is the caller graph for this function:

template<class _Tp , class _Val >
void Heap< _Tp, _Val >::push ( std::pair< _Tp, _Val >  x)

Pushes an object associated with the given value onto the heap

Parameters:
Theobject-value pair to push onto the heap
template<class _Tp , class _Val >
bool Heap< _Tp, _Val >::set ( _Tp &  x,
_Val &  v 
)

Updates the given object with the given value and moves the object to the appropiate place in the heap

Parameters:
anobject that exists in the heap
thenew value for that object
Returns:
boolean based on the success of the update
template<class _Tp , class _Val >
int Heap< _Tp, _Val >::size ( ) const

Returns the number of elements in the heap

template<class _Tp , class _Val >
const std::pair< _Tp, _Val > & Heap< _Tp, _Val >::top ( ) const

Returns a reference to the object-value pair at the top of the heap

Here is the caller graph for this function:


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines