paradiseo/eo/src/utils/eoUpdater.cpp
Ronaldd Pinho aa5dbe82c6 Use relative includes in headers and absolute in code
- relative includes in headers
- absolute includes in exe code
- include sstream lib in eoExceptions.h
- fix ga/make_op_ga.cpp
- fix eoSGATransform.h
2019-12-06 15:15:22 +01:00

46 lines
797 B
C++

#ifdef _MSC_VER
#pragma warning(disable:4786)
#endif
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <sstream>
#include "eoState.h"
#include "eoUpdater.h"
using namespace std;
void eoTimedStateSaver::operator()(void)
{
time_t now = time(0);
if (now >= last_time + interval)
{
last_time = now;
ostringstream os;
os << prefix << (now - first_time) << '.' << extension;
state.save(os.str());
}
}
void eoCountedStateSaver::doItNow(void)
{
ostringstream os;
os << prefix << counter << '.' << extension;
state.save(os.str());
}
void eoCountedStateSaver::operator()(void)
{
if (++counter % interval == 0)
doItNow();
}
void eoCountedStateSaver::lastCall(void)
{
if (saveOnLastCall)
doItNow();
}