create a more generic class for monitoring to any ostream (useful for output to clog or cerr, for example), the stdout monitor now inherits from it

This commit is contained in:
Johann Dreo 2010-10-26 10:51:48 +02:00
commit 4a90420dd3
5 changed files with 98 additions and 33 deletions

View file

@ -1,9 +1,8 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// eoStdoutMonitor.h
// (c) Marc Schoenauer, Maarten Keijzer and GeNeura Team, 2000
/*
(c) Marc Schoenauer, Maarten Keijzer and GeNeura Team, 2000
(c) Thales group, 2010
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
@ -18,35 +17,34 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr
mkeijzer@dhi.dk
*/
//-----------------------------------------------------------------------------
Contact: http://eodev.sourceforge.net
Authors:
todos@geneura.ugr.es
Marc.Schoenauer@polytechnique.fr
mkeijzer@dhi.dk
Johann Dréo <johann.dreo@thalesgroup.com>
*/
#ifndef _eoStdoutMonitor_h
#define _eoStdoutMonitor_h
#include <string>
#include <utils/eoMonitor.h>
#include <utils/eoOStreamMonitor.h>
#include <eoObject.h>
/**
Prints statistics to stdout
*/
class eoStdoutMonitor : public eoMonitor
class eoStdoutMonitor : public eoOStreamMonitor
{
public :
eoStdoutMonitor(bool _verbose=true, std::string _delim = "\t") :
verbose(_verbose), delim(_delim), firsttime(true) {}
eoMonitor& operator()(void);
eoStdoutMonitor(bool _verbose=true, std::string _delim = "\t", unsigned int _width=20, char _fill=' ' ) :
eoOStreamMonitor( std::cout, _verbose, _delim, _width, _fill) {}
virtual std::string className(void) const { return "eoStdoutMonitor"; }
private :
bool verbose;
std::string delim;
bool firsttime;
virtual std::string className(void) const { return "eoStdoutMonitor"; }
};
#endif