Gaudi Framework, version v20r2

Generated: 18 Jul 2008

Gaudi::Utils::Histos::Table Class Reference

#include <GaudiUtils/HistoTableFormat.h>

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

Collaboration graph
[legend]
List of all members.

Detailed Description

Simple class for the customizeble printout of the histogram tables.

Author:
Vanya BELYAEV ibelyaev@physics.syr.edu
Date:
2007-08-07

Definition at line 372 of file HistoTableFormat.h.

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::stringheader () const
 the table header
const std::stringfooter () const
 the table footer
const std::stringformat () const
 the format
void setHeader (const std::string &v)
 set new header
void setFooter (const std::string &v)
 set new footer
void setFormat (const 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::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

Public Attributes

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


Constructor & Destructor Documentation

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

constructor from enum

Definition at line 227 of file HistoTableFormat.cpp.

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 234 of file HistoTableFormat.cpp.

00237   : m_header ( header ) 
00238   , m_footer ( footer ) 
00239   , m_format ( format )
00240 {}


Member Function Documentation

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:
first begin-iterator for the sequence
last end-iterator for the sequence
stream the stream to be used for printout
term the terminmator for the stream

Definition at line 392 of file HistoTableFormat.h.

References footer(), format(), header(), and Gaudi::Utils::Histos::printList().

00396         { 
00397           if ( !header().empty() ) { stream << header () << term ; }
00398           Gaudi::Utils::Histos::printList ( first , last , format() , stream , term ) ; 
00399           if ( !footer().empty() ) { stream << footer () << term ; }
00400           return stream ;
00401         }

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
hval the name of the "key"-column
stream the stream for printout
term stream terminator

Definition at line 418 of file HistoTableFormat.h.

References std::basic_string< _CharT, _Traits, _Alloc >::empty(), format(), Gaudi::Utils::Histos::format(), header(), and Gaudi::Utils::Histos::printMap().

00424         {
00425           if ( !hval.empty() || !header().empty() )
00426           { stream << Gaudi::Utils::Histos::format ( hval , header() , fmt ) << term ; }
00427           return Gaudi::Utils::Histos::printMap
00428             ( first , last , fmt , format() , stream , term ) ;
00429         } 

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

the table header

Definition at line 434 of file HistoTableFormat.h.

References m_header.

Referenced by GaudiHistos< PBASE >::printHistos(), printList(), and printMap().

00434 { return m_header ; }

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

the table footer

Definition at line 437 of file HistoTableFormat.h.

References m_footer.

Referenced by printList().

00437 { return m_footer ; }

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

the format

Definition at line 440 of file HistoTableFormat.h.

References m_format.

Referenced by printList(), and printMap().

00440 { return m_format ; }

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

set new header

Definition at line 445 of file HistoTableFormat.h.

References m_header.

00445 { m_header = v ; }

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

set new footer

Definition at line 448 of file HistoTableFormat.h.

References m_footer.

00448 { m_footer = v ; }      

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

set new format

Definition at line 451 of file HistoTableFormat.h.

References m_format.

00451 { m_format = v ; } 

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

make the string representation according to the default format

Definition at line 245 of file HistoTableFormat.cpp.

References Gaudi::Utils::Histos::format().

Referenced by GaudiHistos< PBASE >::printHistos().

00246 { return Gaudi::Utils::Histos::format ( histo , format() ) ; }

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 ) ;

Parameters:
histo pointer to the histogram
ID historgam ID, title, label or other extra infomration
fmt "short" format used for the table
Returns:
formatted row

Definition at line 253 of file HistoTableFormat.cpp.

References Gaudi::Utils::Histos::format().

00256 { return Gaudi::Utils::Histos::format ( histo , ID , fmt , format() ) ; }


Member Data Documentation

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

the table header

Definition at line 490 of file HistoTableFormat.h.

Referenced by header(), and setHeader().

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

the table footer

Definition at line 492 of file HistoTableFormat.h.

Referenced by footer(), and setFooter().

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

the defautl format

Definition at line 494 of file HistoTableFormat.h.

Referenced by format(), and setFormat().


The documentation for this class was generated from the following files:
Generated at Fri Jul 18 12:10:31 2008 for Gaudi Framework, version v20r2 by Doxygen version 1.5.1 written by Dimitri van Heesch, © 1997-2004