CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CustomUIsession.cc
Go to the documentation of this file.
2 
4 
6 
7 G4int CustomUIsession::ReceiveG4cout(const G4String& coutString) {
8  if (fout) {
9  (*fout) << trim(coutString) << "\n";
10  } else {
11  edm::LogVerbatim("G4cout") << trim(coutString);
12  }
13  return 0;
14 }
15 
16 G4int CustomUIsession::ReceiveG4cerr(const G4String& cerrString) {
17  edm::LogWarning("G4cerr") << trim(cerrString);
18  return 0;
19 }
20 
22  if (!str.empty() && str.back() == '\n')
23  return str.substr(0, str.length() - 1);
24  return str;
25 }
26 
27 void CustomUIsession::sendToFile(std::ofstream* ptr) {
28  if (ptr && !ptr->fail()) {
29  fout = ptr;
30  }
31 }
Log< level::Info, true > LogVerbatim
std::ofstream * fout
void sendToFile(std::ofstream *)
std::string trim(const std::string &str)
G4int ReceiveG4cerr(const G4String &cerrString) override
G4int ReceiveG4cout(const G4String &coutString) override
Log< level::Warning, false > LogWarning
~CustomUIsession() override
#define str(s)