1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
6 #ifndef __fpa__Base__Algorithm__hxx__
7 #define __fpa__Base__Algorithm__hxx__
9 // -------------------------------------------------------------------------
10 template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
11 fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::
14 _TMarksInterface( this ),
15 _TSeedsInterface( this )
19 // -------------------------------------------------------------------------
20 template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
21 fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::
26 // -------------------------------------------------------------------------
27 template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
28 void fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::
32 this->_ConfigureOutput( this->m_InitValue );
33 this->_InitMarks( this->GetNumberOfSeeds( ) );
37 typename TSeeds::const_iterator sIt = this->BeginSeeds( );
38 for( ; sIt != this->EndSeeds( ); ++sIt )
39 this->_QueuePush( *sIt );
42 while( this->_QueueSize( ) > 0 )
45 TNode node = this->_QueuePop( );
46 if( !( this->_IsMarked( node ) ) )
49 if( this->_Mark( node ) )
52 TNeighborhood neighbors = this->_GetNeighbors( node );
53 typename TNeighborhood::const_iterator nIt = neighbors.begin( );
55 while( nIt != neighbors.end( ) && !coll )
57 if( this->_IsMarked( *nIt ) )
59 // Invoke stop at collisions
60 if( this->_Collisions( node, *nIt ) )
68 this->_QueuePush( *nIt );
80 #endif // __fpa__Base__Algorithm__hxx__