added eoFuncPtrStat, and appended various addTo member functions for more elegant definition of monitors, stats, checkpoints, etc

This commit is contained in:
maartenkeijzer 2007-09-05 11:36:44 +00:00
commit cb85c19259
6 changed files with 58 additions and 3 deletions

View file

@ -33,6 +33,8 @@
#include <utils/eoParam.h>
#include <eoPop.h>
#include <eoParetoFitness.h>
#include <utils/eoMonitor.h>
#include <utils/eoCheckPoint.h>
/**
Base class for all statistics that need to be calculated
@ -49,6 +51,9 @@ public:
virtual std::string className(void) const { return "eoStatBase"; }
};
template <class EOT> class eoCheckPoint;
/**
The actual class that will be used as base for all statistics
that need to be calculated over the (unsorted) population
@ -65,6 +70,10 @@ public:
virtual std::string className(void) const
{ return "eoStat"; }
eoStat<EOT, T>& addTo(eoCheckPoint<EOT>& cp) { cp.add(*this); return *this; }
eoStat<EOT, T>& addTo(eoMonitor& mon) { mon.add(*this); return *this; }
};
@ -78,6 +87,7 @@ class eoSortedStatBase : public eoUF<const std::vector<const EOT*>&, void>
public:
virtual void lastCall(const std::vector<const EOT*>&) {}
virtual std::string className(void) const { return "eoSortedStatBase"; }
};
/**
@ -91,6 +101,9 @@ class eoSortedStat : public eoSortedStatBase<EOT>, public eoValueParam<ParamType
public :
eoSortedStat(ParamType _value, std::string _desc) : eoValueParam<ParamType>(_value, _desc) {}
virtual std::string className(void) const { return "eoSortedStat"; }
eoSortedStat<EOT, ParamType>& addTo(eoCheckPoint<EOT>& cp) { cp.add(*this); return *this; }
eoSortedStat<EOT, ParamType>& addTo(eoMonitor& mon) { mon.add(*this); return *this; }
};
/**