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,7 +47,9 @@ eoMonitor& eoOStreamMonitor::operator()(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (iterator it = vec.begin (); it != vec.end (); ++it) {
|
for (iterator it = vec.begin (); it != vec.end (); ++it) {
|
||||||
// value only
|
if( print_names ) {
|
||||||
|
out << (*it)->longName() << name_sep;
|
||||||
|
}
|
||||||
out << (*it)->getValue();
|
out << (*it)->getValue();
|
||||||
out << delim << std::left << std::setfill(fill) << std::setw(width);
|
out << delim << std::left << std::setfill(fill) << std::setw(width);
|
||||||
} // for it in vec
|
} // for it in vec
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,15 @@ public :
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
eoOStreamMonitor( std::ostream & _out, std::string _delim = "\t", unsigned int _width=20, char _fill=' ' ) :
|
eoOStreamMonitor(
|
||||||
out(_out), delim(_delim), width(_width), fill(_fill), firsttime(true)
|
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);
|
eoMonitor& operator()(void);
|
||||||
|
|
@ -70,6 +77,8 @@ private :
|
||||||
unsigned int width;
|
unsigned int width;
|
||||||
char fill;
|
char fill;
|
||||||
bool firsttime;
|
bool firsttime;
|
||||||
|
bool print_names;
|
||||||
|
std::string name_sep;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _eoOStreamMonitor_h_
|
#endif // _eoOStreamMonitor_h_
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue