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

`#include <PriorityQueue_STLPQ.h>`

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

## Public Member Functions

| ~PriorityQueue_STLPQ ()
void | insert (const T &)
T | pop ()
const T & | top () const
bool | remove (const int)
size_t | size ()
void | dump ()
Public Member Functions inherited from ASSA::PriorityQueue_Impl< T, Compare >
virtual | ~PriorityQueue_Impl ()
virtual bool | remove (T)=0
virtual T & | operator[] (int)=0

## 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

## ~PriorityQueue_STLPQ()

template<class T , class Compare >

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

inline

Definition at line 53 of file PriorityQueue_STLPQ.h.

{
trace("PriorityQueue_STLPQ::~PriorityQueue_STLPQ");
while ( m_queue.size () ) {
delete m_queue.top ();
m_queue.pop ();
}
}
trace
#define trace(s)
trace() is used to trace function call chain in C++ program.
Definition Logger.h:429
ASSA::PriorityQueue_STLPQ::m_queue
priority_queue< T *, deque< T * >, Compare > m_queue
Definition PriorityQueue_STLPQ.h:48

References trace.

## Member Function Documentation

## dump()

template<class T , class Compare >

void ASSA::PriorityQueue_STLPQ< T, Compare >::dump | ( |  | ) |

inline

Definition at line 146 of file PriorityQueue_STLPQ.h.

{
trace("PriorityQueue_STLPQ::dump");
list<Timer*> t_list;
register Timer* t_ptr = 0;
DL((TRACE,"======TimerQueue start=======\n"));
while (m_queue.size () > 0) {
t_ptr = m_queue.top ();
t_ptr->dump ();
t_list.push_back (t_ptr);
}
DL((TRACE,"======TimerQueue end=========\n"));
list<Timer*>::iterator i;
for (i = t_list.begin (); i != t_list.end (); i++) {
m_queue.push (*i);
}
}
DL
#define DL(X)
A macro for writing debug message to the Logger.
Definition Logger.h:273
ASSA::TRACE
@ TRACE
Function call trace
Definition LogMask.h:26

References DL, trace, and ASSA::TRACE.

## insert()

template<class T , class Compare >

void ASSA::PriorityQueue_STLPQ< T, Compare >::insert | ( | const T & | t_ | ) |

inline virtual

Implements ASSA::PriorityQueue_Impl< T, Compare >.

Definition at line 66 of file PriorityQueue_STLPQ.h.

{
trace("PriorityQueue_STLPQ::insert");
m_queue.push (t_);
}

References trace.

## pop()

template<class T , class Compare >

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

inline virtual

Implements ASSA::PriorityQueue_Impl< T, Compare >.

Definition at line 75 of file PriorityQueue_STLPQ.h.

{
trace("PriorityQueue_STLPQ::pop");
T t = m_queue.top ();
m_queue.pop ();
return t;
}

References trace.

## remove()

template<class T , class Compare >

bool ASSA::PriorityQueue_STLPQ< T, Compare >::remove | ( | const int | id_ | ) |

Definition at line 105 of file PriorityQueue_STLPQ.h.

{
trace("PriorityQueue_STLPQ::remove");
list<Timer*> t_list;
register Timer* t_ptr = 0;
register int cnt = 0;
while (m_queue.size () > 0) {
t_ptr = m_queue.top ();
if (t_ptr->getHandler ()-> id() == id_) {
delete t_ptr;
cnt++;
}
else {
t_list.push_back (t_ptr);
}
m_queue.pop ();
}
// Restore queue
list<Timer*>::iterator i;
for (i = t_list.begin (); i != t_list.end (); i++) {
m_queue.push (*i);
}
return cnt;
}

References trace.

## size()

template<class T , class Compare >

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

inline virtual

Implements ASSA::PriorityQueue_Impl< T, Compare >.

Definition at line 138 of file PriorityQueue_STLPQ.h.

{
return m_queue.size ();
}

## top()

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 87 of file PriorityQueue_STLPQ.h.

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

References trace.

## Member Data Documentation

## m_queue

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.

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

- PriorityQueue_STLPQ.h