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