+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Base__Algorithm__hxx__
+#define __fpa__Base__Algorithm__hxx__
+
+// -------------------------------------------------------------------------
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
+fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::
+Algorithm( )
+ : Superclass( ),
+ _TMarksInterface( this ),
+ _TSeedsInterface( this )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
+fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::
+~Algorithm( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TFilter, class _TMarksInterface, class _TSeedsInterface >
+void fpa::Base::Algorithm< _TFilter, _TMarksInterface, _TSeedsInterface >::
+GenerateData( )
+{
+ // Init objects
+ this->_ConfigureOutput( this->m_InitValue );
+ this->_InitMarks( );
+
+ // Init queue
+ this->_QueueInit( );
+ typename TSeeds::const_iterator sIt = this->BeginSeeds( );
+ for( ; sIt != this->EndSeeds( ); ++sIt )
+ this->_QueuePush( *sIt );
+
+ // Main loop
+ while( this->_QueueSize( ) > 0 )
+ {
+ // Get next candidate
+ TNode node = this->_QueuePop( );
+ if( !( this->_IsMarked( node ) ) )
+ {
+ // Mark it
+ if( this->_Mark( node ) )
+ {
+ // Add neighborhood
+ TNeighborhood neighbors = this->_GetNeighbors( node );
+ typename TNeighborhood::const_iterator nIt = neighbors.begin( );
+ bool coll = false;
+ while( nIt != neighbors.end( ) && !coll )
+ {
+ if( this->_IsMarked( *nIt ) )
+ {
+ // Invoke stop at collisions
+ if( this->_Collisions( node, *nIt ) )
+ {
+ this->_QueueClear( );
+ coll = true;
+
+ } // fi
+ }
+ else
+ this->_QueuePush( *nIt );
+ ++nIt;
+
+ } // elihw
+
+ } // fi
+
+ } // fi
+
+ } // elihw
+}
+
+#endif // __fpa__Base__Algorithm__hxx__
+
+// eof - $RCSfile$