Teuchos::TableFormat Class Reference

Encapsulation of formatting specifications for writing data in a clean tabular form. More...

#include <Teuchos_TableFormat.hpp>

List of all members.

Public Member Functions

 TableFormat ()
 Construct with a header and default format settings.
int pageWidth () const
 Get the maximum number of characters per line. Default is 80.
int precision () const
 Get the precision for writing doubles. Default is 4.
int columnSpacing () const
 Get the number of characters to be left as blank spaces in each column. Default is 4.
void setPageWidth (int pw) const
 Set the number of characters on a line. This quantity can be updated within the const method writeWholeTables().
void setPrecision (int p)
 Set the precision for writing doubles.
void setColumnSpacing (int columnSpacing_in)
 Set the number of characters to be left as blank spaces in each column.
void setRowsBetweenLines (int lineInterval)
 Set the interval at which a horizontal line will be written between rows.
std::string thinline () const
 Return a horizontal line in dashes "----" the width of the page.
std::string thickline () const
 Return a thick horizontal line in equal signs "====" the width of the page.
std::string blanks (int size) const
 Return a std::string full of blanks up to the requested size.
int computeRequiredColumnWidth (const std::string &name, const TableColumn &column) const
 Computes the column width required to write all values to the required precision.
void setColumnWidths (const Array< int > &colWidths)
 Set the column widths to be used for subsequent rows.
void writeRow (std::ostream &out, const Array< RCP< TableEntry > > &entries) const
 Write the row of entries.
void writeRow (std::ostream &out, int rowIndex, const Array< TableColumn > &columns) const
 Write the row of entries.
void writeWholeTable (std::ostream &out, const std::string &tableTitle, const Array< std::string > &columnNames, const Array< TableColumn > &columns) const
 

Protected Member Functions

int defaultColumnWidth () const


Detailed Description

Encapsulation of formatting specifications for writing data in a clean tabular form.

Note: it is left to the programmer to avoid invalid settings such as negative column spaces, zero page widths, and other such potentially bad things.

KL 30 Apr 2006 -- initial design.

Definition at line 52 of file Teuchos_TableFormat.hpp.


Constructor & Destructor Documentation

Teuchos::TableFormat::TableFormat (  )  [inline]

Construct with a header and default format settings.

Definition at line 56 of file Teuchos_TableFormat.hpp.


Member Function Documentation

int Teuchos::TableFormat::pageWidth (  )  const [inline]

Get the maximum number of characters per line. Default is 80.

Definition at line 63 of file Teuchos_TableFormat.hpp.

int Teuchos::TableFormat::precision (  )  const [inline]

Get the precision for writing doubles. Default is 4.

Definition at line 67 of file Teuchos_TableFormat.hpp.

int Teuchos::TableFormat::columnSpacing (  )  const [inline]

Get the number of characters to be left as blank spaces in each column. Default is 4.

Definition at line 71 of file Teuchos_TableFormat.hpp.

void Teuchos::TableFormat::setPageWidth ( int  pw  )  const [inline]

Set the number of characters on a line. This quantity can be updated within the const method writeWholeTables().

Definition at line 76 of file Teuchos_TableFormat.hpp.

void Teuchos::TableFormat::setPrecision ( int  p  )  [inline]

Set the precision for writing doubles.

Definition at line 79 of file Teuchos_TableFormat.hpp.

void Teuchos::TableFormat::setColumnSpacing ( int  columnSpacing_in  )  [inline]

Set the number of characters to be left as blank spaces in each column.

Definition at line 82 of file Teuchos_TableFormat.hpp.

void Teuchos::TableFormat::setRowsBetweenLines ( int  lineInterval  )  [inline]

Set the interval at which a horizontal line will be written between rows.

lineInterval [in] the number of rows between each horizontal line

Definition at line 89 of file Teuchos_TableFormat.hpp.

std::string Teuchos::TableFormat::thinline (  )  const

Return a horizontal line in dashes "----" the width of the page.

Originally called hbar, but changed to avoid possible confusion for physicists expecting hbar() to return $1.05457168e-34$ :-).

Definition at line 37 of file Teuchos_TableFormat.cpp.

std::string Teuchos::TableFormat::thickline (  )  const

Return a thick horizontal line in equal signs "====" the width of the page.

Definition at line 49 of file Teuchos_TableFormat.cpp.

std::string Teuchos::TableFormat::blanks ( int  size  )  const

Return a std::string full of blanks up to the requested size.

Definition at line 60 of file Teuchos_TableFormat.cpp.

int Teuchos::TableFormat::computeRequiredColumnWidth ( const std::string &  name,
const TableColumn column 
) const

Computes the column width required to write all values to the required precision.

Parameters:
name [in] the title of the column
column [in] the column data
Postcondition: colString.size()==values.size()

Definition at line 71 of file Teuchos_TableFormat.cpp.

void Teuchos::TableFormat::setColumnWidths ( const Array< int > &  colWidths  )  [inline]

Set the column widths to be used for subsequent rows.

Definition at line 118 of file Teuchos_TableFormat.hpp.

void Teuchos::TableFormat::writeRow ( std::ostream &  out,
const Array< RCP< TableEntry > > &  entries 
) const

Write the row of entries.

Parameters:
out [in/out] the output stream to which the row will be written
entries [in] the data to be written into this row. Each array element is the entry for a column on this row.

Definition at line 88 of file Teuchos_TableFormat.cpp.

void Teuchos::TableFormat::writeRow ( std::ostream &  out,
int  rowIndex,
const Array< TableColumn > &  columns 
) const

Write the row of entries.

Parameters:
out [in/out] the output stream to which the row will be written
columns [in] the columns of data from which this row is to be sliced
rowIndex [in] the index into the columns used to obtain the values for this row

Definition at line 107 of file Teuchos_TableFormat.cpp.

void Teuchos::TableFormat::writeWholeTable ( std::ostream &  out,
const std::string &  tableTitle,
const Array< std::string > &  columnNames,
const Array< TableColumn > &  columns 
) const

Definition at line 123 of file Teuchos_TableFormat.cpp.


The documentation for this class was generated from the following files:
Generated on Wed May 12 21:24:43 2010 for Teuchos - Trilinos Tools Package by  doxygen 1.4.7