Celeritas  0.5.0-56+6b053cd
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. More...
 
 CELER_DELETE_COPY_MOVE (ScopedTimeAndRedirect)
 

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();
}
ScopedTimeAndRedirect(std::string label)
Redirect cout/cerr on construction, and start timer implicitly.
Definition: ScopedTimeAndRedirect.cc:50

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.

Member Function Documentation

◆ CELER_DELETE_COPY_MOVE()

celeritas::ScopedTimeAndRedirect::CELER_DELETE_COPY_MOVE ( ScopedTimeAndRedirect  )

Prevent copying and moving for RAII class


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