Teuchos Package Browser (Single Doxygen Collection)
Version of the Day
|
std::ostream subclass that performs the magic of indenting data sent to an std::ostream object among other things. More...
#include <Teuchos_FancyOStream.hpp>
Inherits basic_ostream< CharT, Traits >.
Private Member Functions | |
basic_FancyOStream () | |
basic_FancyOStream (const basic_FancyOStream< CharT, Traits > &) | |
basic_FancyOStream< CharT, Traits > | operator= (const basic_FancyOStream< CharT, Traits > &) |
Private Attributes | |
streambuf_t | streambuf_ |
Related Functions | |
(Note that these are not member functions.) | |
RCP< basic_FancyOStream< char > > | fancyOStream (const RCP< std::basic_ostream< char > > &oStream, const std::basic_string< char > &tabIndentStr=" ", const int startingTab=0, const bool showLinePrefix=false, const int maxLenLinePrefix=10, const bool showTabCount=false, const bool showProcRank=false) |
Dynamically allocate a FancyOStream and return it wrapped in an RCP object. More... | |
RCP< basic_FancyOStream< char > > | getFancyOStream (const RCP< std::basic_ostream< char > > &out) |
Get a FancyOStream from an std::ostream object. More... | |
template<typename CharT , typename Traits > | |
RCP< basic_FancyOStream< CharT, Traits > > | tab (const RCP< basic_FancyOStream< CharT, Traits > > &out, const int tabs=1, const std::basic_string< CharT, Traits > linePrefix="") |
Create a tab for an RCP-wrapped basic_FancyOStream object to cause the indentation of all output automatically!. More... | |
template<typename CharT , typename Traits > | |
RCP< basic_FancyOStream< CharT, Traits > > | tab (const RCP< std::basic_ostream< CharT, Traits > > &out, const int tabs=1, const std::basic_string< CharT, Traits > linePrefix="") |
Create a tab for an RCP-wrapped std:: std::ostream object to cause the indentation of all output automatically!. More... | |
Public types | |
typedef CharT | char_type |
typedef Traits | traits_type |
typedef traits_type::int_type | int_type |
typedef traits_type::pos_type | pos_type |
typedef traits_type::off_type | off_type |
typedef basic_FancyOStream_buf < CharT, Traits > | streambuf_t |
typedef std::basic_ostream < char_type, traits_type > | ostream_t |
Public client functions | |
basic_FancyOStream (const RCP< std::basic_ostream< char_type, traits_type > > &oStream, const std::basic_string< char_type, traits_type > &tabIndentStr=" ", const int startingTab=0, const bool showLinePrefix=false, const int maxLenLinePrefix=10, const bool showTabCount=false, const bool showProcRank=false) | |
Constructor. More... | |
void | initialize (const RCP< std::basic_ostream< char_type, traits_type > > &oStream, const std::basic_string< char_type, traits_type > &tabIndentStr=" ", const int startingTab=0, const bool showLinePrefix=false, const int maxLenLinePrefix=10, const bool showTabCount=false, const bool showProcRank=false) |
Initialize the output stream. More... | |
RCP< std::basic_ostream < char_type, traits_type > > | getOStream () |
Get the output stream this object wraps. More... | |
basic_FancyOStream & | setTabIndentStr (const std::basic_string< char_type, traits_type > &tabIndentStr) |
Set the tab indent string. More... | |
const std::basic_string < char_type, traits_type > & | getTabIndentStr () const |
Get the tab indent string. More... | |
basic_FancyOStream & | setShowAllFrontMatter (const bool showAllFrontMatter) |
Control whether this stream prints "front matter.". More... | |
basic_FancyOStream & | setShowLinePrefix (const bool showLinePrefix) |
basic_FancyOStream & | setMaxLenLinePrefix (const int maxLenLinePrefix) |
basic_FancyOStream & | setShowTabCount (const bool showTabCount) |
basic_FancyOStream & | setShowProcRank (const bool showProcRank) |
basic_FancyOStream & | setProcRankAndSize (const int procRank, const int numProcs) |
Set the (MPI) process rank and the number of processes in the communicator. More... | |
basic_FancyOStream & | setOutputToRootOnly (const int rootRank) |
Set the stream to print only on the (MPI) process with the given rank. More... | |
int | getOutputToRootOnly () const |
void | copyAllOutputOptions (const basic_FancyOStream< CharT, Traits > &oStream) |
Functions designed to be used by basic_OSTab | |
void | pushTab (const int tabs=1) |
Push one or more tabs. More... | |
int | getNumCurrTabs () const |
void | popTab () |
Pop the current tab. More... | |
void | pushLinePrefix (const std::basic_string< char_type, traits_type > &linePrefix) |
void | popLinePrefix () |
const std::basic_string < char_type, traits_type > & | getTopLinePrefix () const |
void | pushDisableTabbing () |
void | popDisableTabbing () |
std::ostream subclass that performs the magic of indenting data sent to an std::ostream object among other things.
Use the typedef FancyOStream
for support for the char
character type.
Indentation of the stream is accomplished through creating basic_OSTab
objects (i.e. typedef OSTab
). For example, when accepting a FancyOStream
object, one might indent it like:
In addition to indenting output, this stream object can also print various types of information at the beginning of each line. The type of information supported is:
setShowProcRank()
. showLinePrefix()
and OSTab::OSTab()
. setShowTabCount()
. See FancyOutputting_test.cpp
for examples of how this class is used and the output it generates.
Definition at line 381 of file Teuchos_FancyOStream.hpp.
typedef CharT Teuchos::basic_FancyOStream< CharT, Traits >::char_type |
Definition at line 389 of file Teuchos_FancyOStream.hpp.
typedef Traits Teuchos::basic_FancyOStream< CharT, Traits >::traits_type |
Definition at line 391 of file Teuchos_FancyOStream.hpp.
typedef traits_type::int_type Teuchos::basic_FancyOStream< CharT, Traits >::int_type |
Definition at line 393 of file Teuchos_FancyOStream.hpp.
typedef traits_type::pos_type Teuchos::basic_FancyOStream< CharT, Traits >::pos_type |
Definition at line 395 of file Teuchos_FancyOStream.hpp.
typedef traits_type::off_type Teuchos::basic_FancyOStream< CharT, Traits >::off_type |
Definition at line 397 of file Teuchos_FancyOStream.hpp.
typedef basic_FancyOStream_buf<CharT,Traits> Teuchos::basic_FancyOStream< CharT, Traits >::streambuf_t |
Definition at line 401 of file Teuchos_FancyOStream.hpp.
typedef std::basic_ostream<char_type, traits_type> Teuchos::basic_FancyOStream< CharT, Traits >::ostream_t |
Definition at line 403 of file Teuchos_FancyOStream.hpp.
|
explicit |
Constructor.
oStream | [in/out] Output stream to wrap. |
tabIndentStr | [in] String to use as a prefix for each tab level. Default is a single space (per tab level). |
startingTab | [in] Starting tab level. Default is 0. |
showLinePrefix | [in] Whether to show the line prefix. (This does not include the tab indent string. Tabs will indent regardless.) |
maxLenLinePrefix | [in] Maximum number of characters in the line prefix. (This does not include the tab indent string.) |
showTabCount | [in] Whether to show the tab count in front of each line of text. |
showProcRank | [in] Whether to print the rank of the calling (MPI) process in front of each line of text. If you set this to true, you must call setProcRankAndSize() before printing to this output stream, or the process rank will not be defined. |
The following things are called "front matter":
This object may print any or all of these things in front of each line. (Delimit each line by using std::endl
, not with "\n". The latter is not portable in any case!) You may control which of these get printed by the corresponding Boolean argument of this constructor.
Definition at line 1260 of file Teuchos_FancyOStream.hpp.
|
private |
|
private |
void Teuchos::basic_FancyOStream< CharT, Traits >::initialize | ( | const RCP< std::basic_ostream< char_type, traits_type > > & | oStream, |
const std::basic_string< char_type, traits_type > & | tabIndentStr = " " , |
||
const int | startingTab = 0 , |
||
const bool | showLinePrefix = false , |
||
const int | maxLenLinePrefix = 10 , |
||
const bool | showTabCount = false , |
||
const bool | showProcRank = false |
||
) |
Initialize the output stream.
This takes the same arguments as the constructor.
Definition at line 1278 of file Teuchos_FancyOStream.hpp.
RCP< std::basic_ostream< CharT, Traits > > Teuchos::basic_FancyOStream< CharT, Traits >::getOStream | ( | ) |
Get the output stream this object wraps.
Definition at line 1296 of file Teuchos_FancyOStream.hpp.
basic_FancyOStream< CharT, Traits > & Teuchos::basic_FancyOStream< CharT, Traits >::setTabIndentStr | ( | const std::basic_string< char_type, traits_type > & | tabIndentStr | ) |
Set the tab indent string.
Definition at line 1304 of file Teuchos_FancyOStream.hpp.
const std::basic_string< CharT, Traits > & Teuchos::basic_FancyOStream< CharT, Traits >::getTabIndentStr | ( | ) | const |
Get the tab indent string.
Definition at line 1315 of file Teuchos_FancyOStream.hpp.
basic_FancyOStream< CharT, Traits > & Teuchos::basic_FancyOStream< CharT, Traits >::setShowAllFrontMatter | ( | const bool | showAllFrontMatter | ) |
Control whether this stream prints "front matter.".
"Front matter" includes the following things:
This object may print any or all of these things in front of each line. (Delimit each line by using std::endl
, not with "\n". The latter is not portable in any case!) You may control individually which of these get printed by the corresponding Boolean argument of this object's constructor. You may also call this method to turn on or off printing of all front matter.
Definition at line 1323 of file Teuchos_FancyOStream.hpp.
basic_FancyOStream< CharT, Traits > & Teuchos::basic_FancyOStream< CharT, Traits >::setShowLinePrefix | ( | const bool | showLinePrefix | ) |
Definition at line 1336 of file Teuchos_FancyOStream.hpp.
basic_FancyOStream< CharT, Traits > & Teuchos::basic_FancyOStream< CharT, Traits >::setMaxLenLinePrefix | ( | const int | maxLenLinePrefix | ) |
Definition at line 1345 of file Teuchos_FancyOStream.hpp.
basic_FancyOStream< CharT, Traits > & Teuchos::basic_FancyOStream< CharT, Traits >::setShowTabCount | ( | const bool | showTabCount | ) |
Definition at line 1354 of file Teuchos_FancyOStream.hpp.
basic_FancyOStream< CharT, Traits > & Teuchos::basic_FancyOStream< CharT, Traits >::setShowProcRank | ( | const bool | showProcRank | ) |
Definition at line 1363 of file Teuchos_FancyOStream.hpp.
basic_FancyOStream< CharT, Traits > & Teuchos::basic_FancyOStream< CharT, Traits >::setProcRankAndSize | ( | const int | procRank, |
const int | numProcs | ||
) |
Set the (MPI) process rank and the number of processes in the communicator.
procRank | [in] The rank of the calling process. |
numProcs | [in] The number of processes in the communicator. |
You must call this method before you may call setOutputToRootOnly().
Definition at line 1372 of file Teuchos_FancyOStream.hpp.
basic_FancyOStream< CharT, Traits > & Teuchos::basic_FancyOStream< CharT, Traits >::setOutputToRootOnly | ( | const int | rootRank | ) |
Set the stream to print only on the (MPI) process with the given rank.
rootRank | [in] The rank of the process on which to print. The convention is to use Process 0 as the "root" process, but this is not required. |
Definition at line 1381 of file Teuchos_FancyOStream.hpp.
int Teuchos::basic_FancyOStream< CharT, Traits >::getOutputToRootOnly | ( | ) | const |
Definition at line 1389 of file Teuchos_FancyOStream.hpp.
void Teuchos::basic_FancyOStream< CharT, Traits >::copyAllOutputOptions | ( | const basic_FancyOStream< CharT, Traits > & | oStream | ) |
Definition at line 1396 of file Teuchos_FancyOStream.hpp.
void Teuchos::basic_FancyOStream< CharT, Traits >::pushTab | ( | const int | tabs = 1 | ) |
Push one or more tabs.
Users should generally not call this method directly. It is better to use OSTab to automate the process. OSTab's constructor calls pushTab() for you. It also calls popTab() automatically on scope exit, whether the scope was exited normally or by an exception throw. This "puts things back how you found them."
Definition at line 1411 of file Teuchos_FancyOStream.hpp.
int Teuchos::basic_FancyOStream< CharT, Traits >::getNumCurrTabs | ( | ) | const |
Definition at line 1418 of file Teuchos_FancyOStream.hpp.
void Teuchos::basic_FancyOStream< CharT, Traits >::popTab | ( | ) |
Pop the current tab.
Users should generally not call this method directly. It is better to use OSTab to automate the process. OSTab calls popTab() automatically on scope exit, whether the scope was exited normally or by an exception throw. This "puts things back how you found them."
Definition at line 1425 of file Teuchos_FancyOStream.hpp.
void Teuchos::basic_FancyOStream< CharT, Traits >::pushLinePrefix | ( | const std::basic_string< char_type, traits_type > & | linePrefix | ) |
Definition at line 1432 of file Teuchos_FancyOStream.hpp.
void Teuchos::basic_FancyOStream< CharT, Traits >::popLinePrefix | ( | ) |
Definition at line 1441 of file Teuchos_FancyOStream.hpp.
const std::basic_string< CharT, Traits > & Teuchos::basic_FancyOStream< CharT, Traits >::getTopLinePrefix | ( | ) | const |
Definition at line 1449 of file Teuchos_FancyOStream.hpp.
void Teuchos::basic_FancyOStream< CharT, Traits >::pushDisableTabbing | ( | ) |
Definition at line 1456 of file Teuchos_FancyOStream.hpp.
void Teuchos::basic_FancyOStream< CharT, Traits >::popDisableTabbing | ( | ) |
Definition at line 1463 of file Teuchos_FancyOStream.hpp.
|
private |
|
related |
Dynamically allocate a FancyOStream and return it wrapped in an RCP object.
Returns a null
object if the input stream is null.
Definition at line 597 of file Teuchos_FancyOStream.hpp.
|
related |
Get a FancyOStream from an std::ostream object.
If the object already is a FancyOStream, then nothing has to be done. Otherwise, a temp FancyOStream is created for this purpose. If out.get()==NULL
then return.get()==NULL
on return also!
Definition at line 629 of file Teuchos_FancyOStream.hpp.
|
related |
Create a tab for an RCP-wrapped basic_FancyOStream
object to cause the indentation of all output automatically!.
This function returns an RCP object to a basic_FancyOStream
object that has its tab indented by one. If the input *out
object is already a basic_FancyOStream
object, then that object is used as is. If the *out
object is not a basic_FancyOStream
object, then a new basic_FancyOStream
object is created and its tab is set!"
In any case, when the returned RCP object is destroyed, the tab will be removed automatically!
Definition at line 791 of file Teuchos_FancyOStream.hpp.
|
related |
Create a tab for an RCP-wrapped std:: std::ostream
object to cause the indentation of all output automatically!.
This function returns an RCP object to a basic_FancyOStream
object that has its tab indented by one. If the input *out
object is already a basic_FancyOStream
object, then that object is used as is. If the *out
object is not a basic_FancyOStream
object, then a new basic_FancyOStream
object is created and its tab is set!"
In any case, when the returned RCP object is destroyed, the tab will be removed automatically!
Definition at line 828 of file Teuchos_FancyOStream.hpp.
|
private |
Definition at line 578 of file Teuchos_FancyOStream.hpp.