#include "G4Timer.hh"
#include "G4ios.hh"
#include "G4ExceptionSeverity.hh"
Go to the source code of this file.
Functions | |
void | G4Exception (const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments) |
std::ostream & | operator<< (std::ostream &os, const G4Timer &t) |
void G4Exception | ( | const char * | originOfException, | |
const char * | exceptionCode, | |||
G4ExceptionSeverity | severity, | |||
const char * | comments | |||
) |
Definition at line 41 of file G4Exception.cc.
References EventMustBeAborted, FatalErrorInArgument, FatalException, G4cerr, G4cout, G4endl, G4State_Abort, G4StateManager::GetExceptionHandler(), G4StateManager::GetStateManager(), G4VExceptionHandler::Notify(), and RunMustBeAborted.
00045 { 00046 G4VExceptionHandler* exceptionHandler 00047 = G4StateManager::GetStateManager()->GetExceptionHandler(); 00048 G4bool toBeAborted = true; 00049 if(exceptionHandler) 00050 { 00051 toBeAborted = exceptionHandler 00052 ->Notify(originOfException,exceptionCode,severity,description); 00053 } 00054 else 00055 { 00056 static const G4String es_banner 00057 = "\n-------- EEEE ------- G4Exception-START -------- EEEE -------\n"; 00058 static const G4String ee_banner 00059 = "\n-------- EEEE -------- G4Exception-END --------- EEEE -------\n"; 00060 static const G4String ws_banner 00061 = "\n-------- WWWW ------- G4Exception-START -------- WWWW -------\n"; 00062 static const G4String we_banner 00063 = "\n-------- WWWW -------- G4Exception-END --------- WWWW -------\n"; 00064 std::ostringstream message; 00065 message << "\n*** ExceptionHandler is not defined ***\n" 00066 << "*** G4Exception : " << exceptionCode << G4endl 00067 << " issued by : " << originOfException << G4endl 00068 << description << G4endl; 00069 switch(severity) 00070 { 00071 case FatalException: 00072 G4cerr << es_banner << message.str() << "*** Fatal Exception ***" 00073 << ee_banner << G4endl; 00074 break; 00075 case FatalErrorInArgument: 00076 G4cerr << es_banner << message.str() << "*** Fatal Error In Argument ***" 00077 << ee_banner << G4endl; 00078 break; 00079 case RunMustBeAborted: 00080 G4cerr << es_banner << message.str() << "*** Run Must Be Aborted ***" 00081 << ee_banner << G4endl; 00082 break; 00083 case EventMustBeAborted: 00084 G4cerr << es_banner << message.str() << "*** Event Must Be Aborted ***" 00085 << ee_banner << G4endl; 00086 break; 00087 default: 00088 G4cout << ws_banner << message.str() 00089 << "*** This is just a warning message. ***" 00090 << we_banner << G4endl; 00091 toBeAborted = false; 00092 break; 00093 } 00094 } 00095 if(toBeAborted) 00096 { 00097 if(G4StateManager::GetStateManager()->SetNewState(G4State_Abort)) 00098 { 00099 G4cerr << G4endl << "*** G4Exception: Aborting execution ***" << G4endl; 00100 abort(); 00101 } 00102 else 00103 { 00104 G4cerr << G4endl << "*** G4Exception: Abortion suppressed ***" 00105 << G4endl << "*** No guarantee for further execution ***" << G4endl; 00106 } 00107 } 00108 }
std::ostream& operator<< | ( | std::ostream & | os, | |
const G4Timer & | t | |||
) |
Definition at line 87 of file G4Timer.cc.
References G4Timer::GetRealElapsed(), G4Timer::GetSystemElapsed(), G4Timer::GetUserElapsed(), and G4Timer::IsValid().
00088 { 00089 if (t.IsValid()) 00090 { 00091 os << "User=" << t.GetUserElapsed() 00092 << "s Real=" << t.GetRealElapsed() 00093 << "s Sys=" << t.GetSystemElapsed() << "s"; 00094 } 00095 else 00096 { 00097 os << "User=****s Real=****s Sys=****s"; 00098 } 00099 return os; 00100 }