Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Teuchos::basic_FancyOStream_buf< CharT, Traits > Class Template Reference

Stream buffering class that performs the magic of indenting data sent to an std::ostream object. More...

#include <Teuchos_FancyOStream.hpp>

Inherits basic_streambuf< CharT, Traits >.

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
 

Public Member Functions

 basic_FancyOStream_buf (const RCP< std::basic_ostream< char_type, traits_type > > &oStream, const std::basic_string< char_type, traits_type > &tabIndentStr, const int startingTab, const bool showLinePrefix, const int maxLenLinePrefix, const bool showTabCount, const bool showProcRank)
 
void initialize (const RCP< std::basic_ostream< char_type, traits_type > > &oStream, const std::basic_string< char_type, traits_type > &tabIndentStr, const int startingTab, const bool showLinePrefix, const int maxLenLinePrefix, const bool showTabCount, const bool showProcRank)
 
RCP< std::basic_ostream
< char_type, traits_type > > 
getOStream ()
 
void setTabIndentStr (const std::basic_string< char_type, traits_type > &tabIndentStr)
 
const std::basic_string
< char_type, traits_type > & 
getTabIndentStr () const
 
void setShowLinePrefix (const bool showLinePrefix)
 
bool getShowLinePrefix () const
 
void setMaxLenLinePrefix (const int maxLenLinePrefix)
 
int getMaxLenLinePrefix () const
 
void setShowTabCount (const bool showTabCount)
 
bool getShowTabCount () const
 
void setShowProcRank (const bool showProcRank)
 
bool getShowProcRank () const
 
void setProcRankAndSize (const int procRank, const int numProcs)
 Set the (MPI) process rank and the number of processes in the communicator. More...
 
int getProcRank () const
 Get the rank of the calling (MPI) process. More...
 
int getNumProcs () const
 Get the number of processes in the communicator. More...
 
void setOutputToRootOnly (const int rootRank)
 Set the stream to print only on the (MPI) process with the given rank. More...
 
int getOutputToRootOnly () const
 
void pushTab (const int tabs)
 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 ()
 

Private Types

typedef std::basic_string
< char_type, traits_type
string_t
 
typedef std::deque< int > tabIndentStack_t
 
typedef std::deque< string_tlinePrefixStack_t
 

Private Member Functions

std::ostream & out ()
 
void writeChars (const char_type s[], std::streamsize n)
 
void writeFrontMatter ()
 
 basic_FancyOStream_buf ()
 
 basic_FancyOStream_buf (const basic_FancyOStream_buf< CharT, Traits > &)
 
basic_FancyOStream_buf< CharT,
Traits > 
operator= (const basic_FancyOStream_buf< CharT, Traits > &)
 

Private Attributes

RCP< std::basic_ostream
< char_type, traits_type > > 
oStreamSet_
 
RCP< std::basic_ostream
< char_type, traits_type > > 
oStream_
 
std::basic_string< char_type,
traits_type
tabIndentStr_
 
bool showLinePrefix_
 
int maxLenLinePrefix_
 
bool showTabCount_
 
bool showProcRank_
 
int rootRank_
 
int procRank_
 
int numProcs_
 
int rankPrintWidth_
 
RCP< std::ostringstream > lineOut_
 
int tabIndent_
 
tabIndentStack_t tabIndentStack_
 
linePrefixStack_t linePrefixStack_
 
int enableTabbingStack_
 
bool wroteNewline_
 

Protected overridden functions from std::basic_streambuf

std::streamsize xsputn (const char_type *s, std::streamsize n)
 
int_type overflow (int_type c)
 

Detailed Description

template<typename CharT, typename Traits>
class Teuchos::basic_FancyOStream_buf< CharT, Traits >

Stream buffering class that performs the magic of indenting data sent to an std::ostream object.

Note, this is not a user-level class. Users should use basic_FancyOStream.

Definition at line 31 of file Teuchos_FancyOStream.hpp.

Member Typedef Documentation

template<typename CharT, typename Traits>
typedef CharT Teuchos::basic_FancyOStream_buf< CharT, Traits >::char_type

Definition at line 36 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
typedef Traits Teuchos::basic_FancyOStream_buf< CharT, Traits >::traits_type

Definition at line 38 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
typedef traits_type::int_type Teuchos::basic_FancyOStream_buf< CharT, Traits >::int_type

Definition at line 40 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
typedef traits_type::pos_type Teuchos::basic_FancyOStream_buf< CharT, Traits >::pos_type

Definition at line 42 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
typedef traits_type::off_type Teuchos::basic_FancyOStream_buf< CharT, Traits >::off_type

Definition at line 44 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
typedef std::basic_string<char_type,traits_type> Teuchos::basic_FancyOStream_buf< CharT, Traits >::string_t
private

Definition at line 270 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
typedef std::deque<int> Teuchos::basic_FancyOStream_buf< CharT, Traits >::tabIndentStack_t
private

Definition at line 271 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
typedef std::deque<string_t> Teuchos::basic_FancyOStream_buf< CharT, Traits >::linePrefixStack_t
private

Definition at line 272 of file Teuchos_FancyOStream.hpp.

Constructor & Destructor Documentation

template<typename CharT , typename Traits >
Teuchos::basic_FancyOStream_buf< CharT, Traits >::basic_FancyOStream_buf ( const RCP< std::basic_ostream< char_type, traits_type > > &  oStream,
const std::basic_string< char_type, traits_type > &  tabIndentStr,
const int  startingTab,
const bool  showLinePrefix,
const int  maxLenLinePrefix,
const bool  showTabCount,
const bool  showProcRank 
)

Definition at line 843 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
Teuchos::basic_FancyOStream_buf< CharT, Traits >::basic_FancyOStream_buf ( )
private
template<typename CharT, typename Traits>
Teuchos::basic_FancyOStream_buf< CharT, Traits >::basic_FancyOStream_buf ( const basic_FancyOStream_buf< CharT, Traits > &  )
private

Member Function Documentation

template<typename CharT , typename Traits >
void Teuchos::basic_FancyOStream_buf< 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,
const bool  showLinePrefix,
const int  maxLenLinePrefix,
const bool  showTabCount,
const bool  showProcRank 
)

Definition at line 859 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
RCP< std::basic_ostream< CharT, Traits > > Teuchos::basic_FancyOStream_buf< CharT, Traits >::getOStream ( )

Definition at line 890 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
void Teuchos::basic_FancyOStream_buf< CharT, Traits >::setTabIndentStr ( const std::basic_string< char_type, traits_type > &  tabIndentStr)

Definition at line 897 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
const std::basic_string< CharT, Traits > & Teuchos::basic_FancyOStream_buf< CharT, Traits >::getTabIndentStr ( ) const

Definition at line 907 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
void Teuchos::basic_FancyOStream_buf< CharT, Traits >::setShowLinePrefix ( const bool  showLinePrefix)

Definition at line 914 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
bool Teuchos::basic_FancyOStream_buf< CharT, Traits >::getShowLinePrefix ( ) const

Definition at line 921 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
void Teuchos::basic_FancyOStream_buf< CharT, Traits >::setMaxLenLinePrefix ( const int  maxLenLinePrefix)

Definition at line 928 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
int Teuchos::basic_FancyOStream_buf< CharT, Traits >::getMaxLenLinePrefix ( ) const

Definition at line 936 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
void Teuchos::basic_FancyOStream_buf< CharT, Traits >::setShowTabCount ( const bool  showTabCount)

Definition at line 943 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
bool Teuchos::basic_FancyOStream_buf< CharT, Traits >::getShowTabCount ( ) const

Definition at line 950 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
void Teuchos::basic_FancyOStream_buf< CharT, Traits >::setShowProcRank ( const bool  showProcRank)

Definition at line 957 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
bool Teuchos::basic_FancyOStream_buf< CharT, Traits >::getShowProcRank ( ) const

Definition at line 964 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
void Teuchos::basic_FancyOStream_buf< CharT, Traits >::setProcRankAndSize ( const int  procRank,
const int  numProcs 
)

Set the (MPI) process rank and the number of processes in the communicator.

Parameters
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 971 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
int Teuchos::basic_FancyOStream_buf< CharT, Traits >::getProcRank ( ) const

Get the rank of the calling (MPI) process.

Precondition
The calling process rank and the number of processes in the communicator were set via a call to setProcRankAndSize().

Definition at line 981 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
int Teuchos::basic_FancyOStream_buf< CharT, Traits >::getNumProcs ( ) const

Get the number of processes in the communicator.

Precondition
The calling process rank and the number of processes in the communicator were set via a call to setProcRankAndSize().

Definition at line 988 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
void Teuchos::basic_FancyOStream_buf< CharT, Traits >::setOutputToRootOnly ( const int  rootRank)

Set the stream to print only on the (MPI) process with the given rank.

Precondition
The calling process rank and the number of processes in the communicator were set via a call to setProcRankAndSize().
Parameters
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.
Warning
The effect of this method is currently irreversible. This commits downstream users of this output stream to the same assignment of ranks to processes. The result of calling setProcRankAndSize() after this method has been called is undefined. It will likely have no effect.

Definition at line 995 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
int Teuchos::basic_FancyOStream_buf< CharT, Traits >::getOutputToRootOnly ( ) const

Definition at line 1019 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
void Teuchos::basic_FancyOStream_buf< CharT, Traits >::pushTab ( const int  tabs)

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 1026 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
int Teuchos::basic_FancyOStream_buf< CharT, Traits >::getNumCurrTabs ( ) const

Definition at line 1040 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
void Teuchos::basic_FancyOStream_buf< 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 1047 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
void Teuchos::basic_FancyOStream_buf< CharT, Traits >::pushLinePrefix ( const std::basic_string< char_type, traits_type > &  linePrefix)

Definition at line 1055 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
void Teuchos::basic_FancyOStream_buf< CharT, Traits >::popLinePrefix ( )

Definition at line 1064 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
const std::basic_string< CharT, Traits > & Teuchos::basic_FancyOStream_buf< CharT, Traits >::getTopLinePrefix ( ) const

Definition at line 1072 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
void Teuchos::basic_FancyOStream_buf< CharT, Traits >::pushDisableTabbing ( )

Definition at line 1079 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
void Teuchos::basic_FancyOStream_buf< CharT, Traits >::popDisableTabbing ( )

Definition at line 1086 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
std::streamsize Teuchos::basic_FancyOStream_buf< CharT, Traits >::xsputn ( const char_type s,
std::streamsize  n 
)
protected

Definition at line 1096 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
basic_FancyOStream_buf< CharT, Traits >::int_type Teuchos::basic_FancyOStream_buf< CharT, Traits >::overflow ( int_type  c)
protected

Definition at line 1110 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
std::ostream & Teuchos::basic_FancyOStream_buf< CharT, Traits >::out ( )
private

Definition at line 1128 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
void Teuchos::basic_FancyOStream_buf< CharT, Traits >::writeChars ( const char_type  s[],
std::streamsize  n 
)
private

Definition at line 1137 of file Teuchos_FancyOStream.hpp.

template<typename CharT , typename Traits >
void Teuchos::basic_FancyOStream_buf< CharT, Traits >::writeFrontMatter ( )
private

Definition at line 1183 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
basic_FancyOStream_buf<CharT,Traits> Teuchos::basic_FancyOStream_buf< CharT, Traits >::operator= ( const basic_FancyOStream_buf< CharT, Traits > &  )
private

Member Data Documentation

template<typename CharT, typename Traits>
RCP<std::basic_ostream<char_type,traits_type> > Teuchos::basic_FancyOStream_buf< CharT, Traits >::oStreamSet_
private

Definition at line 277 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
RCP<std::basic_ostream<char_type,traits_type> > Teuchos::basic_FancyOStream_buf< CharT, Traits >::oStream_
private

Definition at line 278 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
std::basic_string<char_type,traits_type> Teuchos::basic_FancyOStream_buf< CharT, Traits >::tabIndentStr_
private

Definition at line 279 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
bool Teuchos::basic_FancyOStream_buf< CharT, Traits >::showLinePrefix_
private

Definition at line 280 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
int Teuchos::basic_FancyOStream_buf< CharT, Traits >::maxLenLinePrefix_
private

Definition at line 281 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
bool Teuchos::basic_FancyOStream_buf< CharT, Traits >::showTabCount_
private

Definition at line 282 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
bool Teuchos::basic_FancyOStream_buf< CharT, Traits >::showProcRank_
private

Definition at line 283 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
int Teuchos::basic_FancyOStream_buf< CharT, Traits >::rootRank_
private

Definition at line 284 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
int Teuchos::basic_FancyOStream_buf< CharT, Traits >::procRank_
private

Definition at line 285 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
int Teuchos::basic_FancyOStream_buf< CharT, Traits >::numProcs_
private

Definition at line 286 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
int Teuchos::basic_FancyOStream_buf< CharT, Traits >::rankPrintWidth_
private

Definition at line 287 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
RCP<std::ostringstream> Teuchos::basic_FancyOStream_buf< CharT, Traits >::lineOut_
private

Definition at line 289 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
int Teuchos::basic_FancyOStream_buf< CharT, Traits >::tabIndent_
private

Definition at line 291 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
tabIndentStack_t Teuchos::basic_FancyOStream_buf< CharT, Traits >::tabIndentStack_
private

Definition at line 292 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
linePrefixStack_t Teuchos::basic_FancyOStream_buf< CharT, Traits >::linePrefixStack_
private

Definition at line 293 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
int Teuchos::basic_FancyOStream_buf< CharT, Traits >::enableTabbingStack_
private

Definition at line 294 of file Teuchos_FancyOStream.hpp.

template<typename CharT, typename Traits>
bool Teuchos::basic_FancyOStream_buf< CharT, Traits >::wroteNewline_
private

Definition at line 296 of file Teuchos_FancyOStream.hpp.


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