]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Filters/PriorityQueueAlgorithm.h
...
[FrontAlgorithms.git] / lib / fpa / Filters / PriorityQueueAlgorithm.h
1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
5 #ifndef __fpa__Filters__PriorityQueueAlgorithm__h__
6 #define __fpa__Filters__PriorityQueueAlgorithm__h__
7
8 #include <vector>
9 #include <fpa/Config.h>
10
11 namespace fpa
12 {
13   namespace Filters
14   {
15     /**
16      */
17     template< class _TDataInterface >
18     class PriorityQueueAlgorithm
19       : public _TDataInterface
20     {
21     public:
22       typedef _TDataInterface                 Superclass;
23       typedef PriorityQueueAlgorithm                  Self;
24       typedef itk::SmartPointer< Self >       Pointer;
25       typedef itk::SmartPointer< const Self > ConstPointer;
26
27       typedef typename Superclass::TTraits TTraits;
28       fpaTraitsMacro( typename TTraits );
29
30       typedef std::vector< TNode > TQueue;
31       struct TQueueOrder
32       {
33         bool operator()( const TNode& a, const TNode& b ) const
34           {
35             return( b.Value < a.Value );
36           }
37       };
38
39     public:
40       itkTypeMacro( fpa::Filters::PriorityQueueAlgorithm, TDataInterface );
41
42     protected:
43       PriorityQueueAlgorithm( bool double_buffer );
44       virtual ~PriorityQueueAlgorithm( );
45
46       virtual void _QueueSwap( );
47       virtual void _QueueClear( ) override;
48       virtual TNode _QueuePop( ) override;
49       virtual void _QueuePush( const TNode& n ) override;
50       virtual unsigned long _QueueSize( ) const override;
51
52     private:
53       PriorityQueueAlgorithm( const Self& other );
54       Self& operator=( const Self& other );
55
56     protected:
57       TQueue       m_Queues[ 2 ];
58       TQueueOrder  m_QueueOrder;
59       unsigned int m_CurrQueue;
60       bool         m_DoubleBuffer;
61     };
62
63   } // ecapseman
64
65 } // ecapseman
66
67 #ifndef ITK_MANUAL_INSTANTIATION
68 #  include <fpa/Filters/PriorityQueueAlgorithm.hxx>
69 #endif // ITK_MANUAL_INSTANTIATION
70 #endif // __fpa__Filters__PriorityQueueAlgorithm__h__
71 // eof - $RCSfile$