|
||||
File indexing completed on 2025-01-18 09:59:35
0001 //----------------------------------*-C++-*----------------------------------// 0002 // Copyright 2023-2024 UT-Battelle, LLC, and other Celeritas developers. 0003 // See the top-level COPYRIGHT file for details. 0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT) 0005 //---------------------------------------------------------------------------// 0006 //! \file geocel/ScopedGeantLogger.hh 0007 //---------------------------------------------------------------------------// 0008 #pragma once 0009 0010 #include <memory> 0011 0012 #include "corecel/Config.hh" 0013 0014 #include "corecel/Macros.hh" 0015 0016 class G4coutDestination; 0017 0018 namespace celeritas 0019 { 0020 //---------------------------------------------------------------------------// 0021 /*! 0022 * Install a Geant output destination during this class's lifetime. 0023 * 0024 * Since the Geant4 output streams are thread-local, this class is as well. 0025 * Multiple geant loggers can be nested, and only the outermost on a given 0026 * thread will "own" the log destination. 0027 */ 0028 class ScopedGeantLogger 0029 { 0030 public: 0031 // Construct exception handler 0032 ScopedGeantLogger(); 0033 0034 // Clear on destruction 0035 ~ScopedGeantLogger(); 0036 //!@{ 0037 //! Prevent copying and moving for RAII class 0038 CELER_DELETE_COPY_MOVE(ScopedGeantLogger); 0039 //!@} 0040 0041 private: 0042 #if CELERITAS_USE_GEANT4 0043 std::unique_ptr<G4coutDestination> logger_; 0044 #endif 0045 }; 0046 0047 #if !CELERITAS_USE_GEANT4 0048 //!@{ 0049 //! Do nothing if Geant4 is disabled (source file will not be compiled) 0050 inline ScopedGeantLogger::ScopedGeantLogger() {} 0051 inline ScopedGeantLogger::~ScopedGeantLogger() {} 0052 //!@} 0053 #endif 0054 0055 //---------------------------------------------------------------------------// 0056 } // namespace celeritas
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |