From 98a1441137b0ad8de71279dbdb53e172d578742e Mon Sep 17 00:00:00 2001 From: evomarc Date: Wed, 24 Jul 2002 18:08:30 +0000 Subject: [PATCH] A radical change in eoCheckPoint - though invisible from the outside: eoCheckpoint now alos contains a vector - and not only IS A eoContinue. So you can ADD another eoContinue to an eoCheckpoint... --- eo/src/utils/eoCheckPoint.h | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/eo/src/utils/eoCheckPoint.h b/eo/src/utils/eoCheckPoint.h index 4e74fe2f..1117d706 100644 --- a/eo/src/utils/eoCheckPoint.h +++ b/eo/src/utils/eoCheckPoint.h @@ -33,22 +33,28 @@ #include /** eoCheckPoint is a container class. - It contains an eoContinue, and vertors of (pointers to) + It contains vectors of (pointers to) + eoContinue (modif. MS July 16. 2002) eoStats, eoUpdater and eoMonitor it is an eoContinue, so its operator() will be called every generation - - and will return the contained-eoContinue result + and will return the contained-combined-eoContinue result but before that it will call in turn every single - {statistics, updaters, monitors} that it has been given. + {statistics, updaters, monitors} that it has been given, + and after that, if stopping, all lastCall methods of the above. */ template class eoCheckPoint : public eoContinue { public : - eoCheckPoint(eoContinue& _cont) : cont(_cont) {} + eoCheckPoint(eoContinue& _cont) + { + continuators.push_back(&_cont); + } bool operator()(const eoPop& _pop); + void add(eoContinue& _cont) { continuators.push_back(&_cont); } void add(eoSortedStatBase& _stat) { sorted.push_back(&_stat); } void add(eoStatBase& _stat) { stats.push_back(&_stat); } void add(eoMonitor& _mon) { monitors.push_back(&_mon); } @@ -58,7 +64,7 @@ public : private : - eoContinue& cont; + std::vector*> continuators; std::vector*> sorted; std::vector*> stats; std::vector monitors; @@ -90,7 +96,10 @@ bool eoCheckPoint::operator()(const eoPop& _pop) for (i = 0; i < monitors.size(); ++i) (*monitors[i])(); - bool bContinue = cont(_pop); + bool bContinue = true; + for (unsigned i = 0; i < continuators.size(); ++i) + if ( !(*continuators[i])(_pop) ) + bContinue = false; if (! bContinue) // we're going to stop: lastCall, gentlemen {