X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FFilters%2FPriorityQueueAlgorithm.h;fp=lib%2Ffpa%2FFilters%2FPriorityQueueAlgorithm.h;h=780e4d22e5671ff380c115993e782bf8493f954b;hb=bd89a1af0c14ed2ac0afeca923103de54283cbaf;hp=0000000000000000000000000000000000000000;hpb=a8ac405fe1422bc0792a810f7f0693096a22c20e;p=FrontAlgorithms.git diff --git a/lib/fpa/Filters/PriorityQueueAlgorithm.h b/lib/fpa/Filters/PriorityQueueAlgorithm.h new file mode 100644 index 0000000..780e4d2 --- /dev/null +++ b/lib/fpa/Filters/PriorityQueueAlgorithm.h @@ -0,0 +1,71 @@ +// ========================================================================= +// @author Leonardo Florez Valencia +// @email florez-l@javeriana.edu.co +// ========================================================================= +#ifndef __fpa__Filters__PriorityQueueAlgorithm__h__ +#define __fpa__Filters__PriorityQueueAlgorithm__h__ + +#include +#include + +namespace fpa +{ + namespace Filters + { + /** + */ + template< class _TDataInterface > + class PriorityQueueAlgorithm + : public _TDataInterface + { + public: + typedef _TDataInterface Superclass; + typedef PriorityQueueAlgorithm Self; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + typedef typename Superclass::TTraits TTraits; + fpaTraitsMacro( typename TTraits ); + + typedef std::vector< TNode > TQueue; + struct TQueueOrder + { + bool operator()( const TNode& a, const TNode& b ) const + { + return( b.Value < a.Value ); + } + }; + + public: + itkTypeMacro( fpa::Filters::PriorityQueueAlgorithm, TDataInterface ); + + protected: + PriorityQueueAlgorithm( bool double_buffer ); + virtual ~PriorityQueueAlgorithm( ); + + virtual void _QueueSwap( ); + virtual void _QueueClear( ) override; + virtual TNode _QueuePop( ) override; + virtual void _QueuePush( const TNode& n ) override; + virtual unsigned long _QueueSize( ) const override; + + private: + PriorityQueueAlgorithm( const Self& other ); + Self& operator=( const Self& other ); + + protected: + TQueue m_Queues[ 2 ]; + TQueueOrder m_QueueOrder; + unsigned int m_CurrQueue; + bool m_DoubleBuffer; + }; + + } // ecapseman + +} // ecapseman + +#ifndef ITK_MANUAL_INSTANTIATION +# include +#endif // ITK_MANUAL_INSTANTIATION +#endif // __fpa__Filters__PriorityQueueAlgorithm__h__ +// eof - $RCSfile$