The Gaudi Framework  v41r0 (bdbe7744)
Loading...
Searching...
No Matches
Gaudi::Utils::Histos::Table Class Reference

Simple class for the customizeble printout of the histogram tables. More...

#include <GaudiUtils/HistoTableFormat.h>

Collaboration diagram for Gaudi::Utils::Histos::Table:

Public Member Functions

 Table (const int ID=0)
 constructor from enum
 Table (const std::string &format, const std::string &header="", const std::string &footer="")
 Constructor from the format, header and footer.
template<class HISTO, class STREAM, class TERMINATOR>
STREAM & printList (HISTO first, HISTO last, STREAM &stream, TERMINATOR term) const
 print the simple sequence of histograms as table
template<class HISTO, class STREAM, class TERMINATOR>
STREAM & printMap (HISTO first, HISTO last, const std::string &fmt, const std::string &hval, STREAM &stream, TERMINATOR term) const
 print as table the content of the accociative map (key->histogram) with the key, convertible to std::string
const std::string & header () const
 the table header
const std::string & footer () const
 the table footer
const std::string & format () const
 the format
void setHeader (std::string v)
 set new header
void setFooter (std::string v)
 set new footer
void setFormat (std::string v)
 set new format
std::string toString (const AIDA::IHistogram1D *histo) const
 make the string representation according to the default format
std::string toString (const AIDA::IProfile1D *histo) const
 make the string representation according to the default format
std::string toString (const AIDA::IHistogram1D *histo, const std::string &ID, const std::string &fmt) const
 format a full row in table, including ID, label, path or any other "extra" identifier
std::string toString (const AIDA::IProfile1D *histo, const std::string &ID, const std::string &fmt) const
 format a full row in table, including ID, label, path or any other "extra" identifier

Public Attributes

std::string m_header
 the table header
std::string m_footer
 the table footer
std::string m_format
 the defautl format

Detailed Description

Simple class for the customizeble printout of the histogram tables.

Author
Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u
Date
2007-08-07

Definition at line 436 of file HistoTableFormat.h.

Constructor & Destructor Documentation

◆ Table() [1/2]

Gaudi::Utils::Histos::Table::Table ( const int ID = 0)

constructor from enum

Definition at line 371 of file HistoTableFormat.cpp.

373 , m_footer()
std::string m_footer
the table footer
std::string m_format
the defautl format
std::string m_header
the table header
GAUDI_API std::string format(const int ID=Default)
get the format by enum
GAUDI_API std::string header(const int ID=Default)
get the recommended header by enum

◆ Table() [2/2]

Gaudi::Utils::Histos::Table::Table ( const std::string & format,
const std::string & header = "",
const std::string & footer = "" )

Constructor from the format, header and footer.

Definition at line 376 of file HistoTableFormat.cpp.

const std::string & format() const
the format
const std::string & footer() const
the table footer
const std::string & header() const
the table header

Member Function Documentation

◆ footer()

const std::string & Gaudi::Utils::Histos::Table::footer ( ) const
inline

the table footer

Definition at line 487 of file HistoTableFormat.h.

487{ return m_footer; }

◆ format()

const std::string & Gaudi::Utils::Histos::Table::format ( ) const
inline

the format

Definition at line 490 of file HistoTableFormat.h.

490{ return m_format; }

◆ header()

const std::string & Gaudi::Utils::Histos::Table::header ( ) const
inline

the table header

Definition at line 484 of file HistoTableFormat.h.

484{ return m_header; }

◆ printList()

template<class HISTO, class STREAM, class TERMINATOR>
STREAM & Gaudi::Utils::Histos::Table::printList ( HISTO first,
HISTO last,
STREAM & stream,
TERMINATOR term ) const
inline

print the simple sequence of histograms as table

Parameters
firstbegin-iterator for the sequence
lastend-iterator for the sequence
streamthe stream to be used for printout
termthe terminmator for the stream

Definition at line 452 of file HistoTableFormat.h.

452 {
453 if ( !header().empty() ) { stream << header() << term; }
454 Gaudi::Utils::Histos::printList( first, last, format(), stream, term );
455 if ( !footer().empty() ) { stream << footer() << term; }
456 return stream;
457 }
STREAM & printList(HISTO first, HISTO last, const std::string &fmt, STREAM &stream, TERMINATOR term)
print the simple sequence (list-like) of histograms as table
stream
Definition Write.py:32

◆ printMap()

template<class HISTO, class STREAM, class TERMINATOR>
STREAM & Gaudi::Utils::Histos::Table::printMap ( HISTO first,
HISTO last,
const std::string & fmt,
const std::string & hval,
STREAM & stream,
TERMINATOR term ) const
inline

print as table the content of the accociative map (key->histogram) with the key, convertible to std::string

The default format is used for histogram prinout

Parameters
first'begin'-iterator for the mapping sequence
last'end'-iterator for the mapping sequence
fmt'short' format for the table printout
hvalthe name of the "key"-column
streamthe stream for printout
termstream terminator

Definition at line 473 of file HistoTableFormat.h.

474 {
475 if ( !hval.empty() || !header().empty() ) {
476 stream << Gaudi::Utils::Histos::format( hval, header(), fmt ) << term;
477 }
478 return Gaudi::Utils::Histos::printMap( first, last, fmt, format(), stream, term );
479 }
GAUDI_API std::string format(const AIDA::IHistogram1D *histo, const std::string &fmt)
Make the string representation of the histogram according to the specified format.
STREAM & printMap(HISTO begin, HISTO end, const std::string &fmt1, const std::string &fmt2, STREAM &stream, TERMINATOR term)
Print the "associative sequence" (e.g.

◆ setFooter()

void Gaudi::Utils::Histos::Table::setFooter ( std::string v)
inline

set new footer

Definition at line 498 of file HistoTableFormat.h.

498{ m_footer = std::move( v ); }

◆ setFormat()

void Gaudi::Utils::Histos::Table::setFormat ( std::string v)
inline

set new format

Definition at line 501 of file HistoTableFormat.h.

501{ m_format = std::move( v ); }

◆ setHeader()

void Gaudi::Utils::Histos::Table::setHeader ( std::string v)
inline

set new header

Definition at line 495 of file HistoTableFormat.h.

495{ m_header = std::move( v ); }

◆ toString() [1/4]

std::string Gaudi::Utils::Histos::Table::toString ( const AIDA::IHistogram1D * histo) const

make the string representation according to the default format

Definition at line 381 of file HistoTableFormat.cpp.

381 {
382 return Gaudi::Utils::Histos::format( histo, format() );
383}

◆ toString() [2/4]

std::string Gaudi::Utils::Histos::Table::toString ( const AIDA::IHistogram1D * histo,
const std::string & ID,
const std::string & fmt ) const

format a full row in table, including ID, label, path or any other "extra" identifier

using namespace Gaudi::Utils::Histos ;
const Table& table = ... ;
const AIDA::IHistogram1D* histo = ... ;
// define short format
const std::string fmt1 = " |%1$-30.30s %|33t| %2" ;
info () << table.toString ( "My Histo" , histo , fmt ) ;
std::string toString(const AIDA::IHistogram1D *histo) const
make the string representation according to the default format
Table(const int ID=0)
constructor from enum
Collection of useful utilities for manipulations with AIDA hisgograms.
Definition HistoDump.h:27
Parameters
histopointer to the histogram
IDhistorgam ID, title, label or other extra infomration
fmt"short" format used for the table
Returns
formatted row

Definition at line 389 of file HistoTableFormat.cpp.

390 {
391 return Gaudi::Utils::Histos::format( histo, ID, fmt, format() );
392}

◆ toString() [3/4]

std::string Gaudi::Utils::Histos::Table::toString ( const AIDA::IProfile1D * histo) const

make the string representation according to the default format

Definition at line 398 of file HistoTableFormat.cpp.

398 {
399 return Gaudi::Utils::Histos::format( histo, format() );
400}

◆ toString() [4/4]

std::string Gaudi::Utils::Histos::Table::toString ( const AIDA::IProfile1D * histo,
const std::string & ID,
const std::string & fmt ) const

format a full row in table, including ID, label, path or any other "extra" identifier

using namespace Gaudi::Utils::Histos ;
const Table& table = ... ;
const AIDA::IProfile1D* histo = ... ;
// define short format
const std::string fmt1 = " |%1$-30.30s %|33t| %2" ;
info () << table.toString ( "My Histo" , histo , fmt ) ;
Parameters
histopointer to the histogram
IDhistorgam ID, title, label or other extra infomration
fmt"short" format used for the table
Returns
formatted row

Definition at line 406 of file HistoTableFormat.cpp.

407 {
408 return Gaudi::Utils::Histos::format( histo, ID, fmt, format() );
409}

Member Data Documentation

◆ m_footer

std::string Gaudi::Utils::Histos::Table::m_footer

the table footer

Definition at line 566 of file HistoTableFormat.h.

◆ m_format

std::string Gaudi::Utils::Histos::Table::m_format

the defautl format

Definition at line 568 of file HistoTableFormat.h.

◆ m_header

std::string Gaudi::Utils::Histos::Table::m_header

the table header

Definition at line 564 of file HistoTableFormat.h.


The documentation for this class was generated from the following files: