Teuchos - Trilinos Tools Package  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Protected Member Functions | Related Functions | List of all members
Teuchos::VerboseObject< ObjectType > Class Template Reference

Templated base class for objects that can print their activities to a stream and have a verbosity level. More...

#include <Teuchos_VerboseObject.hpp>

Inheritance diagram for Teuchos::VerboseObject< ObjectType >:
Teuchos::VerboseObjectBase

Public Member Functions

Constructors/Initializers
 VerboseObject (const EVerbosityLevel verbLevel=VERB_DEFAULT, const RCP< FancyOStream > &oStream=Teuchos::null)
 Constructor: calls initializeVerboseObject(). More...
 
virtual const VerboseObjectsetVerbLevel (const EVerbosityLevel verbLevel) const
 Set this object's verbosity level. More...
 
virtual const VerboseObjectsetOverridingVerbLevel (const EVerbosityLevel verbLevel) const
 Set the overriding verbosity level for *this object. More...
 
Query functions
virtual EVerbosityLevel getVerbLevel () const
 Get the verbosity level. More...
 
- Public Member Functions inherited from Teuchos::VerboseObjectBase
virtual ~VerboseObjectBase ()
 
 VerboseObjectBase (const RCP< FancyOStream > &oStream=Teuchos::null)
 Calls initializeVerboseObject(). More...
 
virtual const VerboseObjectBasesetOStream (const RCP< FancyOStream > &oStream) const
 The output stream for *this object. More...
 
virtual const VerboseObjectBasesetOverridingOStream (const RCP< FancyOStream > &oStream) const
 Set the overriding the output stream for *this object. More...
 
virtual VerboseObjectBasesetLinePrefix (const std::string &linePrefix)
 Set line prefix name for this object. More...
 
virtual RCP< FancyOStreamgetOStream () const
 Return the output stream to be used for out for *this object. More...
 
virtual RCP< FancyOStreamgetOverridingOStream () const
 Return the the overriding output stream if set. More...
 
virtual std::string getLinePrefix () const
 Get the line prefix for this object. More...
 
virtual OSTab getOSTab (const int tabs=1, const std::string &linePrefix="") const
 Create a tab object which sets the number of tabs and optionally the line prefix. More...
 

Static Public Member Functions

Public static member functions
static void setDefaultVerbLevel (const EVerbosityLevel defaultVerbLevel)
 Set the default verbosity level. More...
 
static EVerbosityLevel getDefaultVerbLevel ()
 Get the default verbosity level. More...
 
- Static Public Member Functions inherited from Teuchos::VerboseObjectBase
static void setDefaultOStream (const RCP< FancyOStream > &defaultOStream)
 Set the default output stream object. More...
 
static RCP< FancyOStreamgetDefaultOStream ()
 Get the default output stream object. More...
 

Protected Member Functions

void initializeVerboseObject (const EVerbosityLevel verbLevel=VERB_DEFAULT, const RCP< FancyOStream > &oStream=Teuchos::null)
 Initialize the VerboseObject. More...
 
- Protected Member Functions inherited from Teuchos::VerboseObjectBase
void initializeVerboseObjectBase (const RCP< FancyOStream > &oStream=Teuchos::null)
 Calls initializeVerboseObject(). More...
 
virtual void informUpdatedVerbosityState () const
 Function that is called whenever the verbosity state is updated. More...
 

Related Functions

(Note that these are not member functions.)

TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT
RCP< const ParameterList
getValidVerboseObjectSublist ()
 Return the sublist of valid parameters for the "VerboseObject" sublist. More...
 
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT
void 
setupVerboseObjectSublist (ParameterList *paramList)
 Setup a sublist called "VerboseObject" in the given parameter list. More...
 
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT
void 
readVerboseObjectSublist (ParameterList *paramList, RCP< FancyOStream > *oStream, EVerbosityLevel *verbLevel)
 Read the parameters in the "VerboseObject" sublist and set them on the given VerboseObject. More...
 
template<class ObjectType >
void readVerboseObjectSublist (ParameterList *paramList, VerboseObject< ObjectType > *verboseObject)
 Read the parameters in the "VerboseObject" sublist and set them on the given VerboseObject. More...
 

Detailed Description

template<class ObjectType>
class Teuchos::VerboseObject< ObjectType >

Templated base class for objects that can print their activities to a stream and have a verbosity level.

Objects that derive from this interface print to a default class-owned (i.e. static) output stream object (set using setDefaultOStream()) or the output stream can be set on an object-by-object basis using setOStream() . In addition, each object, by default, has a verbosity level that is shared by all objects (set using setDefaultVerbosityLevel()) or can be set on an object-by-object basis using setVerbLevel().

The output stream type is FancyOStream which allows for automated indentation (using the OSTab class) and has other useful features.

Note that setOStream() and setVerbLevel() are actually declared as const functions. This is to allow a client to temporarily change the stream and verbosity level. To do this saftely, use the class VerboseObjectTempState which will revert the output state after it is destroyed.

If the ParameterList subpackage of Teuchos is enabled (which it is by default), you may use the readVerboseObjectSublist nonmember function to pass a verbosity level and output stream filename to a VerboseObject using a ParameterList. The parameters are passed through a "VerboseObject" sublist of the input ParameterList. The sublist in turn takes optional parameters "Verbosity Level" (std::string) and "Output File" (std::string). "Verbosity Level" has six valid values: "VERB_DEFAULT", "VERB_NONE", "VERB_LOW", "VERB_MEDIUM", "VERB_HIGH", and "VERB_EXTREME". "VERB_DEFAULT" tells the object to use its default verbosity level, and the remaining values indicate increasing verbosity starting with "VERB_NONE" (say nothing). "Output File" is the name of a file to use for output; "none" means do not open a file, but write to the default output stream.

Definition at line 234 of file Teuchos_VerboseObject.hpp.

Constructor & Destructor Documentation

template<class ObjectType >
Teuchos::VerboseObject< ObjectType >::VerboseObject ( const EVerbosityLevel  verbLevel = VERB_DEFAULT,
const RCP< FancyOStream > &  oStream = Teuchos::null 
)
explicit

Constructor: calls initializeVerboseObject().

Definition at line 380 of file Teuchos_VerboseObject.hpp.

Member Function Documentation

template<class ObjectType >
void Teuchos::VerboseObject< ObjectType >::setDefaultVerbLevel ( const EVerbosityLevel  defaultVerbLevel)
static

Set the default verbosity level.

If not called, then the default verbosity level is VERB_DEFAULT.

Examples:
FancyOutputting_test.cpp.

Definition at line 363 of file Teuchos_VerboseObject.hpp.

template<class ObjectType >
EVerbosityLevel Teuchos::VerboseObject< ObjectType >::getDefaultVerbLevel ( )
static

Get the default verbosity level.

Examples:
FancyOutputting_test.cpp.

Definition at line 370 of file Teuchos_VerboseObject.hpp.

template<class ObjectType >
const VerboseObject< ObjectType > & Teuchos::VerboseObject< ObjectType >::setVerbLevel ( const EVerbosityLevel  verbLevel) const
virtual

Set this object's verbosity level.

This function is supposed by called by general clients to set the output level according to some general logic in the code.

Definition at line 403 of file Teuchos_VerboseObject.hpp.

template<class ObjectType >
const VerboseObject< ObjectType > & Teuchos::VerboseObject< ObjectType >::setOverridingVerbLevel ( const EVerbosityLevel  verbLevel) const
virtual

Set the overriding verbosity level for *this object.

This function is supposed to be called by special clients that want to set the output level in a way that will not be overridden by setOStream().

Definition at line 413 of file Teuchos_VerboseObject.hpp.

template<class ObjectType >
EVerbosityLevel Teuchos::VerboseObject< ObjectType >::getVerbLevel ( ) const
virtual

Get the verbosity level.

Definition at line 427 of file Teuchos_VerboseObject.hpp.

template<class ObjectType >
void Teuchos::VerboseObject< ObjectType >::initializeVerboseObject ( const EVerbosityLevel  verbLevel = VERB_DEFAULT,
const RCP< FancyOStream > &  oStream = Teuchos::null 
)
protected

Initialize the VerboseObject.

Parameters
verbLevel[in] Initial verbosity level.
oStream[in/out] Initial output stream.
Note
verbLevel must be the same as the default value for defaultVerbLevel_.

Definition at line 391 of file Teuchos_VerboseObject.hpp.

Friends And Related Function Documentation

template<class ObjectType >
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT RCP< const ParameterList > getValidVerboseObjectSublist ( )
related

Return the sublist of valid parameters for the "VerboseObject" sublist.

This function need not be directly called by clients since the function setupVerboseObjectSublist() sets up the sublist automatically.

template<class ObjectType >
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT void setupVerboseObjectSublist ( ParameterList paramList)
related

Setup a sublist called "VerboseObject" in the given parameter list.

Parameters
paramList[in/out] The parameter list hat the "VerboseObject" sublist will be added to

Preconditions:

  • paramList!=0
template<class ObjectType >
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT void readVerboseObjectSublist ( ParameterList paramList,
RCP< FancyOStream > *  oStream,
EVerbosityLevel verbLevel 
)
related

Read the parameters in the "VerboseObject" sublist and set them on the given VerboseObject.

Parameters
paramList[in/out] On input, contains the user's parameter list for the given objet for which "VerboseObject" can be a sublist of.
oStream[out] The oStream object to be used. On output, oStream->get()!=0 if an output stream was specified by the parameter sublist.
verbLevel[out] The verbosity level to be used. On output, *verbLevel gives the verbosity level set in the parameter list. If no verbosity level was set, then a value of *verbLevel==VERB_DEFAULT will be set on return.

Preconditions:

  • oStream!=0
  • verbLevel!=0
template<class ObjectType >
void readVerboseObjectSublist ( ParameterList paramList,
VerboseObject< ObjectType > *  verboseObject 
)
related

Read the parameters in the "VerboseObject" sublist and set them on the given VerboseObject.

Parameters
paramList[in/out] On input, contains the user's parameter list for the given object of which "VerboseObject" can be a sublist.
verboseObject[in/out] The verbose object that will have its verbosity level and/or output stream set.

This function just calls the above nontemplated readVerboseObjectSublist() to validate and and read the verbosity and output stream from the "VerboseObject" sublist.


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