]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Base/PriorityQueueAlgorithm.hxx
11c1408e44101490508f331c7a996cc0661ad985
[FrontAlgorithms.git] / lib / fpa / Base / PriorityQueueAlgorithm.hxx
1 #ifndef __fpa__Base__PriorityQueueAlgorithm__hxx__
2 #define __fpa__Base__PriorityQueueAlgorithm__hxx__
3
4 // -------------------------------------------------------------------------
5 template< class _TSuperclass >
6 fpa::Base::PriorityQueueAlgorithm< _TSuperclass >::
7 PriorityQueueAlgorithm( )
8   : Superclass( )
9 {
10 }
11
12 // -------------------------------------------------------------------------
13 template< class _TSuperclass >
14 fpa::Base::PriorityQueueAlgorithm< _TSuperclass >::
15 ~PriorityQueueAlgorithm( )
16 {
17 }
18
19 // -------------------------------------------------------------------------
20 template< class _TSuperclass >
21 unsigned long fpa::Base::PriorityQueueAlgorithm< _TSuperclass >::
22 _QueueSize( ) const
23 {
24   return( this->m_Queue.size( ) );
25 }
26
27 // -------------------------------------------------------------------------
28 template< class _TSuperclass >
29 void fpa::Base::PriorityQueueAlgorithm< _TSuperclass >::
30 _QueueClear( )
31 {
32   this->m_Queue.clear( );
33 }
34
35 // -------------------------------------------------------------------------
36 template< class _TSuperclass >
37 void fpa::Base::PriorityQueueAlgorithm< _TSuperclass >::
38 _QueuePush( const _TQueueNode& node )
39 {
40   static _TQueueNodeCompare cmp;
41   this->m_Queue.push_back( node );
42   std::push_heap( this->m_Queue.begin( ), this->m_Queue.end( ), cmp );
43 }
44
45 // -------------------------------------------------------------------------
46 template< class _TSuperclass >
47 typename fpa::Base::PriorityQueueAlgorithm< _TSuperclass >::
48 _TQueueNode fpa::Base::PriorityQueueAlgorithm< _TSuperclass >::
49 _QueuePop( )
50 {
51   static _TQueueNodeCompare cmp;
52   std::pop_heap( this->m_Queue.begin( ), this->m_Queue.end( ), cmp );
53   _TQueueNode f = this->m_Queue.back( );
54   this->m_Queue.pop_back( );
55   return( f );
56 }
57
58 #endif // __fpa__Base__PriorityQueueAlgorithm__hxx__
59
60 // eof - $RCSfile$