]> Creatis software - FrontAlgorithms.git/blob - libs/fpa/Base/PriorityQueueAlgorithm.h
...
[FrontAlgorithms.git] / libs / fpa / Base / PriorityQueueAlgorithm.h
1 #ifndef __fpa__Base__PriorityQueueAlgorithm__h__
2 #define __fpa__Base__PriorityQueueAlgorithm__h__
3
4 #include <queue>
5
6 namespace fpa
7 {
8   namespace Base
9   {
10     /**
11      */
12     template< class _TSuperclass >
13     class PriorityQueueAlgorithm
14       : public _TSuperclass
15     {
16     public:
17       typedef PriorityQueueAlgorithm          Self;
18       typedef _TSuperclass                    Superclass;
19       typedef itk::SmartPointer< Self >       Pointer;
20       typedef itk::SmartPointer< const Self > ConstPointer;
21
22     protected:
23       typedef typename Superclass::_TQueueNode _TQueueNode;
24       struct _TQueueNodeCompare
25       {
26         bool operator( )( const _TQueueNode& a, const _TQueueNode& b )
27           {
28             return( b.Result < a.Result );
29           }
30       };
31       typedef std::vector< _TQueueNode > _TQueue;
32
33     public:
34       itkTypeMacro( PriorityQueueAlgorithm, Algorithm );
35
36     protected:
37       PriorityQueueAlgorithm( );
38       virtual ~PriorityQueueAlgorithm( );
39
40       virtual unsigned long _QueueSize( ) const override;
41       virtual void _QueueClear( ) override;
42       virtual void _QueuePush( const _TQueueNode& node ) override;
43       virtual _TQueueNode _QueuePop( ) override;
44
45     private:
46       // Purposely not defined
47       PriorityQueueAlgorithm( const Self& other );
48       Self& operator=( const Self& other );
49
50     protected:
51       _TQueue m_Queue;
52     };
53
54   } // ecapseman
55
56 } // ecapseman
57
58 #ifndef ITK_MANUAL_INSTANTIATION
59 #  include <fpa/Base/PriorityQueueAlgorithm.hxx>
60 #endif // ITK_MANUAL_INSTANTIATION
61
62 #endif // __fpa__Base__PriorityQueueAlgorithm__h__
63
64 // eof - $RCSfile$