EvolvingObjects
eoOStreamMonitor.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 #include <iomanip>
00010 #include <ios>
00011 
00012 #include <utils/eoOStreamMonitor.h>
00013 #include <utils/compatibility.h>
00014 #include <utils/eoParam.h>
00015 #include <eoLogger.h>
00016 
00017 //using namespace std;
00018 
00019 eoMonitor& eoOStreamMonitor::operator()(void)
00020 {
00021     if (!out) {
00022         std::string str = "eoOStreamMonitor: Could not write to the ooutput stream";
00023       throw std::runtime_error(str);
00024     }
00025 
00026     if (firsttime) {
00027 
00028         eo::log << eo::debug << "First Generation" << std::endl;
00029 
00030         for (iterator it = vec.begin (); it != vec.end (); ++it) {
00031             out << (*it)->longName ();
00032             out << delim << std::left << std::setfill(fill) << std::setw(width);
00033         }
00034         out << std::endl;
00035 
00036         firsttime = false;
00037     } // if firstime
00038 
00039     // ok, now the real saving. write out
00040     // FIXME deprecated, remove in next release
00042     /*
00043         for (iterator it = vec.begin (); it != vec.end (); ++it) {
00044             // name: value
00045             out << (*it)->longName () << ": " << (*it)->getValue () << std::endl;
00046         } // for it in vec
00047     */
00048 
00049     for (iterator it = vec.begin (); it != vec.end (); ++it) {
00050         // value only
00051         out << (*it)->getValue ();
00052         out << delim << std::left << std::setfill(fill) << std::setw(width);
00053     } // for it in vec
00054 
00055     out << std::endl;
00056     eo::log << eo::debug << "End of Generation" << std::endl;
00057 
00058   return *this;
00059 }
 All Classes Namespaces Files Functions Variables Typedefs Friends