Migration from SVN
This commit is contained in:
parent
d7d6c3a217
commit
8cd56f37db
29069 changed files with 0 additions and 4096888 deletions
46
eo/src/utils/eoUpdater.cpp
Normal file
46
eo/src/utils/eoUpdater.cpp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4786)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include <utils/eoState.h>
|
||||
#include <utils/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();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue