test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions
CustomUIsession Class Reference

#include <CustomUIsession.h>

Inheritance diagram for CustomUIsession:
CustomUIsessionThreadPrefix CustomUIsessionToFile

Public Member Functions

 CustomUIsession ()
 
G4int ReceiveG4cerr (const G4String &cerrString) override
 
G4int ReceiveG4cout (const G4String &coutString) override
 
 ~CustomUIsession ()
 

Protected Member Functions

std::string trim (const std::string &str)
 

Detailed Description

Definition at line 9 of file CustomUIsession.h.

Constructor & Destructor Documentation

CustomUIsession::CustomUIsession ( )

Definition at line 3 of file CustomUIsession.cc.

4 {
5 
6  G4UImanager *UI = G4UImanager::GetUIpointer();
7  UI->SetCoutDestination(this);
8 
9 }
CustomUIsession::~CustomUIsession ( )

Definition at line 11 of file CustomUIsession.cc.

References NULL.

12 {
13 
14  G4UImanager *UI = G4UImanager::GetUIpointer();
15  UI->SetCoutDestination(NULL);
16 
17 }
#define NULL
Definition: scimark2.h:8

Member Function Documentation

G4int CustomUIsession::ReceiveG4cerr ( const G4String &  cerrString)
override

Definition at line 26 of file CustomUIsession.cc.

References trim().

27 {
28  //std::cerr << cerrString << std::flush;
29  edm::LogWarning("G4cerr") << trim(cerrString);
30  return 0;
31 }
std::string trim(const std::string &str)
G4int CustomUIsession::ReceiveG4cout ( const G4String &  coutString)
override

Definition at line 19 of file CustomUIsession.cc.

References trim().

20 {
21  //std::cout << coutString << std::flush;
22  edm::LogVerbatim("G4cout") << trim(coutString);
23  return 0;
24 }
std::string trim(const std::string &str)
std::string CustomUIsession::trim ( const std::string &  str)
protected

Definition at line 33 of file CustomUIsession.cc.

Referenced by ReceiveG4cerr(), CustomUIsessionThreadPrefix::ReceiveG4cerr(), ReceiveG4cout(), and CustomUIsessionThreadPrefix::ReceiveG4cout().

33  {
34  if(!str.empty() && str.back() == '\n')
35  return str.substr(0, str.length()-1);
36  return str;
37 }