Loading...
Searching...
No Matches
ASSA::PriorityQueue< T, Compare > Class Template Reference

`#include <PriorityQueue.h>`

## Public Member Functions

| PriorityQueue (size_t max_=20)
| PriorityQueue (size_t max_, const Compare &)
virtual | ~PriorityQueue ()
virtual void | insert (const T &)
virtual T | pop ()
virtual const T & | top () const
virtual bool | remove (T &)
virtual size_t | size ()
virtual T & | operator[] (int)
virtual void | setHeapImpl (size_t, const Compare &)

## Protected Member Functions

const PriorityQueue_Impl< T, Compare > * | getPriorityQueueImpl () const
| PriorityQueue (const PriorityQueue &)
PriorityQueue & | operator= (const PriorityQueue &)

## Protected Attributes

Compare | m_comp

## Private Attributes

PriorityQueue_Impl< T, Compare > * | m_impl

## Detailed Description

template<class T, class Compare>
class ASSA::PriorityQueue< T, Compare >

Definition at line 34 of file PriorityQueue.h.

## Constructor & Destructor Documentation

## PriorityQueue() [1/3]

template<class T , class Compare >

ASSA::PriorityQueue< T, Compare >::PriorityQueue | ( | size_t | max_ = `20` | ) |

inline

Definition at line 68 of file PriorityQueue.h.

: m_impl (0)
{
// This is a perfect place for using Factory to decide which
// implementation to use
// const char self[]="PriorityQueue::PriorityQueue(maxsz)"; trace();
setHeapImpl (maxsz_, m_comp);
}
ASSA::PriorityQueue::setHeapImpl
virtual void setHeapImpl(size_t, const Compare &)
Definition PriorityQueue.h:93
ASSA::PriorityQueue::m_impl
PriorityQueue_Impl< T, Compare > * m_impl
Definition PriorityQueue.h:59
ASSA::PriorityQueue::m_comp
Compare m_comp
Definition PriorityQueue.h:53

References ASSA::PriorityQueue< T, Compare >::m_comp, and ASSA::PriorityQueue< T, Compare >::setHeapImpl().

## PriorityQueue() [2/3]

template<class T , class Compare >

ASSA::PriorityQueue< T, Compare >::PriorityQueue | ( | size_t | max_,
|  | const Compare & | x_
| ) |  |

inline

Definition at line 81 of file PriorityQueue.h.

: m_comp (x_), m_impl (0)
{
// This is perfect place for using Factory to decide which
// implementation to use
setHeapImpl (maxsz_, m_comp);
}

References ASSA::PriorityQueue< T, Compare >::m_comp, and ASSA::PriorityQueue< T, Compare >::setHeapImpl().

## ~PriorityQueue()

template<class T , class Compare >

ASSA::PriorityQueue< T, Compare >::~PriorityQueue | ( |  | ) |

inline virtual

Definition at line 107 of file PriorityQueue.h.

{
delete m_impl;
}

## PriorityQueue() [3/3]

template<class T , class Compare >

ASSA::PriorityQueue< T, Compare >::PriorityQueue | ( | const PriorityQueue< T, Compare > & |  | ) |

protected

## Member Function Documentation

## getPriorityQueueImpl()

template<class T , class Compare >

const PriorityQueue_Impl< T, Compare > * ASSA::PriorityQueue< T, Compare >::getPriorityQueueImpl | ( |  | ) | const

inline protected

Definition at line 155 of file PriorityQueue.h.

{
return (const PriorityQueue_Impl<T, Compare>*) m_impl;
}

## insert()

template<class T , class Compare >

void ASSA::PriorityQueue< T, Compare >::insert | ( | const T & | el_ | ) |

inline virtual

Definition at line 115 of file PriorityQueue.h.

{
m_impl->insert (el_);
}

## operator=()

template<class T , class Compare >

PriorityQueue & ASSA::PriorityQueue< T, Compare >::operator= | ( | const PriorityQueue< T, Compare > & |  | ) |

protected

## operator[]()

template<class T , class Compare >

T & ASSA::PriorityQueue< T, Compare >::operator[] | ( | int | idx | ) |

inline virtual

Definition at line 163 of file PriorityQueue.h.

{
return (*m_impl)[idx];
}

## pop()

template<class T , class Compare >

T ASSA::PriorityQueue< T, Compare >::pop | ( |  | ) |

inline virtual

Definition at line 123 of file PriorityQueue.h.

{
return m_impl->pop ();
}

## remove()

template<class T , class Compare >

bool ASSA::PriorityQueue< T, Compare >::remove | ( | T & | t_ | ) |

inline virtual

Definition at line 139 of file PriorityQueue.h.

{
return m_impl->remove (t_);
}

## setHeapImpl()

template<class T , class Compare >

void ASSA::PriorityQueue< T, Compare >::setHeapImpl | ( | size_t | maxsz_,
|  | const Compare & | x_
| ) |  |

inline virtual

Definition at line 92 of file PriorityQueue.h.

{
// Maybe here you would want to copy contents of the old
// implementation to the new one?
//
if (m_impl != 0)
delete m_impl;
m_impl = new PriorityQueue_Heap<T, Compare> (maxsz_, x_);
}

Referenced by ASSA::PriorityQueue< T, Compare >::PriorityQueue(), and ASSA::PriorityQueue< T, Compare >::PriorityQueue().

## size()

template<class T , class Compare >

size_t ASSA::PriorityQueue< T, Compare >::size | ( |  | ) |

inline virtual

Definition at line 147 of file PriorityQueue.h.

{
return m_impl->size ();
}

## top()

template<class T , class Compare >

const T & ASSA::PriorityQueue< T, Compare >::top | ( |  | ) | const

inline virtual

Definition at line 131 of file PriorityQueue.h.

{
return m_impl->top ();
}

## Member Data Documentation

## m_comp

template<class T , class Compare >

Compare ASSA::PriorityQueue< T, Compare >::m_comp

protected

Definition at line 53 of file PriorityQueue.h.

Referenced by ASSA::PriorityQueue< T, Compare >::PriorityQueue(), and ASSA::PriorityQueue< T, Compare >::PriorityQueue().

## m_impl

template<class T , class Compare >

PriorityQueue_Impl< T, Compare >* ASSA::PriorityQueue< T, Compare >::m_impl

private

Definition at line 59 of file PriorityQueue.h.

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

- PriorityQueue.h