Celeritas 0.7.0-dev.244+develop.bf1c0bd0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
celeritas::ScopedTimeAndRedirect Class Reference

At end of scope, print elapsed time and captured cout/cerr. More...

#include <ScopedTimeAndRedirect.hh>

Public Member Functions

 ScopedTimeAndRedirect (std::string label)
 Redirect cout/cerr on construction, and start timer implicitly.
 
 ~ScopedTimeAndRedirect ()
 Print any stored output/error messages on destruct.
 
 ScopedTimeAndRedirect (ScopedTimeAndRedirect const &)=delete
 
ScopedTimeAndRedirectoperator= (ScopedTimeAndRedirect const &)=delete
 
 ScopedTimeAndRedirect (ScopedTimeAndRedirect &&)=delete
 
ScopedTimeAndRedirectoperator= (ScopedTimeAndRedirect &&)=delete
 

Detailed Description

At end of scope, print elapsed time and captured cout/cerr.

This is designed to prevent other libraries (Geant4,VecGeom) from polluting stdout and breaking JSON reading ability.

{
ScopedTimeAndRedirect temp_{"VecGeom"};
vecgeom::DoNoisyAndLongStuff();
}
At end of scope, print elapsed time and captured cout/cerr.
Definition ScopedTimeAndRedirect.hh:34

Constructor & Destructor Documentation

◆ ~ScopedTimeAndRedirect()

celeritas::ScopedTimeAndRedirect::~ScopedTimeAndRedirect ( )

Print any stored output/error messages on destruct.

Note that these will only print on MPI rank 0, not on every process.

◆ ScopedTimeAndRedirect() [1/2]

celeritas::ScopedTimeAndRedirect::ScopedTimeAndRedirect ( ScopedTimeAndRedirect const )
delete

Prevent copying and moving for RAII class

◆ ScopedTimeAndRedirect() [2/2]

celeritas::ScopedTimeAndRedirect::ScopedTimeAndRedirect ( ScopedTimeAndRedirect &&  )
delete

Prevent copying and moving for RAII class

Member Function Documentation

◆ operator=() [1/2]

ScopedTimeAndRedirect & celeritas::ScopedTimeAndRedirect::operator= ( ScopedTimeAndRedirect &&  )
delete

Prevent copying and moving for RAII class

◆ operator=() [2/2]

ScopedTimeAndRedirect & celeritas::ScopedTimeAndRedirect::operator= ( ScopedTimeAndRedirect const )
delete

Prevent copying and moving for RAII class


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