ASSA::PriorityQueue_STLPQ< T, Compare > Class Template Reference

#include <PriorityQueue_STLPQ.h>

Inheritance diagram for ASSA::PriorityQueue_STLPQ< T, Compare >:

Inheritance graph
[legend]
Collaboration diagram for ASSA::PriorityQueue_STLPQ< T, Compare >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ~PriorityQueue_STLPQ ()
void insert (const T &)
pop ()
const T & top () const
bool remove (const int)
size_t size ()
void dump ()

Private Attributes

priority_queue< T *, deque<
T * >, Compare > 
m_queue

Detailed Description

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

Definition at line 33 of file PriorityQueue_STLPQ.h.


Constructor & Destructor Documentation

template<class T, class Compare>
ASSA::PriorityQueue_STLPQ< T, Compare >::~PriorityQueue_STLPQ  )  [inline]
 

Definition at line 54 of file PriorityQueue_STLPQ.h.

References ASSA::PriorityQueue_STLPQ< T, Compare >::m_queue, and trace.

00055 {
00056     trace("PriorityQueue_STLPQ::~PriorityQueue_STLPQ"); 
00057 
00058     while ( m_queue.size () ) {
00059         delete m_queue.top ();
00060         m_queue.pop ();
00061     }
00062 }


Member Function Documentation

template<class T, class Compare>
void ASSA::PriorityQueue_STLPQ< T, Compare >::dump  )  [inline]
 

Definition at line 147 of file PriorityQueue_STLPQ.h.

References DL, ASSA::Timer::dump(), ASSA::PriorityQueue_STLPQ< T, Compare >::m_queue, ASSA::TRACE, and trace.

00148 {
00149     trace("PriorityQueue_STLPQ::dump");
00150 
00151     list<Timer*> t_list;
00152     register Timer* t_ptr = 0;
00153     DL((TRACE,"======TimerQueue start=======\n"));
00154     while (m_queue.size () > 0) {
00155         t_ptr = m_queue.top ();
00156         t_ptr->dump ();
00157         t_list.push_back (t_ptr);
00158     }
00159     DL((TRACE,"======TimerQueue end=========\n"));
00160     list<Timer*>::iterator i;
00161 
00162     for (i = t_list.begin (); i != t_list.end (); i++) {
00163         m_queue.push (*i);
00164     }
00165 }

template<class T, class Compare>
void ASSA::PriorityQueue_STLPQ< T, Compare >::insert const T &   )  [inline, virtual]
 

Implements ASSA::PriorityQueue_Impl< T, Compare >.

Definition at line 67 of file PriorityQueue_STLPQ.h.

References ASSA::PriorityQueue_STLPQ< T, Compare >::m_queue, and trace.

00068 {
00069     trace("PriorityQueue_STLPQ::insert");
00070     m_queue.push (t_);
00071 }

template<class T, class Compare>
T ASSA::PriorityQueue_STLPQ< T, Compare >::pop  )  [inline, virtual]
 

Implements ASSA::PriorityQueue_Impl< T, Compare >.

Definition at line 76 of file PriorityQueue_STLPQ.h.

References ASSA::PriorityQueue_STLPQ< T, Compare >::m_queue, and trace.

00077 {
00078     trace("PriorityQueue_STLPQ::pop");
00079 
00080     T t = m_queue.top ();
00081     m_queue.pop ();
00082     return t;
00083 }

template<class T, class Compare>
bool ASSA::PriorityQueue_STLPQ< T, Compare >::remove const   int  ) 
 

Definition at line 106 of file PriorityQueue_STLPQ.h.

References ASSA::Timer::getHandler(), ASSA::PriorityQueue_STLPQ< T, Compare >::m_queue, and trace.

00107 {
00108     trace("PriorityQueue_STLPQ::remove");
00109 
00110     list<Timer*> t_list;
00111     register Timer* t_ptr = 0;
00112     register int cnt = 0;
00113 
00114     while (m_queue.size () > 0) {
00115         t_ptr = m_queue.top ();
00116         if (t_ptr->getHandler ()-> id() == id_) {
00117             delete t_ptr;
00118             cnt++;
00119         }
00120         else {
00121             t_list.push_back (t_ptr);
00122         }
00123         m_queue.pop ();
00124     }
00125     // Restore queue
00126     
00127     list<Timer*>::iterator i;
00128 
00129     for (i = t_list.begin (); i != t_list.end (); i++) {
00130         m_queue.push (*i);
00131     }
00132 
00133     return cnt;
00134 }

template<class T, class Compare>
size_t ASSA::PriorityQueue_STLPQ< T, Compare >::size  )  [inline, virtual]
 

Implements ASSA::PriorityQueue_Impl< T, Compare >.

Definition at line 139 of file PriorityQueue_STLPQ.h.

References ASSA::PriorityQueue_STLPQ< T, Compare >::m_queue.

00140 {
00141     return m_queue.size ();
00142 }

template<class T, class Compare>
const T & ASSA::PriorityQueue_STLPQ< T, Compare >::top  )  const [inline, virtual]
 

Implements ASSA::PriorityQueue_Impl< T, Compare >.

Definition at line 88 of file PriorityQueue_STLPQ.h.

References ASSA::PriorityQueue_STLPQ< T, Compare >::m_queue, and trace.

00089 {
00090     trace("PriorityQueue_STLPQ::top");
00091     return (const T&) m_queue.top ();
00092 }


Member Data Documentation

template<class T, class Compare>
priority_queue<T*, deque<T*>, Compare> ASSA::PriorityQueue_STLPQ< T, Compare >::m_queue [private]
 

Definition at line 48 of file PriorityQueue_STLPQ.h.

Referenced by ASSA::PriorityQueue_STLPQ< T, Compare >::dump(), ASSA::PriorityQueue_STLPQ< T, Compare >::insert(), ASSA::PriorityQueue_STLPQ< T, Compare >::pop(), ASSA::PriorityQueue_STLPQ< T, Compare >::remove(), ASSA::PriorityQueue_STLPQ< T, Compare >::size(), ASSA::PriorityQueue_STLPQ< T, Compare >::top(), and ASSA::PriorityQueue_STLPQ< T, Compare >::~PriorityQueue_STLPQ().


The documentation for this class was generated from the following file:
Generated on Sun Aug 13 15:08:20 2006 for libassa by  doxygen 1.4.6