Add an option to print names in front of values in stream monitor
This commit is contained in:
parent
6fa57622be
commit
966a5670cb
2 changed files with 15 additions and 4 deletions
|
|
@ -47,8 +47,10 @@ eoMonitor& eoOStreamMonitor::operator()(void)
|
|||
*/
|
||||
|
||||
for (iterator it = vec.begin (); it != vec.end (); ++it) {
|
||||
// value only
|
||||
out << (*it)->getValue ();
|
||||
if( print_names ) {
|
||||
out << (*it)->longName() << name_sep;
|
||||
}
|
||||
out << (*it)->getValue();
|
||||
out << delim << std::left << std::setfill(fill) << std::setw(width);
|
||||
} // for it in vec
|
||||
|
||||
|
|
|
|||
|
|
@ -56,8 +56,15 @@ public :
|
|||
}
|
||||
*/
|
||||
|
||||
eoOStreamMonitor( std::ostream & _out, std::string _delim = "\t", unsigned int _width=20, char _fill=' ' ) :
|
||||
out(_out), delim(_delim), width(_width), fill(_fill), firsttime(true)
|
||||
eoOStreamMonitor(
|
||||
std::ostream & _out,
|
||||
std::string _delim = "\t", unsigned int _width=20, char _fill=' ',
|
||||
bool _print_names = false, std::string _name_sep = ":"
|
||||
) :
|
||||
out(_out),
|
||||
delim(_delim), width(_width), fill(_fill),
|
||||
firsttime(true),
|
||||
print_names(_print_names), name_sep(_name_sep)
|
||||
{}
|
||||
|
||||
eoMonitor& operator()(void);
|
||||
|
|
@ -70,6 +77,8 @@ private :
|
|||
unsigned int width;
|
||||
char fill;
|
||||
bool firsttime;
|
||||
bool print_names;
|
||||
std::string name_sep;
|
||||
};
|
||||
|
||||
#endif // _eoOStreamMonitor_h_
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue