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:
parent
47c4f58eb8
commit
4a90420dd3
5 changed files with 98 additions and 33 deletions
62
eo/src/utils/eoOStreamMonitor.h
Normal file
62
eo/src/utils/eoOStreamMonitor.h
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
|
||||
/*
|
||||
|
||||
(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; version 2 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public 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: http://eodev.sourceforge.net
|
||||
|
||||
Authors:
|
||||
todos@geneura.ugr.es
|
||||
Marc.Schoenauer@polytechnique.fr
|
||||
mkeijzer@dhi.dk
|
||||
Johann Dréo <johann.dreo@thalesgroup.com>
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _eoOStreamMonitor_h_
|
||||
#define _eoOStreamMonitor_h_
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include <utils/eoMonitor.h>
|
||||
#include <eoObject.h>
|
||||
|
||||
/**
|
||||
Prints statistics to stdout
|
||||
*/
|
||||
class eoOStreamMonitor : public eoMonitor
|
||||
{
|
||||
public :
|
||||
eoOStreamMonitor( std::ostream & _out, bool _verbose=true, std::string _delim = "\t", unsigned int _width=20, char _fill=' ' ) :
|
||||
out(_out), verbose(_verbose), delim(_delim), width(_width), fill(_fill), firsttime(true) {}
|
||||
|
||||
eoMonitor& operator()(void);
|
||||
|
||||
virtual std::string className(void) const { return "eoOStreamMonitor"; }
|
||||
|
||||
private :
|
||||
std::ostream & out;
|
||||
bool verbose;
|
||||
std::string delim;
|
||||
unsigned int width;
|
||||
char fill;
|
||||
bool firsttime;
|
||||
};
|
||||
|
||||
#endif // _eoOStreamMonitor_h_
|
||||
|
||||
Reference in a new issue