GNGControl.hpp

Go to the documentation of this file.
00001 #ifndef __GNGCONTROL_H
00002 #define __GNGCONTROL_H
00003 
00004 #include <Control.hpp>
00005 #include <Generators/IInputGenerator.hpp>
00006 #include "GNGAlgorithm.hpp"
00007 
00015 class GNGControl : public Control
00016 {
00017 public:
00022     GNGControl(GNGAlgorithm * alg, IInputGenerator * g) : m_alg(alg), m_generator(g) 
00023     {
00024         m_iteration = 0;
00025     }
00026     
00027     virtual ~GNGControl() 
00028     { 
00029         delete m_generator; 
00030         delete m_alg; 
00031     }
00032     
00037     virtual bool Iterate()
00038     {
00039         if(IsStopCriteriaMet())
00040             return false;       
00041         
00042         if(IsReadyToIterate())
00043         {
00044             m_iteration++;
00045             m_alg->Iterate( m_generator->GetInput() );
00046             return true;
00047         }
00048         return false;
00049     }
00050 
00051 protected:
00052     // never stop.
00053     virtual bool IsStopCriteriaMet()
00054     {
00055         return false;
00056     }
00057     
00058 protected:
00059     GNGAlgorithm *     m_alg;
00060     IInputGenerator *  m_generator;
00061 };
00062 
00063 
00064 #endif

Generated on Mon Mar 22 16:40:47 2004 for GNG_GL by doxygen 1.3.6