* eoTimedMonitor.h (eoTimedMonitor::seconds): Make unsigned.

* eoRNG.cpp, eoRNG.h (K, M, N): Declare static and initialize in cpp.

* t-eoGenOp.cpp (init): Do not add std::ends to end of string, as this
results in escape-codes (^@) to be printed at runtime and is not
necessary anyway.

* test/t-eoSymreg.cpp (SymregNode::operator()): Initialize r1 and r2 to
avoid compiler warnings.
This commit is contained in:
kuepper 2006-12-02 10:18:57 +00:00
commit 7baf7cb799
6 changed files with 114 additions and 84 deletions

View file

@ -1,5 +1,7 @@
2006-12-02 Jochen Küpper <jochen@fhi-berlin.mpg.de>
* eoTimedMonitor.h (eoTimedMonitor::seconds): Make unsigned.
* eoRNG.h: Cleanup docs and document /all/ members.
* eoRNG.cpp, eoRNG.h (K, M, N): Declare static and initialize in cpp.

View file

@ -6,13 +6,13 @@
#include <ctime>
#include "eoRNG.h"
// initialize static constants
const uint32_t eoRng::K(0x9908B0DFU);
const int eoRng::M(397);
const int eoRng::N(624);
namespace eo
{
// initialize static constants
const uint32_t eoRng::K(0x9908B0DFU);
const int eoRng::M(397);
const int eoRng::N(624);
// global random number generator object
eoRng rng(static_cast<uint32_t>(time(0)));
}

View file

@ -27,11 +27,11 @@
#ifndef _eoTimedMonitor_h
#define _eoTimedMonitor_h
#include <ctime>
#include <string>
#include <utils/eoMonitor.h>
#include <eoObject.h>
#include <time.h>
/**
Holds a collection of monitors and only fires them when a time limit
@ -39,8 +39,14 @@
*/
class eoTimedMonitor : public eoMonitor
{
public :
eoTimedMonitor(int seconds_) : last_tick(0), seconds(seconds_) {}
public:
/** Constructor
No negative time can be specified, use 0 if you want it to fire "always".
@param seconds_ Specify time limit (s).
*/
eoTimedMonitor(unsigned seconds_) : last_tick(0), seconds(seconds_) {}
eoMonitor& operator()(void) {
bool monitor = false;
@ -67,10 +73,14 @@ public :
void add(eoMonitor& mon) { monitors.push_back(&mon); }
virtual std::string className(void) const { return "eoTimedMonitor"; }
private :
clock_t last_tick;
int seconds;
std::vector<eoMonitor*> monitors;
private:
clock_t last_tick;
unsigned seconds;
std::vector<eoMonitor*> monitors;
};
#endif