Teuchos - Trilinos Tools Package  Version of the Day
Public Types | Public Member Functions | List of all members
Teuchos::MatrixMarket::details::SetScientific< Scalar > Class Template Reference

Temporarily make an output stream use scientific notation with sufficient precision. More...

#include <Teuchos_MatrixMarket_SetScientific.hpp>

Inheritance diagram for Teuchos::MatrixMarket::details::SetScientific< Scalar >:
Teuchos::MatrixMarket::details::SetScientificImpl< Scalar, ! Teuchos::ScalarTraits< Scalar >::isOrdinal >

Public Types

typedef Scalar scalar_type
 The Scalar type with which SetScientific was specialized. More...
 
- Public Types inherited from Teuchos::MatrixMarket::details::SetScientificImpl< Scalar, ! Teuchos::ScalarTraits< Scalar >::isOrdinal >
typedef Scalar scalar_type
 The Scalar type with which SetScientific was specialized. More...
 

Public Member Functions

 SetScientific (std::ostream &out)
 
 ~SetScientific ()
 
- Public Member Functions inherited from Teuchos::MatrixMarket::details::SetScientificImpl< Scalar, ! Teuchos::ScalarTraits< Scalar >::isOrdinal >
 SetScientificImpl (std::ostream &out)
 
 ~SetScientificImpl ()
 

Detailed Description

template<class Scalar>
class Teuchos::MatrixMarket::details::SetScientific< Scalar >

Temporarily make an output stream use scientific notation with sufficient precision.

On construction, apply the necessary flags to the given output stream so that floating-point numbers are written in scientific notation with precision (dependent on the Scalar type) sufficient to ensure that they can be read in with the same value. On destruction, restore the original (pre-construction) flags to the output stream.

This makes SetScientific good for scope-protected alteration of the output stream's flags; no matter how the scope exits (normally or by a thrown exception), the original flags will be restored. Hence, "temporarily" (or even "politely"): we restore the original flags on scope exit.

Template Parameters
ScalarA floating-point type, either real or complex, for which Teuchos::ScalarTraits<Scalar> has a specialization.

Definition at line 175 of file Teuchos_MatrixMarket_SetScientific.hpp.

Member Typedef Documentation

◆ scalar_type

template<class Scalar>
typedef Scalar Teuchos::MatrixMarket::details::SetScientific< Scalar >::scalar_type

The Scalar type with which SetScientific was specialized.

Definition at line 183 of file Teuchos_MatrixMarket_SetScientific.hpp.

Constructor & Destructor Documentation

◆ SetScientific()

template<class Scalar>
Teuchos::MatrixMarket::details::SetScientific< Scalar >::SetScientific ( std::ostream &  out)
inline

Constructor.

Parameters
out[in/out] Output stream to which to apply the scientific notation flags.

Definition at line 189 of file Teuchos_MatrixMarket_SetScientific.hpp.

◆ ~SetScientific()

template<class Scalar>
Teuchos::MatrixMarket::details::SetScientific< Scalar >::~SetScientific ( )
inline

Destructor.

The destructor sets the output stream's flags back to their original state, that is, the state before the constructor of this object was called.

Definition at line 196 of file Teuchos_MatrixMarket_SetScientific.hpp.


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