eoStdoutMonitor.cpp

00001 #ifdef _MSC_VER
00002 // to avoid long name warnings
00003 #pragma warning(disable:4786)
00004 #endif 
00005 
00006 #include <iostream>
00007 #include <fstream>
00008 #include <stdexcept>
00009 
00010 #include <utils/eoStdoutMonitor.h>
00011 #include <utils/compatibility.h>
00012 #include <utils/eoParam.h>
00013 
00014 using namespace std;
00015 
00016 eoMonitor& eoStdoutMonitor::operator()(void)
00017 {
00018     if (!cout)
00019     {
00020         string str = "eoStdoutMonitor: Could not write to cout";
00021         throw runtime_error(str);
00022     }
00023     if (firsttime)
00024     {
00025       if (verbose)
00026         cout << "First Generation" << endl;
00027       else
00028         {
00029           for(iterator it = vec.begin(); it != vec.end(); ++it)
00030             {
00031               cout << (*it)->longName() << delim;
00032             }
00033           cout << endl;
00034         }
00035         firsttime = false;
00036     }
00037     // ok, now the real saving. write out
00038     if (verbose)
00039       {
00040       for(iterator it = vec.begin(); it != vec.end(); ++it)
00041         {
00042           cout << (*it)->longName() << ": " << (*it)->getValue() << '\n';
00043         }
00044       cout << "\n****** End of Generation ******\n" << endl;
00045       }
00046     else                        // a one-liner
00047       {
00048         for(iterator it = vec.begin(); it != vec.end(); ++it)
00049           {
00050             cout << (*it)->getValue() << delim;
00051           }
00052         cout << endl;
00053       }
00054     return *this;
00055 }

Generated on Thu Apr 19 11:02:28 2007 for EO by  doxygen 1.4.7