Made eoGencontinue a ValueParam<unsigned>, so that it can be attached to a monitor

This commit is contained in:
maartenkeijzer 2005-10-15 09:05:57 +00:00
commit f128fcd86f

View file

@ -26,24 +26,26 @@
#define _eoGenContinue_h #define _eoGenContinue_h
#include <eoContinue.h> #include <eoContinue.h>
#include <utils/eoParam.h>
/** /**
Generational continuator: continues until a number of generations is reached Generational continuator: continues until a number of generations is reached
*/ */
template< class EOT> template< class EOT>
class eoGenContinue: public eoContinue<EOT> class eoGenContinue: public eoContinue<EOT>, public eoValueParam<unsigned>
{ {
public: public:
/// Ctor for setting a /// Ctor for setting a
eoGenContinue( unsigned long _totalGens) eoGenContinue( unsigned long _totalGens)
: repTotalGenerations( _totalGens ), : eoValueParam<unsigned>(0, "Generations", "Generations"),
repTotalGenerations( _totalGens ),
thisGenerationPlaceHolder(0), thisGenerationPlaceHolder(0),
thisGeneration(thisGenerationPlaceHolder), verbose(true) {}; thisGeneration(thisGenerationPlaceHolder), verbose(true) {};
/// Ctor for enabling the save/load the no. of generations counted /// Ctor for enabling the save/load the no. of generations counted
eoGenContinue( unsigned long _totalGens, unsigned long& _currentGen) eoGenContinue( unsigned long _totalGens, unsigned long& _currentGen)
: repTotalGenerations( _totalGens ), : eoValueParam<unsigned>(0, "Generations", "Generations"),
repTotalGenerations( _totalGens ),
thisGenerationPlaceHolder(0), thisGenerationPlaceHolder(0),
thisGeneration(_currentGen), verbose(true){}; thisGeneration(_currentGen), verbose(true){};
@ -51,6 +53,7 @@ public:
* reached */ * reached */
virtual bool operator() ( const eoPop<EOT>& _vEO ) { virtual bool operator() ( const eoPop<EOT>& _vEO ) {
thisGeneration++; thisGeneration++;
value() = thisGeneration;
// std::cout << " [" << thisGeneration << "] "; // std::cout << " [" << thisGeneration << "] ";
if (thisGeneration >= repTotalGenerations) if (thisGeneration >= repTotalGenerations)
{ {