Tools/Geant4/G4OutputHandler.h
Go to the documentation of this file.
1 #ifndef _tls_G4OutputHandler_h_
2 #define _tls_G4OutputHandler_h_
3 
4 #include <utl/ErrorLogger.h>
5 #include <G4UIsession.hh>
6 #include <G4UImanager.hh>
7 #include <G4String.hh>
8 
9 
10 namespace tls {
11 
22  class G4OutputHandler : public G4UIsession {
23  public:
25  {
26  G4UImanager* const ui = G4UImanager::GetUIpointer();
27  ui->SetCoutDestination(this);
28  }
29 
31  {
32  G4UImanager* const ui = G4UImanager::GetUIpointer();
33  ui->SetCoutDestination(nullptr);
34  }
35 
36  G4int
37  ReceiveG4cout(const G4String& coutString)
38  override
39  {
40  INFO(coutString);
41  return 0;
42  }
43 
44  G4int
45  ReceiveG4cerr(const G4String& cerrString)
46  override
47  {
48  ERROR(cerrString);
49  return 0;
50  }
51 
52  };
53 
54 }
55 
56 
57 #endif
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
This class redirects Geant4&#39;s streams G4cerr and G4cerr to the framework&#39;s utl::ErrorLogger.
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165

, generated on Tue Sep 26 2023.