This repository has been archived on 2026-03-28. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
eodev/eo/src/utils/eoStdoutMonitor.cpp
evomarc 08e6be4b66 Added a verbose mode (the default behavior) which is as before.
But when in non-verbose mode, prints only one line per generation.
2000-11-24 17:36:03 +00:00

50 lines
1 KiB
C++

#include <iostream>
#include <fstream>
#include <stdexcept>
#include <utils/eoStdoutMonitor.h>
#include <utils/compatibility.h>
#include <utils/eoParam.h>
using namespace std;
eoMonitor& eoStdoutMonitor::operator()(void)
{
if (!cout)
{
string str = "eoStdoutMonitor: Could not write to cout";
throw runtime_error(str);
}
if (firsttime)
{
if (verbose)
cout << "First Generation" << endl;
else
{
for(iterator it = vec.begin(); it != vec.end(); ++it)
{
cout << (*it)->longName() << delim;
}
cout << endl;
}
firsttime = false;
}
// ok, now the real saving. write out
if (verbose)
{
for(iterator it = vec.begin(); it != vec.end(); ++it)
{
cout << (*it)->longName() << ": " << (*it)->getValue() << '\n';
}
cout << "\n****** End of Generation ******\n" << endl;
}
else // a one-liner
{
for(iterator it = vec.begin(); it != vec.end(); ++it)
{
cout << (*it)->getValue() << delim;
}
cout << endl;
}
return *this;
}